private TabPage CreateGeneralPage() { int rowIndex = 0; int tabIndex = 0; TabPage tabPage = NewTabPage("常规"); FormTools.AddCheckBox(tabPage, "隐藏主菜单,直到按ALT键", Program.Preferences.Settings.HideMainMenu, 0, ref rowIndex, ref tabIndex); RdcCheckBox autoSaveCheckBox = FormTools.AddCheckBox(tabPage, "自动保存间隔:", Program.Preferences.Settings.AutoSaveFiles, 0, ref rowIndex, ref tabIndex); autoSaveCheckBox.Size = new Size(120, 24); NumericTextBox autoSaveInterval = new NumericTextBox(0, 60, "自动保存间隔必须为0到60分钟") { Location = new Point(autoSaveCheckBox.Right + 1, autoSaveCheckBox.Top + 2), Size = new Size(20, 24), TabIndex = tabIndex++, TabStop = true, Enabled = false }; autoSaveInterval.Setting = Program.Preferences.Settings.AutoSaveInterval; autoSaveCheckBox.CheckedChanged += delegate { autoSaveInterval.Enabled = autoSaveCheckBox.Checked; }; Label label = new Label(); label.Location = new Point(autoSaveInterval.Right + 3, autoSaveCheckBox.Top + 4); label.Size = new Size(60, 24); label.Text = "分钟(s)"; Label label2 = label; RdcCheckBox rdcCheckBox = FormTools.AddCheckBox(tabPage, "启动时提示重新连接连接的服务器", Program.Preferences.Settings.ReconnectOnStartup, 0, ref rowIndex, ref tabIndex); Button button = new Button(); button.Location = new Point(8, rdcCheckBox.Bottom + 8); button.TabIndex = tabIndex++; button.Text = "默认群组设置..."; button.Width = 140; Button button2 = button; button2.Click += delegate { DefaultSettingsGroup.Instance.DoPropertiesDialog(); }; tabPage.Controls.Add(autoSaveCheckBox, autoSaveInterval, label2, button2); return(tabPage); }
public RecentlyUsedSettingsTabPage(TabbedSettingsDialog dialog, RecentlyUsedSettings settings) : base(dialog, settings) { int rowIndex = 0; int num = 0; Label label = FormTools.NewLabel("显示数量", 0, rowIndex); NumericTextBox numericTextBox = new NumericTextBox(1, 20, "数量应该在 1 到 20 之间") { Location = FormTools.NewLocation(1, rowIndex++), TabIndex = num++, TabStop = true, Setting = base.Settings.MaxNumberOfServers, Size = new Size(20, 20) }; base.Controls.Add(label, numericTextBox); base.FocusControl = numericTextBox; }
private void InitComp() { Label label = new Label(); Label label2 = new Label(); _fourThreeButton = new Button(); _sixteenNineButton = new Button(); _sixteenTenButton = new Button(); int num = 0; label.Location = new Point(8, 8); label.Size = new Size(50, 23); label.Text = "宽度:"; label.TextAlign = ContentAlignment.MiddleLeft; label2.Location = new Point(8, 40); label2.Size = new Size(50, 23); label2.Text = "高度:"; label2.TextAlign = ContentAlignment.MiddleLeft; _widthTextBox = new NumericTextBox(1, int.MaxValue, "宽度必须至少为1像素"); _widthTextBox.Location = new Point(72, 8); _widthTextBox.Size = new Size(75, 20); _widthTextBox.TabIndex = num++; _heightTextBox = new NumericTextBox(1, int.MaxValue, "高度必须至少为1像素"); _heightTextBox.Location = new Point(72, 40); _heightTextBox.Size = new Size(75, 20); _heightTextBox.TabIndex = num++; _fourThreeButton.Location = new Point(160, 8); _fourThreeButton.TabIndex = num++; _fourThreeButton.Text = "4 x 3"; _fourThreeButton.Click += fourThreeButton_Click; _sixteenNineButton.Location = new Point(160, 40); _sixteenNineButton.TabIndex = num++; _sixteenNineButton.Text = "16 x 9"; _sixteenNineButton.Click += sixteenNineButton_Click; _sixteenTenButton.Location = new Point(160, 72); _sixteenTenButton.TabIndex = num++; _sixteenTenButton.Text = "16 x 10"; _sixteenTenButton.Click += sixteenTenButton_Click; base.ClientSize = new Size(238, 143); base.Controls.Add(_sixteenTenButton, _sixteenNineButton, _fourThreeButton, label, _widthTextBox, label2, _heightTextBox); InitButtons(); this.ScaleAndLayout(); }
private TabPage CreateServerTreePage() { int rowIndex = 0; int tabIndex = 0; TabPage tabPage = NewTabPage("群组树"); GroupBox groupBox = new GroupBox(); groupBox.Text = "服务器树"; GroupBox groupBox2 = groupBox; FormTools.AddCheckBox(groupBox2, "单击以选中将焦点移到远程客户端", Program.Preferences.Settings.FocusOnClick, 0, ref rowIndex, ref tabIndex); FormTools.AddCheckBox(groupBox2, "树控件处于非活动状态时使节点变暗", Program.Preferences.Settings.DimNodesWhenInactive, 0, ref rowIndex, ref tabIndex); _treeLocationCombo = FormTools.AddLabeledValueDropDown(groupBox2, "位置", ref rowIndex, ref tabIndex, (DockStyle v) => v.ToString(), new DockStyle[2] { DockStyle.Left, DockStyle.Right }); _treeVisibilityCombo = FormTools.AddLabeledValueDropDown(groupBox2, "可见方式", ref rowIndex, ref tabIndex, (ControlVisibility v) => v.ToString(), new ControlVisibility[3] { ControlVisibility.Dock, ControlVisibility.AutoHide, ControlVisibility.Hide }); Label label = FormTools.NewLabel("弹出延迟:", 0, rowIndex++); label.Left += 24; label.Size = new Size(80, label.Height); NumericTextBox serverTreeAutoHidePopUpDelay = new NumericTextBox(0, 1000, "自动隐藏弹出延迟时间必须为0到1000毫秒") { Enabled = false, Location = new Point(label.Right, label.Top), Size = new Size(40, 24), Setting = Program.Preferences.Settings.ServerTreeAutoHidePopUpDelay, TabStop = true, TabIndex = tabIndex++ }; _treeVisibilityCombo.SelectedIndexChanged += delegate { serverTreeAutoHidePopUpDelay.Enabled = (_treeVisibilityCombo.SelectedValue == ControlVisibility.AutoHide); }; groupBox2.AddControlsAndSizeGroup(label); Label label2 = new Label(); label2.Location = new Point(serverTreeAutoHidePopUpDelay.Right + 3, label.Top); label2.Size = new Size(80, 24); label2.Text = "毫秒(s)"; Label label3 = label2; groupBox2.Controls.Add(serverTreeAutoHidePopUpDelay, label3); groupBox2.SizeAndLocate(null); _virtualGroupsGroup = new GroupBox { Text = "虚拟群组" }; foreach (IBuiltInVirtualGroup item in Program.BuiltInVirtualGroups.Where((IBuiltInVirtualGroup group) => group.IsVisibilityConfigurable)) { _virtualGroupsGroup.Controls.Add(new CheckBox { Size = new Size(112, 24), Tag = item, Text = item.Text }); } FormTools.LayoutGroupBox(_virtualGroupsGroup, 2, groupBox2); rowIndex = 0; tabIndex = 0; GroupBox groupBox3 = new GroupBox(); FormTools.AddLabeledValueDropDown(groupBox3, "组排序方式", Program.Preferences.Settings.GroupSortOrder, ref rowIndex, ref tabIndex, Helpers.SortOrderToString, new SortOrder[2] { SortOrder.ByName, SortOrder.None }); FormTools.AddLabeledEnumDropDown(groupBox3, "服务器排序方式", Program.Preferences.Settings.ServerSortOrder, ref rowIndex, ref tabIndex, Helpers.SortOrderToString); groupBox3.Text = "排序方式"; FormTools.LayoutGroupBox(groupBox3, 2, _virtualGroupsGroup); tabPage.Controls.Add(groupBox2, groupBox3, _virtualGroupsGroup); return(tabPage); }