C#只是一种语言投票网页制作,一种面向对象的语言,你说的大概是个投票系统之类的吧,实现很简单的。选择一个IDE开发,既然你选择C#语言,最好选择微软的VS2005、2008。具体实现方法网上应该很多,自己搜索一下。
———————
以前写个这样的功能,限于帖子,提供主要代码,可供参考(vs 2005)。
1using System;
2using System.Data;
3using System.Configuration;
4using System.Web;
5using System.Web.Security;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8using System.Web.UI.WebControls.WebParts;
9using System.Web.UI.HtmlControls;
11
12public partial class _Default : System.Web.UI.Page
13…{
14 protected void Page_Load(object sender, EventArgs e)
15 …{
16 if (!IsPostBack)
17 …{
18 string[] pollselect = new string[] …{ “会”, “不会”, “不知道” };
19 RadioButtonList1.DataSource = pollselect;
20 RadioButtonList1.DataBind();
21 }
22 }
23 protected void Button1_Click(object sender, EventArgs e)
24 …{
25 Response.Redirect(“pollresult.aspx?result=” + RadioButtonList1.SelectedIndex.ToString());
26 RadioButtonList1.SelectedIndex = -1;
27 }
28}
29
————————–
1using System;
2using System.Data;
3using System.Configuration;
4using System.Collections;
5using System.Web;
6using System.Web.Security;
7using System.Web.UI;
8using System.Web.UI.WebControls;
9using System.Web.UI.WebControls.WebParts;
10using System.Web.UI.HtmlControls;
11using System.IO;
14public partial class pollresult : System.Web.UI.Page
15…{
16 float poll1ratio = 0F;
17 float poll2ratio = 0F;
18 float poll3ratio = 0F;
19
20 protected void Page_Load(object sender, EventArgs e)
21 …{
22 Image1.Height = 15;
23 Image2.Height = 15;
24 Image3.Height = 15;
25 int i = int.Parse(Request.QueryString[“result”].ToString());
26 string Path = Request.PhysicalApplicationPath + @”\App_Data\savepoll.dat”;
27 if (!File.Exists(Path))
28 …{
29 FileStream fs = File.Create(Path);
30 fs.Close();
31 BinaryWriter bw1 = new BinaryWriter(new FileStream(Path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite));
32 bw1.Write(010);
33 bw1.Write(010);
34 bw1.Write(010);
35 bw1.Close();
36
37 }
38 else
39 …{
40 BinaryReader br = new BinaryReader(new FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
41 int poll1 = br.ReadInt32();
42 int poll2 = br.ReadInt32();
43 int poll3 = br.ReadInt32();
44 if (i == 0) poll1++;
45 else if (i == 1) poll2++;
46 else if (i == 2) poll3++;
47 br.Close();
48
49 int pollsum = poll1 + poll2 + poll3;
50 poll1ratio = Convert.ToSingle((float)poll1 / pollsum);
51 lbyes.Text = Math.Round((poll1ratio * 100), 2).ToString() + “%”;
52 poll2ratio = Convert.ToSingle((float)poll2 / pollsum);
53 lbno.Text = Math.Round((poll2ratio * 100), 2).ToString() + “%”;
54 poll3ratio = Convert.ToSingle((float)poll3 / pollsum);
55 lbunknow.Text = Math.Round((poll3ratio * 100), 2).ToString() + “%”;
56 lbsum.Text = pollsum.ToString();
57
58 Image1.Width = (int)(poll1ratio * 100);
59 Image2.Width = (int)(poll2ratio * 100);
60 Image3.Width = (int)(poll3ratio * 100);
61
62 BinaryWriter bw2 = new BinaryWriter(new FileStream(Path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite));
63 bw2.Write(poll1);
64 bw2.Write(poll2);
65 bw2.Write(poll3);
66 bw2.Close();
67 }
68 }
69}
70