public void LabelStateEvent(string context, PictureBox pic, PictureBox text, int i) { if (pic.InvokeRequired) { InvokeLabelState labelCallback = new InvokeLabelState(LabelStateEvent); pic.Invoke(labelCallback, new object[] { context, pic, text, i }); } else { AnswerCount ac = new AnswerCount(); ac.ImageWidth = 40; ac.ImagesHeight = 40; ac.FontStyle = System.Drawing.FontStyle.Bold; ac.AnswerFamily = "微软雅黑"; ac.AnswerFontSize = 15.75F; pic.Image = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(69, 175, 101), 0, 41, System.Drawing.Color.FromArgb(69, 175, 101)); text.Image = ac.DrawingString(Brushes.White, i + ""); if (Global.Sound()) { System.Media.SystemSounds.Asterisk.Play(); //sp.Play(); } updateTop3(i, context); } }
public void LabelStateEvent(string context, PictureBox pic, PictureBox text, int i) { if (pic.InvokeRequired) { InvokeLabelState labelCallback = new InvokeLabelState(LabelStateEvent); pic.Invoke(labelCallback, new object[] { context, pic, text, i }); } else { string[] szItem = context.Split(':'); AnswerCount ac = new AnswerCount(); ac.ImageWidth = r; ac.ImagesHeight = r; ac.FontStyle = System.Drawing.FontStyle.Bold; ac.AnswerFamily = "微软雅黑"; ac.AnswerFontSize = 15.75F; pic.Image = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(69, 175, 101), 0, r + 1, System.Drawing.Color.FromArgb(69, 175, 101)); text.Image = ac.DrawingString(Brushes.White, szItem[0] + "组"); if (Global.Sound()) { System.Media.SystemSounds.Asterisk.Play(); //sp.Play(); } RESULT += (RESULT.Length > 0 ? "," : "") + context; Log.Debug("Result=" + RESULT); } }
public void LabelEvent(int x, PictureBox pb) { if (pb.InvokeRequired) { InvokeCallback labelCallback = new InvokeCallback(LabelEvent); pb.Invoke(labelCallback, new object[] { x, pb }); } else { PictureBox text = new PictureBox(); AnswerCount acd = new AnswerCount(); acd.ImageWidth = 50; acd.ImagesHeight = 40; acd.AnswerText = peopleValues[i] + "人"; acd.AnswerFamily = "微软雅黑"; acd.AnswerFontSize = 16f; acd.FontStyle = System.Drawing.FontStyle.Regular; acd.AnswerColor = Brushes.Black; acd.TextX = 0; acd.TextY = 4; text.Image = acd.DrawingString(); itemValueCanvas.Controls.Add(text); text.BackColor = System.Drawing.Color.Transparent; text.Location = new System.Drawing.Point(x + 20, (i + 1) * 20 + (i * labelH)); text.BringToFront(); //pb.Size = new System.Drawing.Size((int)lineMax - 100, labelH); //pb.Location = new System.Drawing.Point(x - 100); } }
public void LabelStateEventClear(PictureBox pic, PictureBox text, int i) { if (pic.InvokeRequired) { InvokeLabelStateClear labelCallback = new InvokeLabelStateClear(LabelStateEventClear); pic.Invoke(labelCallback, new object[] { pic, text, i }); } else { AnswerCount ac = new AnswerCount(); ac.ImageWidth = 40; ac.ImagesHeight = 40; ac.FontStyle = System.Drawing.FontStyle.Bold; ac.AnswerFamily = "微软雅黑"; ac.AnswerFontSize = 15.75F; pic.Image = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(204, 204, 204), 2, 41, System.Drawing.Color.White); text.Image = ac.DrawingString(Brushes.DimGray, i + ""); //pic.Image = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(69, 175, 101), 0, 41, System.Drawing.Color.FromArgb(69, 175, 101)); //text.Image = ac.DrawingString(Brushes.White, i + ""); } }
private int SetPanel(string numberstr) { ClassInfo ci = JsonOper.DeserializeJsonToObject <ClassInfo>(numberstr); si = ci.Data.Student; int _count = screenWidth / 51; int _line = ci.Data.StudentCount % _count > 0 ? ci.Data.StudentCount / _count + 1 : ci.Data.StudentCount / _count; int panelHeight = _line * 50 + 10;/////////////////////// if (_line == 2) { panelHeight = _line * 50 + 60; } else if (_line == 1) { panelHeight = _line * 50 + 110; } int panelLH = this.screenHeight - panelHeight; this.webBrowser1.Size = new System.Drawing.Size(screenWidth, screenHeight - panelHeight - 80); ///this.panel1.Location = new System.Drawing.Point(0, 0);//panelLH /// this.panel1.Size = new System.Drawing.Size(this.screenWidth, panelHeight); this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Size = new System.Drawing.Size(this.screenWidth, panelHeight); //"✔", "✘" int picWidth = 200; double picHightRatio = 0.12; pictureBox_A.Top = (int)(panelHeight * picHightRatio); pictureBox_B.Top = (int)(panelHeight * picHightRatio); pictureBox_C.Top = (int)(panelHeight * picHightRatio); pictureBox_D.Top = (int)(panelHeight * picHightRatio); pictureBox_R.Top = (int)(panelHeight * picHightRatio); pictureBox_W.Top = (int)(panelHeight * picHightRatio); double picLeft = 0.08; pictureBox_A.Left = (int)(screenWidth * (picLeft + 0.15 * 0)); pictureBox_B.Left = (int)(screenWidth * (picLeft + 0.15 * 1)); pictureBox_C.Left = (int)(screenWidth * (picLeft + 0.15 * 2)); pictureBox_D.Left = (int)(screenWidth * (picLeft + 0.15 * 3)); pictureBox_R.Left = (int)(screenWidth * (picLeft + 0.15 * 4)); pictureBox_W.Left = (int)(screenWidth * (picLeft + 0.15 * 5)); if (screenWidth <= 1024) { pictureBox_A.Left = 50; pictureBox_B.Left = 210; pictureBox_C.Left = 370; pictureBox_D.Left = 530; pictureBox_R.Left = 690; pictureBox_W.Left = 850; } int textLeftBias = 20; label_A.Left = pictureBox_A.Left - textLeftBias; label_B.Left = pictureBox_B.Left - textLeftBias; label_C.Left = pictureBox_C.Left - textLeftBias; label_D.Left = pictureBox_D.Left - textLeftBias; label_R.Left = pictureBox_R.Left - textLeftBias; label_W.Left = pictureBox_W.Left - textLeftBias; int textTopBias = 3; label_A.Top = textTopBias; label_B.Top = textTopBias; label_C.Top = textTopBias; label_D.Top = textTopBias; label_R.Top = textTopBias; label_W.Top = textTopBias; int text2LeftBias = 78; label_Ar.Left = pictureBox_A.Left + text2LeftBias; label_Br.Left = pictureBox_B.Left + text2LeftBias; label_Cr.Left = pictureBox_C.Left + text2LeftBias; label_Dr.Left = pictureBox_D.Left + text2LeftBias; label_Rr.Left = pictureBox_R.Left + text2LeftBias; label_Wr.Left = pictureBox_W.Left + text2LeftBias; label_Ar.BackColor = CircleBackgroundColor; label_Br.BackColor = CircleBackgroundColor; label_Cr.BackColor = CircleBackgroundColor; label_Dr.BackColor = CircleBackgroundColor; label_Rr.BackColor = CircleBackgroundColor; label_Wr.BackColor = CircleBackgroundColor; int text2TopBias = 60; label_Ar.Top = text2TopBias; label_Br.Top = text2TopBias; label_Cr.Top = text2TopBias; label_Dr.Top = text2TopBias; label_Rr.Top = text2TopBias; label_Wr.Top = text2TopBias; this.pictureBox_A.Size = new System.Drawing.Size(160, 160); this.pictureBox_B.Size = new System.Drawing.Size(160, 160); this.pictureBox_C.Size = new System.Drawing.Size(160, 160); this.pictureBox_D.Size = new System.Drawing.Size(160, 160); this.pictureBox_R.Size = new System.Drawing.Size(160, 160); this.pictureBox_W.Size = new System.Drawing.Size(160, 160); //pictureBox_A.Location = new System.Drawing.Point(picWidth, panelLH + 39); //pictureBox_B.Location = new System.Drawing.Point(picWidth * 2, panelLH + 39); //pictureBox_C.Location = new System.Drawing.Point(picWidth * 3, panelLH + 39); //pictureBox_D.Location = new System.Drawing.Point(picWidth * 4, panelLH + 39); //pictureBox_R.Location = new System.Drawing.Point(picWidth * 5, panelLH + 39); //pictureBox_W.Location = new System.Drawing.Point(picWidth * 6, panelLH + 39); statisticABCD(); int highInterval = 10;//三行的行间距 if (_line == 2) { highInterval = 25;//两行变三行,两行的行间距 } else if (_line == 1) { highInterval = 55; } int _lw = 0; int _br = 1; int _locationWidth = 0; int _locationHeight = 40; for (int i = 1; i <= ci.Data.StudentCount; i++) { _locationHeight = (_lw * 40) + ((_lw + 1) * highInterval); if (i == 1 || _br % 2 == 0) { _locationWidth = (screenWidth - _count * 51) / 2 + 5; } else { _locationWidth += 51; } if (i % _count == 0) { _br *= 2; if (_lw <= _line) { _lw++; } } else { _br = 1; } PictureBox pic = new PictureBox(); AnswerCount ac = new AnswerCount(); ac.ImageWidth = 40; ac.ImagesHeight = 40; ac.FontStyle = System.Drawing.FontStyle.Bold; ac.AnswerFamily = "微软雅黑"; ac.AnswerFontSize = 15.75F; Image lbimg = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(254, 80, 79), 0, 41, System.Drawing.Color.FromArgb(254, 80, 79)); Image textimg = ac.DrawingString(Brushes.White, i + ""); bool ishasnum = false; int nStudentCount = ci.Data.Student.Length; for (int j = 0; j < nStudentCount; j++) { string seat0 = ci.Data.Student[j].SEAT.Replace("-", ""); if (seat0 == "") { seat0 = "0"; } int nSeat0 = Util.toInt(seat0); if (i == nSeat0) { ishasnum = true; break; } } if (ishasnum) { textimg = ac.DrawingString(Brushes.DimGray, i + ""); lbimg = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(204, 204, 204), 2, 41, System.Drawing.Color.White); } pic.Location = new System.Drawing.Point(_locationWidth, _locationHeight); pic.Name = "click_" + i; pic.Size = new System.Drawing.Size(41, 41); pic.TabIndex = 0; pic.Image = lbimg; PictureBox text = new PictureBox(); text.BackColor = System.Drawing.Color.Transparent; text.Location = new System.Drawing.Point(0, 0); text.Name = "text_" + i; text.Size = new System.Drawing.Size(41, 41); text.TabIndex = 0; text.Image = textimg; pic.Controls.Add(text); al.Add(pic); alText.Add(text); clickstate.Add(0); this.panel1.Controls.Add(pic); } return(panelHeight); }
private int SetPanel(string numberstr) { ClassInfo ci = JsonOper.DeserializeJsonToObject <ClassInfo>(numberstr); si = ci.Data.Student; int _count = screenWidth / 51; int _line = ci.Data.StudentCount % _count > 0 ? ci.Data.StudentCount / _count + 1 : ci.Data.StudentCount / _count; int panelHeight = _line * 50 + 10;/////////////////////// if (_line == 2) { panelHeight = _line * 50 + 60; } else if (_line == 1) { panelHeight = _line * 50 + 110; } int panelLH = this.screenHeight - panelHeight; this.panel1.Location = new System.Drawing.Point(0, 0);//panelLH this.panel1.Size = new System.Drawing.Size(this.screenWidth, panelHeight); this.panel2.Location = new System.Drawing.Point(0, 0);//panelLH this.panel2.Size = new System.Drawing.Size(this.screenWidth, panelHeight); this.panel1.BringToFront(); this.panel2.Hide(); label_top3_1.Text = ""; label_top3_2.Text = ""; label_top3_3.Text = ""; int top3_top = (panelHeight - label_top3_1.Size.Height) / 2 - 10; label_top3_1.Text = " "; label_top3_2.Text = " "; label_top3_3.Text = " "; label_top3_1.Top = top3_top; label_top3_2.Top = top3_top; label_top3_3.Top = top3_top; int highInterval = 10;//三行的行间距 if (_line == 2) { highInterval = 25;//两行变三行,两行的行间距 } else if (_line == 1) { highInterval = 55; } int _lw = 0; int _br = 1; int _locationWidth = 0; int _locationHeight = 40; int nStudentCount = ci.Data.StudentCount; for (int i = 1; i <= nStudentCount; i++) { _locationHeight = (_lw * 40) + ((_lw + 1) * highInterval); if (i == 1 || _br % 2 == 0) { _locationWidth = (screenWidth - _count * 51) / 2 + 5; } else { _locationWidth += 51; } if (i % _count == 0) { _br *= 2; if (_lw <= _line) { _lw++; } } else { _br = 1; } PictureBox pic = new PictureBox(); AnswerCount ac = new AnswerCount(); ac.ImageWidth = 40; ac.ImagesHeight = 40; ac.FontStyle = System.Drawing.FontStyle.Bold; ac.AnswerFamily = "微软雅黑"; ac.AnswerFontSize = 15.75F; Image lbimg = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(254, 80, 79), 0, 41, System.Drawing.Color.FromArgb(254, 80, 79)); Image textimg = ac.DrawingString(Brushes.White, i + ""); bool ishasnum = false; for (int j = 0; j < nStudentCount; j++) { string seat0 = ci.Data.Student[j].SEAT.Replace("-", ""); if (seat0 == "") { seat0 = "0"; } int nSeat0 = Util.toInt(seat0); if (i == nSeat0) { ishasnum = true; break; } } if (ishasnum) { textimg = ac.DrawingString(Brushes.DimGray, i + ""); lbimg = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(204, 204, 204), 2, 41, System.Drawing.Color.White); } pic.Location = new System.Drawing.Point(_locationWidth, _locationHeight); pic.Name = "click_" + i; pic.Size = new System.Drawing.Size(41, 41); pic.TabIndex = 0; pic.Image = lbimg; PictureBox text = new PictureBox(); text.BackColor = System.Drawing.Color.Transparent; text.Location = new System.Drawing.Point(0, 0); text.Name = "text_" + i; text.Size = new System.Drawing.Size(41, 41); text.TabIndex = 0; text.Image = textimg; pic.Controls.Add(text); al.Add(pic); alText.Add(text); clickstate.Add(0); this.panel1.Controls.Add(pic); } return(panelHeight); }
private int SetPanel_Group() { int panelHeight = 140; int panelLH = this.screenHeight - panelHeight; Group[] glist; int _count = 0; int _width = 0; if (Global.m_grouplist != null) { glist = Global.m_grouplist.grouplist; _count = glist.Length; _width = (this.screenWidth) / _count; } else { glist = new Group[0]; } if (bWithXitiResource) { this.webBrowser1.Size = new System.Drawing.Size(screenWidth, screenHeight - panelHeight - 80); this.panel1.Location = new System.Drawing.Point(0, panelLH); webBrowser1.Show(); pictureBox1.Visible = true; } else { webBrowser1.Hide(); this.panel1.Location = new System.Drawing.Point(0, 0);//panelLH } this.panel1.Size = new System.Drawing.Size(this.screenWidth, panelHeight); this.panel1.BringToFront(); int _lw = 0; int _br = 1; int _locationWidth = 0; int _locationHeight = 20; for (int i = 1; i <= _count; i++) { if (i <= _count / 2) { _locationWidth = (_width - r) * 6 / 10 + _width * (i - 1); } else { _locationWidth = (_width - r) * 4 / 10 + _width * (i - 1); } _locationWidth = (_width - r) * 5 / 10 + _width * (i - 1); PictureBox pic = new PictureBox(); AnswerCount ac = new AnswerCount(); ac.ImageWidth = r; ac.ImagesHeight = r; ac.FontStyle = System.Drawing.FontStyle.Bold; ac.AnswerFamily = "微软雅黑"; ac.AnswerFontSize = 18F; Image lbimg = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(254, 80, 79), 0, r + 1, System.Drawing.Color.FromArgb(254, 80, 79)); Image textimg = ac.DrawingString(Brushes.White, glist[i - 1].name + "组"); textimg = ac.DrawingString(Brushes.DimGray, glist[i - 1].name + "组"); lbimg = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(204, 204, 204), 2, r + 1, System.Drawing.Color.White); pic.Location = new System.Drawing.Point(_locationWidth, _locationHeight); pic.Name = "click_" + i; pic.Size = new System.Drawing.Size(r + 1, r + 1); pic.TabIndex = 0; pic.Image = lbimg; PictureBox text = new PictureBox(); text.BackColor = System.Drawing.Color.Transparent; text.Location = new System.Drawing.Point(0, 0); text.Name = "text_" + i; text.Size = new System.Drawing.Size(r, r); text.TabIndex = 0; text.Image = textimg; pic.Controls.Add(text); al.Add(pic); alText.Add(text); clickstate.Add(0); this.panel1.Controls.Add(pic); } return(panelHeight); }
public void SetItem(string answer, string selectAnswer) { _opa = screenWidth - 80; _lOpa = _opa * 0.65; _rOpa = _opa * 0.35; _lineMax = _lOpa - 125; _itemW = 125; _aH = this.panel2.Height - 20; _labelH = 34; _pTop = 20; _pLeft = 20; itemValueCanvas = new PictureBox(); itemValueCanvas.BackColor = System.Drawing.Color.White; if (answerList.Length == 6) { itemValueCanvas.Location = new System.Drawing.Point(_itemW, 20); } else { itemValueCanvas.Location = new System.Drawing.Point(_itemW, 60); } itemValueCanvas.Name = "itemValue"; itemValueCanvas.Size = new System.Drawing.Size((int)_lineMax, _aH); itemValueCanvas.TabIndex = 0; itemValueCanvas.TabStop = false; this.panel2.Controls.Add(itemValueCanvas); ////////////////////////////////////// // 右侧正确答案 ////////////////////////////////////// answerBox = new PictureBox(); answerBox.BackColor = System.Drawing.Color.White; answerBox.Location = new System.Drawing.Point((int)_lineMax + 125 + _pLeft, 0); answerBox.Name = "answerBox"; answerBox.Size = new System.Drawing.Size((int)_rOpa, _aH); answerBox.TabIndex = 0; answerBox.TabStop = false; if (answer != null && answer.Length > 0) { this.panel2.Controls.Add(answerBox); } // PictureBox answerTextBox = new PictureBox(); answerTextBox.BackColor = System.Drawing.Color.Transparent; answerTextBox.Location = new System.Drawing.Point(((int)_rOpa - 210) / 2, 70); answerTextBox.Name = "answerTextBox"; answerTextBox.Size = new System.Drawing.Size(210, 210); answerTextBox.TabIndex = 0; answerTextBox.TabStop = false; if (answer != null && answer.Length > 0) { answerBox.Controls.Add(answerTextBox); } //正确答案几个字 PictureBox answerDescBox = new PictureBox(); answerDescBox.BackColor = System.Drawing.Color.Transparent; answerDescBox.Location = new System.Drawing.Point(48, 40); answerDescBox.Name = "answerDescBox"; answerDescBox.Size = new System.Drawing.Size(210, 210); answerDescBox.TabIndex = 0; answerDescBox.TabStop = false; if (answer != null && answer.Length > 0) { answerTextBox.Controls.Add(answerDescBox); } canvases = new ArrayList(); for (int i = 0; i < answerList.Length; i++) { Label label = new Label(); label.Font = new System.Drawing.Font("微软雅黑", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); label.ForeColor = System.Drawing.Color.FromArgb(102, 194, 217); Image lbimg = global::RueHelper.Properties.Resources.unanswer; if (answerList.Length == 6) { if (answerList[i] == selectAnswer) { lbimg = global::RueHelper.Properties.Resources.answer; label.ForeColor = System.Drawing.Color.White; } label.Location = new System.Drawing.Point(_pLeft, (i + 1) * _pTop + (i * _labelH) + 20); } else { string _temp = "✘"; if (selectAnswer == "R") { _temp = "✔"; } if (answerList[i] == _temp) { lbimg = global::RueHelper.Properties.Resources.answer; label.ForeColor = System.Drawing.Color.White; } label.Location = new System.Drawing.Point(_pLeft, (i + 1) * _pTop + (i * _labelH) + 60); } label.Image = lbimg; label.Name = "answeritem_" + i; label.Size = new System.Drawing.Size(105, _labelH); label.TabIndex = 0; label.Text = answerList[i]; label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.panel2.Controls.Add(label); PictureBox canvas = new PictureBox(); canvas.BackColor = System.Drawing.Color.White; canvas.Location = new System.Drawing.Point(_pLeft, (i + 1) * _pTop + (i * _labelH)); canvas.Name = "itemValueCanvas" + i; canvas.Size = new System.Drawing.Size((int)_lineMax, _labelH); canvas.TabIndex = 0; canvas.TabStop = false; itemValueCanvas.Controls.Add(canvas); canvases.Add(canvas); } AnswerCount ac = new AnswerCount(); ac.ImageWidth = answerBox.Width; ac.ImagesHeight = answerBox.Height; if (answer == "W") { ac.AnswerText = "✘"; } else if (answer == "R") { ac.AnswerText = "✔"; } else { ac.AnswerText = answer; } ac.AnswerFamily = "Arial"; ac.AnswerFontSize = 86f; ac.FontStyle = System.Drawing.FontStyle.Bold; ac.AnswerColor = Brushes.ForestGreen; ac.TextX = 46; ac.TextY = 70; answerTextBox.Image = ac.DrawingString(); AnswerCount acd = new AnswerCount(); acd.ImageWidth = answerDescBox.Width; acd.ImagesHeight = answerDescBox.Height; acd.AnswerText = "正确答案"; acd.AnswerFamily = "微软雅黑"; acd.AnswerFontSize = 20f; acd.FontStyle = System.Drawing.FontStyle.Regular; acd.AnswerColor = Brushes.Black; acd.TextX = 0; acd.TextY = 0; answerDescBox.Image = acd.DrawingString(); animate = new Animate(canvases, _lineMax, _rightAnswerIndex, _labelH, _rOpa, countValues, answerBox, itemValueCanvas, peopleValues); animate.StartAnimate(); }
public Form11(string answer, ArrayList al) { InitializeComponent(); this.panel2.Width = screenWidth - 40; this.panel2.Height = screenHeight - 100; this.panel2.Location = new System.Drawing.Point(20, 100); this.pictureBox2.Size = new System.Drawing.Size(423, 540);//恭喜以下同学获得奖励 _opa = screenWidth - 80; _lOpa = _opa * 0.65; _rOpa = _opa * 0.35; _lineMax = _lOpa - 125; _aH = this.panel2.Height - 20; _labelH = 34; _pLeft = 20; this.WindowState = FormWindowState.Maximized; this.TopMost = true; #if DEBUG this.TopMost = false;//form11,zzz #endif PictureBox answerBox = new PictureBox(); answerBox.BackColor = System.Drawing.Color.White; answerBox.Location = new System.Drawing.Point((int)_lineMax + 125 + _pLeft, 0); answerBox.Name = "answerBox"; answerBox.Size = new System.Drawing.Size((int)_rOpa, _aH); answerBox.TabIndex = 0; answerBox.TabStop = false; PictureBox answerTextBox = new PictureBox(); answerTextBox.BackColor = System.Drawing.Color.Transparent; answerTextBox.Location = new System.Drawing.Point(((int)_rOpa - 210) / 2, 70); answerTextBox.Name = "answerTextBox"; answerTextBox.Size = new System.Drawing.Size(210, 210); answerTextBox.TabIndex = 0; answerTextBox.TabStop = false; answerBox.Controls.Add(answerTextBox); PictureBox answerDescBox = new PictureBox(); answerDescBox.BackColor = System.Drawing.Color.Transparent; answerDescBox.Location = new System.Drawing.Point(48, 40); answerDescBox.Name = "answerDescBox"; answerDescBox.Size = new System.Drawing.Size(210, 210); answerDescBox.TabIndex = 0; answerDescBox.TabStop = false; answerTextBox.Controls.Add(answerDescBox); this.panel2.Controls.Add(answerBox); AnswerCount ac = new AnswerCount(); ac.ImageWidth = answerBox.Width; ac.ImagesHeight = answerBox.Height; ac.TextX = 46; ac.TextY = 70; if (answer == "W") { ac.TextX = 35; ac.AnswerText = "✘";//× } else if (answer == "R") { ac.TextX = 35; ac.AnswerText = "✔";//√ } else { ac.AnswerText = answer; } ac.AnswerFamily = "Arial"; ac.AnswerFontSize = 86f; ac.FontStyle = System.Drawing.FontStyle.Bold; ac.AnswerColor = Brushes.ForestGreen; answerTextBox.Image = ac.DrawingString(); AnswerCount acd = new AnswerCount(); acd.ImageWidth = answerDescBox.Width; acd.ImagesHeight = answerDescBox.Height; acd.AnswerText = "正确答案"; acd.AnswerFamily = "微软雅黑"; acd.AnswerFontSize = 20f; acd.FontStyle = System.Drawing.FontStyle.Regular; acd.AnswerColor = Brushes.Black; acd.TextX = 0; acd.TextY = 0; answerDescBox.Image = acd.DrawingString(); animate = new Animate(_lineMax, _labelH, _rOpa, answerBox, System.Drawing.Color.FromArgb(68, 176, 102)); animate.StartAnimate(); if (al.Count == 0) { this.pictureBox2.Image = global::RueHelper.Properties.Resources.goog0;//很遗憾,没有答对哦 } for (int i = 0; i < al.Count; i++) { Label l = new Label(); if (i == 0) { l.Location = new System.Drawing.Point(160, 200); l.Image = global::RueHelper.Properties.Resources.jp3; } else if (i == 1) { l.Location = new System.Drawing.Point(34, 264); l.Image = global::RueHelper.Properties.Resources.jp2; } else if (i == 2) { l.Location = new System.Drawing.Point(290, 290); l.Image = global::RueHelper.Properties.Resources.jp1; } l.Size = new System.Drawing.Size(114, 100); l.AutoSize = false; l.Text = al[i].ToString(); l.TextAlign = System.Drawing.ContentAlignment.BottomCenter; l.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.pictureBox2.Controls.Add(l); } }
private void SetPanel(string numberstr) { ClassInfo ci = JsonOper.DeserializeJsonToObject <ClassInfo>(numberstr); si = ci.Data.Student; int _count = screenWidth / 51; int _line = ci.Data.StudentCount % _count > 0 ? ci.Data.StudentCount / _count + 1 : ci.Data.StudentCount / _count; int panelHeight = _line * 50 + 10; int panelLH = this.screenHeight - panelHeight; this.panel1.Location = new System.Drawing.Point(0, panelLH); this.panel1.Size = new System.Drawing.Size(this.screenWidth, panelHeight); int _lw = 0; int _br = 1; int _locationWidth = 0; int _locationHeight = 40; for (int i = 1; i <= ci.Data.StudentCount; i++) { _locationHeight = (_lw * 40) + ((_lw + 1) * 10); if (i == 1 || _br % 2 == 0) { _locationWidth = (screenWidth - _count * 51) / 2 + 5; } else { _locationWidth += 51; } if (i % _count == 0) { _br *= 2; if (_lw <= _line) { _lw++; } } else { _br = 1; } PictureBox pic = new PictureBox(); AnswerCount ac = new AnswerCount(); ac.ImageWidth = 40; ac.ImagesHeight = 40; ac.FontStyle = System.Drawing.FontStyle.Bold; ac.AnswerFamily = "微软雅黑"; ac.AnswerFontSize = 15.75F; Image lbimg = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(254, 80, 79), 0, 41, System.Drawing.Color.FromArgb(254, 80, 79)); Image textimg = ac.DrawingString(Brushes.White, i + ""); bool ishasnum = false; string[] szStudentNumber = ci.Data.StudentNumbers.Split(','); int nStudent = szStudentNumber.Length; for (int j = 1; j <= nStudent; j++) { if (i == j) { ishasnum = true; break; } } if (ishasnum) { textimg = ac.DrawingString(Brushes.DimGray, i + ""); lbimg = ac.DrawingArcFill(1, 1, System.Drawing.Color.FromArgb(204, 204, 204), 2, 41, System.Drawing.Color.White); } pic.Location = new System.Drawing.Point(_locationWidth, _locationHeight); pic.Name = "click_" + i; pic.Size = new System.Drawing.Size(41, 41); pic.TabIndex = 0; pic.Image = lbimg; PictureBox text = new PictureBox(); text.BackColor = System.Drawing.Color.Transparent; text.Location = new System.Drawing.Point(0, 0); text.Name = "text_" + i; text.Size = new System.Drawing.Size(41, 41); text.TabIndex = 0; text.Image = textimg; pic.Controls.Add(text); al.Add(pic); alText.Add(text); clickstate.Add(0); this.panel1.Controls.Add(pic); } }