希望高手能给写一下详细的代码,多谢了,小弟刚学,着急呀,谢谢谢谢谢谢

解决方案 »

  1.   

    http://www.96ew.com/yuanma/net/89/2006/20060301069.html
      

  2.   

    如果要求不是很复杂的话随便用div写一下就OK啦
      

  3.   

    <%@ Page Language="VB"%>
    <script runat="server">
    Sub Enter_Click(Sender As Object, E As EventArgs)
    myimage.ImageUrl="showimage.aspx?thenumber=" & thenumber.Text
    myimage.Visible=True
    End Sub
    </script><html>
    <body>
    <p>请输入4位数字,就会自动生成由4位数字组成的图片
    <form runat=server>
    请输入四位数字:
    <asp:textbox id="thenumber" runat="server" /> 
    <asp:RequiredFieldValidator id="require1" ControlToValidate="thenumber" ErrorMessage="必须输入四位数字"  runat="server"/>
    <asp:RegularExpressionValidator id="Regular2" ControlToValidate="thenumber" ValidationExpression="[0-9]{4}" ErrorMessage="必须输入四位数字" runat="server" />
    <br>
    <asp:button id="enter" text="确定" Onclick="Enter_Click" runat="server" />
    <p>
    <asp:image id="myimage" visible="False" runat="server"/>
    </form>
    </body>
    </html>----------------<%@ Import Namespace="System.IO"%>
    <%@ Import Namespace="System.Drawing"%>
    <%@ Import Namespace="System.Drawing.Imaging"%>
    <Script Language="VB" Runat="Server">
    Sub Page_Load(Sender As Object,E as Eventargs)
    '获取传过来的数字字符串,注意本例规定必须是4个数字组成的字符串
    Dim numTemp As String =Request.QueryString("theNumber") '下面一段其实是建立一个空白的点阵图像,然后等待下面将数字图像填充到该空白图片中******************
    '建立点阵图像对象实例,也就是建立一个空白的图像,3个参数依次为图像的宽、高和图片格式
    Dim bmp As New Bitmap(70,25,PixelFormat.Format24bppRgb)
    '建立一个Graphics图像对象,并载入刚刚建立的bmp点阵对象实例
    Dim grh As Graphics = Graphics.FromImage(bmp)

    '下面一段其实是根据数字读取相应的数字图片,并将其填充到上面建立的空白图片中********************
    '下面逐个读取4张图片,并将其添加到上面建立的grh对象中
    Dim img As System.Drawing.Image
    Dim I As Integer,picPath As String
    For I=1 To 4
    '根据数字获取对应的图片物理路径
    picPath=Server.Mappath("images/" & Mid(numTemp,I,1) & ".gif")
    '读取该图片到Image对象中
    img=System.Drawing.Image.FromFile(picPath)
    '将该图像输出到图片的指定位置,Point有两个参数,分别是图像距左边和上边的距离
    grh.DrawImage(img,New Point(3+Img.Width*(I-1),3))  
    Next

    '将声成图片以Jpeg格式保存到输出流中,也就是会显示在页面上
    bmp.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg)
    End Sub
    </Script>
      

  4.   

    <%@ Page language="c#" src="ballot_result.cs" AutoEventWireup="false" Inherits="scm.vendor_start" %>
    <html>
    <head>
    <title>客诉系统</title>
    <link href="images/style.css" type="text/css" rel="stylesheet">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta http-equiv='refresh' content='100*10'>
    <script language="javascript"> 
        function openwin() { 
      window.open ("ballot_result.aspx", "newwindow", "height=200, top=100 , left=100 , width=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")
      } 
    </script> 
    </head>
    <body width="100%" bgcolor="#CCCCFF" leftMargin="0" topMargin="0" rightMargin="0"><form enctype="multipart/form-data" runat="server"><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
    <center>
    調查:這個客訴系統有作用嗎?<br>
    <ASP:DataGrid id="MyList" 
    showheader=false  
        AllowPaging="True" 
    AllowSorting="true"
        PageSize="50" 
    ShowFooter="false"
        PagerStyle-Visible="false"  
        runat="server" 
        Width="100%"
        GridLines="None"
        CellPadding="0"
        CellSpacing="1"
        bgcolor="#CCCCFF"
        HeaderStyle-BackColor="#CCCCFF"
        HeaderStyle-ForeColor="#CCCCFF"
        AlternatingItemStyle-BackColor="#ffffff"
        itemstyle-backcolor="#ffffff"               
        Font-Name="宋体"
        Font-Size="8pt"
        EnableViewState="false"
        AutoGenerateColumns="false" 
        DataKeyField="ballot_id"> 
    <Columns>
    <asp:TemplateColumn ItemStyle-Width="55%" HeaderText="主題"> 
    <ItemTemplate>
    <table>
    <tr><td width="100%">
    <%# DataBinder.Eval(Container.DataItem,"ballot_name").ToString()%>
    <img src="images/bar.jpg" width="<%# DataBinder.Eval(Container.DataItem,"ballot_num").ToString()%>" height="10">
    <%# DataBinder.Eval(Container.DataItem,"ballot_num").ToString()%>票
    <%# SubStr(DataBinder.Eval(Container.DataItem,"sum2").ToString()) %>%
    </td>
    </tr></table>
    </ItemTemplate> 
    </asp:TemplateColumn>
    </Columns> 
    </asp:DataGrid> 
    </table><tr><td width="100%">
    總票數:<asp:Label id="label2" runat="server"/>票
    </td>
    </tr></center>
    </form>
    </body>
    </html>
    ------------------
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Configuration;
    using System.Data.SqlClient; //这句不能少;否则不能那样连接数据库。呵呵!namespace scm
    { public class vendor_start : System.Web.UI.Page
    {
    public DataGrid MyList,MyList2; 
            protected System.Web.UI.WebControls.Label label1,label2;
    public static int CalculateQRecord(string s)
    {
    try

    DataRow dr=GetDataRow(s,"ballot");
    return System.Convert.ToInt32(dr["sum1"].ToString());
    }
    catch
    {
    return 0;
    }
    } public static DataRow GetDataRow(string sql,string TableName) 
    {
    try
    {
    SqlConnection sqlConnection=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["appeal"]);
    SqlDataAdapter sqlAdapter1 = new SqlDataAdapter(sql, sqlConnection);
    DataSet product = new DataSet();
    sqlAdapter1.Fill(product, TableName);
    return product.Tables[0].Rows[0];
    }
    catch (Exception ex)
    {
    throw (ex);
    }
    } private void Page_Load(object sender, System.EventArgs e)
    {
            if(!this.IsPostBack)
    {
     DataBind();

    DataBind();
    } DataView CreateDataSource()   
    {
    string nowDSN=ConfigurationSettings.AppSettings["appeal"];
        SqlConnection NewConn=new SqlConnection(nowDSN);     SqlCommand myCommand2=new SqlCommand("SELECT sum(ballot_num) as sum1 FROM ballot",NewConn);
    label2.Text = CalculateQRecord("SELECT sum(ballot_num) as sum1 FROM ballot").ToString();   //方法一
    NewConn.Open();
    //label1.Text=""+myCommand2.ExecuteScalar(); //方法二

    SqlDataAdapter myCommand=new SqlDataAdapter("SELECT (ballot_num/(SELECT sum(ballot_num) as sum1 FROM ballot))*100 as sum2,ballot_id,ballot_name,ballot_num FROM ballot",NewConn);
    DataSet ds = new DataSet();  
    myCommand.Fill(ds, "ballot");
    return ds.Tables["ballot"].DefaultView; NewConn.Close();
                Page.DataBind();  
    } void DataBind()   
    {   
    DataView source=CreateDataSource();
    if(!IsPostBack)   
    {   
    }   
    MyList.DataSource = source;    
    MyList.DataBind(); 
    } override protected void OnInit(EventArgs e)
    {
    InitializeComponent();
    base.OnInit(e);
    } private void InitializeComponent()
    {  
    this.Load += new System.EventHandler(this.Page_Load);
    }  

    protected string SubStr(string aa)
    {   
    aa=Server.UrlDecode(aa);
    if(aa.Length>4)
    {
    aa=aa.Substring(0,4);
    }
    return aa;
    }
    }
    }
      

  5.   

    好久没看见象luojianfeng(赚钱娶个漂亮媳妇)这么负责的帖子了.顶一下.