本文整理汇总了C#中System.Windows.Forms.RadioButton.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# RadioButton.Focus方法的具体用法?C# RadioButton.Focus怎么用?C# RadioButton.Focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.RadioButton
的用法示例。
在下文中一共展示了RadioButton.Focus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPoll
private void GetPoll()
{
pollGroupBox.Controls.Clear();
selectedChoice = -1;
Label lblTopText = new Label();
Label lblTopText2 = new Label();
Label lblTopText3 = new Label();
lblTopText.Name = "lblTopText";
lblTopText.Text = "Poll #" + (currentPoll + 1);
lblTopText.Location = new System.Drawing.Point(10, 15);
lblTopText.Width = pollGroupBox.Width;
lblTopText.TextAlign = ContentAlignment.MiddleLeft;
lblTopText.ForeColor = Color.Brown;
lblTopText.Font = new Font("Times New Roman", 11, FontStyle.Bold);
lblTopText.Height = 17;
pollGroupBox.Controls.Add(lblTopText);
lblTopText2.Name = "lblTopText2";
lblTopText2.Text = "Name: " + survey.Polls[currentPoll].Name;
lblTopText2.Location = new System.Drawing.Point( 10, lblTopText.Top + lblTopText.Height );
lblTopText2.Width = pollGroupBox.Width;
lblTopText2.TextAlign = ContentAlignment.MiddleLeft;
lblTopText2.ForeColor = Color.Green;
lblTopText2.Font = new Font("Times New Roman", 11);
lblTopText2.Height = 17;
pollGroupBox.Controls.Add(lblTopText2);
lblTopText3.Name = "lblTopText3";
lblTopText3.Text = StringWorkHelper.WrapString("Description: " + survey.Polls[currentPoll].Description,65);
lblTopText3.Location = new System.Drawing.Point( 10, lblTopText2.Top + lblTopText2.Height );
lblTopText3.Width = pollGroupBox.Width;
lblTopText3.TextAlign = ContentAlignment.MiddleLeft;
lblTopText3.ForeColor = Color.Green;
lblTopText3.Font = new Font("Times New Roman", 11);
lblTopText3.AutoSize = true;
pollGroupBox.Controls.Add(lblTopText3);
int index = 0;
foreach (Choice curChoice in survey.Polls[currentPoll].Choices)
{
index++;
RadioButton radioButton = new RadioButton();
radioButton.Name = index.ToString();
radioButton.Text = index.ToString() + ". " + curChoice.choice;
radioButton.Width = 300;
radioButton.Location = new System.Drawing.Point(10, lblTopText3.Top + lblTopText3.Height + 20 * (index - 1));
radioButton.CheckedChanged += delegate(Object sender2, EventArgs e2)
{
selectedChoice = Convert.ToInt32(((RadioButton)sender2).Name) - 1;
};
pollGroupBox.Controls.Add(radioButton);
if ( index == 1 )
radioButton.Focus();
}
TextBox customChoiceBox = new TextBox();
if (!(survey.TestMode) && (survey.Polls[currentPoll].CustomChoiceEnabled))
{
index++;
RadioButton radioButton = new RadioButton();
radioButton.Name = index.ToString();
radioButton.Text = index.ToString() + ". " + "Other choice:";
radioButton.Location = new System.Drawing.Point(10, lblTopText3.Top + lblTopText3.Height + 20 * (index - 1));
radioButton.CheckedChanged += delegate(Object sender2, EventArgs e2)
{
selectedChoice = Convert.ToInt32(((RadioButton)sender2).Name) - 1;
};
customChoiceBox.Name = "customChoiceBox";
customChoiceBox.Text = String.Empty;
customChoiceBox.Location = new System.Drawing.Point(radioButton.Left + radioButton.Width + 10, lblTopText3.Top + lblTopText3.Height + 20 * (index - 1));
customChoiceBox.Width = 200;
pollGroupBox.Controls.Add(radioButton);
pollGroupBox.Controls.Add(customChoiceBox);
}
Button btnSubmit = new Button();
btnSubmit.Name = "btnSubmit";
btnSubmit.Text = "Next";
btnSubmit.TextAlign = ContentAlignment.MiddleLeft;
btnSubmit.Image = Ilsrep.PollApplication.PollClientGUI.Properties.Resources.bullet_go;
btnSubmit.ImageAlign = ContentAlignment.MiddleRight;
btnSubmit.Padding = new Padding(11, 0, 11, 0);
btnSubmit.Location = new System.Drawing.Point(this.pollGroupBox.Width - btnSubmit.Width-10, lblTopText3.Top + lblTopText.Height + 20 * (index + 1));
btnSubmit.Click += delegate
{
if (selectedChoice == -1)
{
MessageBox.Show("Select a choice", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!(survey.TestMode) && (survey.Polls[currentPoll-1].CustomChoiceEnabled))
{
customChoice = customChoiceBox.Text;
}
ProcessResult();
if (currentPoll < survey.Polls.Count)
{
//.........这里部分代码省略.........