本文整理汇总了C#中System.Windows.Forms.RadioButton.SetBounds方法的典型用法代码示例。如果您正苦于以下问题:C# RadioButton.SetBounds方法的具体用法?C# RadioButton.SetBounds怎么用?C# RadioButton.SetBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.RadioButton
的用法示例。
在下文中一共展示了RadioButton.SetBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InputCreateRoomBox
public static TDSRoom InputCreateRoomBox(TDSRoom currentRoom)
{
var form = new Form();
var westRadioButton = new RadioButton {Text = "To the west", Enabled = false};
var eastRadioButton = new RadioButton {Text = "To the east", Enabled = false};
var northRadioButton = new RadioButton {Text = "To the north", Enabled = false};
var southRadioButton = new RadioButton {Text = "To the south", Enabled = false};
var isRequiredCheckBox = new CheckBox {Text = "Is required", Checked = true};
var isSecretCheckBox = new CheckBox {Text = "Is secret", Checked = false};
var doneButton = new Button {Text = "OK"};
form.Text = "Create new room";
form.ClientSize = new Size(396, 200);
form.Controls.AddRange(new Control[]
{
westRadioButton, eastRadioButton, northRadioButton, southRadioButton,
isRequiredCheckBox, isSecretCheckBox, doneButton
});
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterScreen;
form.MinimizeBox = false;
form.MaximizeBox = false;
westRadioButton.SetBounds(25, 25, 100, 25);
eastRadioButton.SetBounds(25, 50, 100, 25);
northRadioButton.SetBounds(25, 75, 100, 25);
southRadioButton.SetBounds(25, 100, 100, 25);
isRequiredCheckBox.SetBounds(125, 25, 100, 25);
isSecretCheckBox.SetBounds(125, 50, 100, 25);
doneButton.SetBounds(125, 100, 100, 25);
if (currentRoom.Level.GetRoom(currentRoom.X - 1, currentRoom.Y) == null) westRadioButton.Enabled = true;
if (currentRoom.Level.GetRoom(currentRoom.X + 1, currentRoom.Y) == null) eastRadioButton.Enabled = true;
if (currentRoom.Level.GetRoom(currentRoom.X, currentRoom.Y - 1) == null) northRadioButton.Enabled = true;
if (currentRoom.Level.GetRoom(currentRoom.X, currentRoom.Y + 1) == null) southRadioButton.Enabled = true;
TDSRoom result = null;
var resultX = 0;
var resultY = 0;
doneButton.Click += (e, sender) =>
{
if (westRadioButton.Checked) resultX = -1;
if (eastRadioButton.Checked) resultX = 1;
if (northRadioButton.Checked) resultY = -1;
if (southRadioButton.Checked) resultY = 1;
result = TDSControl.CreateRoom(currentRoom.Level, currentRoom.X + resultX, currentRoom.Y + resultY, isRequiredCheckBox.Checked, isSecretCheckBox.Checked);
form.Close();
};
form.ShowDialog();
return result;
}