本文整理汇总了C#中Label.SetBounds方法的典型用法代码示例。如果您正苦于以下问题:C# Label.SetBounds方法的具体用法?C# Label.SetBounds怎么用?C# Label.SetBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label.SetBounds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
public static DialogResult Show(string title, string promptText, ref string value, InputBoxValidation validation)
{
Form form = new Form();
Label label = new Label();
TextBox textBox = new TextBox();
Button button = new Button();
Button button1 = new Button();
form.Text = title;
label.Text = promptText;
textBox.Text = value;
button.Text = "OK";
button1.Text = "Cancel";
button.DialogResult = DialogResult.OK;
button1.DialogResult = DialogResult.Cancel;
label.SetBounds(9, 20, 372, 13);
textBox.SetBounds(12, 36, 372, 20);
button.SetBounds(228, 72, 75, 23);
button1.SetBounds(309, 72, 75, 23);
label.AutoSize = true;
textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
button.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
form.ClientSize = new Size(396, 107);
Control.ControlCollection controls = form.Controls;
Control[] controlArray = new Control[] { label, textBox, button, button1 };
controls.AddRange(controlArray);
form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterScreen;
form.MinimizeBox = false;
form.MaximizeBox = false;
form.AcceptButton = button;
form.CancelButton = button1;
if (validation != null)
{
form.FormClosing += new FormClosingEventHandler((object sender, FormClosingEventArgs e) => {
if (form.DialogResult == DialogResult.OK)
{
string text = validation(textBox.Text);
bool flag = text != "";
bool flag1 = flag;
e.Cancel = flag;
if (flag1)
{
MessageBox.Show(form, text, "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
textBox.Focus();
}
}
});
}
DialogResult dialogResult = form.ShowDialog();
value = textBox.Text;
return dialogResult;
}
示例2: Show
public static DialogResult Show(string title, string promptText, ref string value,
InputBoxValidation validation)
{
Form form = new Form();
Label label = new Label();
TextBox textBox = new TextBox();
Button buttonOk = new Button();
Button buttonCancel = new Button();
form.Text = title;
label.Text = promptText;
textBox.Text = value;
buttonOk.Text = "OK";
buttonCancel.Text = "Cancel";
buttonOk.DialogResult = DialogResult.OK;
buttonCancel.DialogResult = DialogResult.Cancel;
label.SetBounds(9, 20, 372, 13);
textBox.SetBounds(12, 36, 372, 20);
buttonOk.SetBounds(228, 72, 75, 23);
buttonCancel.SetBounds(309, 72, 75, 23);
label.AutoSize = true;
textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
form.ClientSize = new Size(396, 107);
form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
form.ClientSize = new Size(Math.Max(300,label.Right+10), form.ClientSize.Height);
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterScreen;
form.MinimizeBox = false;
form.MaximizeBox = false;
form.AcceptButton = buttonOk;
form.CancelButton = buttonCancel;
if (validation != null) {
form.FormClosing += delegate(object sender, FormClosingEventArgs e) {
if (form.DialogResult == DialogResult.OK) {
string errorText = validation(textBox.Text);
if (e.Cancel = (errorText != "")) {
MessageBox.Show(form, errorText, "Validation Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
textBox.Focus();
}
}
};
}
DialogResult dialogResult = form.ShowDialog();
value = textBox.Text;
return dialogResult;
}
示例3: InputBox
public static DialogResult InputBox(string title, string promptText, ref string value)
{
Form form = new Form();
Label label = new Label();
TextBox textBox = new TextBox();
Button buttonOk = new Button();
Button buttonCancel = new Button();
form.Text = title;
label.Text = promptText;
textBox.Text = value;
buttonOk.Text = "OK";
buttonCancel.Text = "Cancel";
buttonOk.DialogResult = DialogResult.OK;
buttonCancel.DialogResult = DialogResult.Cancel;
label.SetBounds(9, 20, 372, 13);
textBox.SetBounds(12, 36, 372, 20);
buttonOk.SetBounds(228, 72, 75, 23);
buttonCancel.SetBounds(309, 72, 75, 23);
label.AutoSize = true;
textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
form.ClientSize = new Size(396, 107);
form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterScreen;
form.MinimizeBox = false;
form.MaximizeBox = false;
form.AcceptButton = buttonOk;
form.CancelButton = buttonCancel;
DialogResult dialogResult = form.ShowDialog();
value = textBox.Text;
return dialogResult;
}
示例4: InitForm
private void InitForm()
{
this._isBaseControlList = base.GetBaseControl() is List;
GroupLabel label = new GroupLabel();
Label label2 = new Label();
this._dataSourceCombo = new UnsettableComboBox();
Label label3 = new Label();
this._dataMemberCombo = new UnsettableComboBox();
Label label4 = new Label();
this._dataTextFieldCombo = new UnsettableComboBox();
Label label5 = new Label();
this._dataValueFieldCombo = new UnsettableComboBox();
GroupLabel label6 = new GroupLabel();
GroupLabel label7 = null;
Label label8 = null;
Label label9 = null;
Label label10 = null;
Label label11 = null;
Label label12 = null;
if (this._isBaseControlList)
{
label7 = new GroupLabel();
label8 = new Label();
this._itemCountTextBox = new TextBox();
label9 = new Label();
this._itemsPerPageTextBox = new TextBox();
label11 = new Label();
this._decorationCombo = new ComboBox();
}
else
{
label10 = new Label();
this._rowsTextBox = new TextBox();
label12 = new Label();
this._selectTypeCombo = new ComboBox();
}
label.SetBounds(4, 4, 0x174, 0x10);
label.Text = MobileResource.GetString("ListGeneralPage_DataGroupLabel");
label.TabIndex = 0;
label.TabStop = false;
label2.SetBounds(8, 0x18, 0xa1, 0x10);
label2.Text = MobileResource.GetString("ListGeneralPage_DataSourceCaption");
label2.TabStop = false;
label2.TabIndex = 1;
this._dataSourceCombo.SetBounds(8, 40, 0xa1, 0x15);
this._dataSourceCombo.DropDownStyle = ComboBoxStyle.DropDownList;
this._dataSourceCombo.Sorted = true;
this._dataSourceCombo.TabIndex = 2;
this._dataSourceCombo.NotSetText = MobileResource.GetString("ListGeneralPage_UnboundComboEntry");
this._dataSourceCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataSource);
label3.SetBounds(0xd3, 0x18, 0xa1, 0x10);
label3.Text = MobileResource.GetString("ListGeneralPage_DataMemberCaption");
label3.TabStop = false;
label3.TabIndex = 3;
this._dataMemberCombo.SetBounds(0xd3, 40, 0xa1, 0x15);
this._dataMemberCombo.DropDownStyle = ComboBoxStyle.DropDownList;
this._dataMemberCombo.Sorted = true;
this._dataMemberCombo.TabIndex = 4;
this._dataMemberCombo.NotSetText = MobileResource.GetString("ListGeneralPage_NoneComboEntry");
this._dataMemberCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataMember);
label4.SetBounds(8, 0x43, 0xa1, 0x10);
label4.Text = MobileResource.GetString("ListGeneralPage_DataTextFieldCaption");
label4.TabStop = false;
label4.TabIndex = 5;
this._dataTextFieldCombo.SetBounds(8, 0x53, 0xa1, 0x15);
this._dataTextFieldCombo.DropDownStyle = ComboBoxStyle.DropDownList;
this._dataTextFieldCombo.Sorted = true;
this._dataTextFieldCombo.TabIndex = 6;
this._dataTextFieldCombo.NotSetText = MobileResource.GetString("ListGeneralPage_NoneComboEntry");
this._dataTextFieldCombo.SelectedIndexChanged += new EventHandler(this.OnSetPageDirty);
label5.SetBounds(0xd3, 0x43, 0xa1, 0x10);
label5.Text = MobileResource.GetString("ListGeneralPage_DataValueFieldCaption");
label5.TabStop = false;
label5.TabIndex = 7;
this._dataValueFieldCombo.SetBounds(0xd3, 0x53, 0xa1, 0x15);
this._dataValueFieldCombo.DropDownStyle = ComboBoxStyle.DropDownList;
this._dataValueFieldCombo.Sorted = true;
this._dataValueFieldCombo.TabIndex = 8;
this._dataValueFieldCombo.NotSetText = MobileResource.GetString("ListGeneralPage_NoneComboEntry");
this._dataValueFieldCombo.SelectedIndexChanged += new EventHandler(this.OnSetPageDirty);
label6.SetBounds(4, 120, 0x174, 0x10);
label6.Text = MobileResource.GetString("ListGeneralPage_AppearanceGroupLabel");
label6.TabIndex = 9;
label6.TabStop = false;
if (this._isBaseControlList)
{
label11.SetBounds(8, 140, 200, 0x10);
label11.Text = MobileResource.GetString("ListGeneralPage_DecorationCaption");
label11.TabStop = false;
label11.TabIndex = 10;
this._decorationCombo.SetBounds(8, 0x9c, 0xa1, 0x15);
this._decorationCombo.DropDownStyle = ComboBoxStyle.DropDownList;
this._decorationCombo.SelectedIndexChanged += new EventHandler(this.OnSetPageDirty);
this._decorationCombo.Items.AddRange(new object[] { MobileResource.GetString("ListGeneralPage_DecorationNone"), MobileResource.GetString("ListGeneralPage_DecorationBulleted"), MobileResource.GetString("ListGeneralPage_DecorationNumbered") });
this._decorationCombo.TabIndex = 11;
label7.SetBounds(4, 0xc1, 0x174, 0x10);
label7.Text = MobileResource.GetString("ListGeneralPage_PagingGroupLabel");
label7.TabIndex = 12;
label7.TabStop = false;
label8.SetBounds(8, 0xd5, 0xa1, 0x10);
//.........这里部分代码省略.........