日期:2014-05-17 浏览次数:20935 次
private void Form1_Load(object sender, EventArgs e)
{
string sqlcon = "Data Source=PC20130329;Initial Catalog=Exam;Integrated Security=True";
SqlConnection con = new SqlConnection(sqlcon);
int x = this.ClientRectangle.Width;
string sql="select * from Question";
SqlCommand command = new SqlCommand(sql,con);
con.Open();
SqlDataReader dataReader = command.ExecuteReader();
dataReader.Read();
string ss = (string)dataReader["Question"];
Label ques = new Label();
ques.Parent = panel;
ques.Font = new Font("宋体", 14);
ques.Width = x;
ques.Height = 100;
ques.AutoSize = false;
ques.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right|AnchorStyles.Bottom;
ques.Location = new Point(0, 0);
ques.BorderStyle = BorderStyle.FixedSingle;
ques.Text = ss;
Label ques0 = new Label();
ques0.Parent = panel;
ques0.Width = x;
/*//////高度
int meihang=x/20;
int a = ss.Length;
int hang =( a % meihang == 0 ? (a / meihang) : ((a / meihang)+1));