private LongRunningActionForm() { SuspendLayout(); base.AutoScaleDimensions = new SizeF(96f, 96f); base.AutoScaleMode = AutoScaleMode.Dpi; ProgressBar progressBar = new ProgressBar { Location = FormTools.NewLocation(0, 0), Size = new Size(450, 20), Style = ProgressBarStyle.Marquee }; _statusLabel = new Label { AutoEllipsis = true, Location = FormTools.NewLocation(0, 1), Size = progressBar.Size }; base.ClientSize = new Size(466, _statusLabel.Bottom + 16); base.StartPosition = FormStartPosition.Manual; base.Location = new Point(Program.TheForm.Left + (Program.TheForm.Width - base.Width) / 2, Program.TheForm.Top + (Program.TheForm.Height - base.Height) / 2); base.ControlBox = false; base.FormBorderStyle = FormBorderStyle.FixedDialog; base.Controls.AddRange(new Control[2] { progressBar, _statusLabel }); base.FormClosing += FormClosingHandler; base.Shown += ShownHandler; this.ScaleAndLayout(); }
public EncryptionSettingsTabPage(TabbedSettingsDialog dialog, EncryptionSettings settings) : base(dialog, settings) { int tabIndex = 0; int rowIndex = 0; CreateInheritanceControl(ref rowIndex, ref tabIndex); if (base.InheritanceControl != null) { base.InheritanceControl.EnabledChanged += delegate { PasswordEncryptionMethodCombo_Changed(null, null); }; } _passwordEncryptionMethodCombo = FormTools.AddLabeledEnumDropDown(this, "加密密码:", base.Settings.EncryptionMethod, ref rowIndex, ref tabIndex, Encryption.EncryptionMethodToString); _passwordEncryptionMethodCombo.Enter += PasswordEncryptionMethodCombo_Enter; _passwordEncryptionMethodCombo.SelectedIndexChanged += PasswordEncryptionMethodCombo_Changed; _passwordEncryptionDataLabel = FormTools.NewLabel(string.Empty, 0, rowIndex); _passwordEncryptionDataButton = new Button { Enabled = false, Location = FormTools.NewLocation(1, rowIndex++), Width = 340, TabIndex = tabIndex++, TextAlign = ContentAlignment.MiddleLeft }; _passwordEncryptionDataButton.Click += PasswordEncryptionMethodButton_Click; _passwordEncryptionDataInfoLabel = FormTools.NewLabel(string.Empty, 1, rowIndex++); _passwordEncryptionDataInfoLabel.Width = 340; base.Controls.Add(_passwordEncryptionDataLabel, _passwordEncryptionDataButton, _passwordEncryptionDataInfoLabel); }
private TabPage CreateFullScreenPage() { int rowIndex = 0; int tabIndex = 0; TabPage tabPage = NewTabPage("全屏"); _connectionBarEnabledCheckBox = FormTools.NewCheckBox("显示全屏工具栏", 0, rowIndex++, tabIndex++); _connectionBarEnabledCheckBox.CheckedChanged += ConnectionBarEnabledCheckedChanged; _connectionBarAutoHiddenCheckBox = FormTools.NewCheckBox("自动隐藏工具栏", 0, rowIndex++, tabIndex++); _connectionBarAutoHiddenCheckBox.Location = new Point(_connectionBarEnabledCheckBox.Left + 24, _connectionBarAutoHiddenCheckBox.Top); FormTools.AddCheckBox(tabPage, "全屏窗口始终位于顶部", Program.Preferences.Settings.FullScreenWindowIsTopMost, 0, ref rowIndex, ref tabIndex); if (RdpClient.SupportsMonitorSpanning) { FormTools.AddCheckBox(tabPage, "必要时使用多个显示器", Program.Preferences.Settings.UseMultipleMonitors, 0, ref rowIndex, ref tabIndex); } if (RdpClient.SupportsPanning) { _enablePanningCheckBox = FormTools.NewCheckBox("使用平移代替滚动条", 0, rowIndex++, tabIndex++); _enablePanningCheckBox.Setting = Program.Preferences.Settings.EnablePanning; _enablePanningCheckBox.CheckedChanged += EnablePanningCheckedChanged; Label label = FormTools.NewLabel("平移速度", 0, rowIndex); label.Size = new Size(116, 20); label.Location = new Point(_enablePanningCheckBox.Left + 24, label.Top); _panningAccelerationUpDown = new RdcNumericUpDown(); _panningAccelerationUpDown.Location = FormTools.NewLocation(1, rowIndex++); _panningAccelerationUpDown.Minimum = 1m; _panningAccelerationUpDown.Maximum = 9m; _panningAccelerationUpDown.Size = new Size(40, 20); _panningAccelerationUpDown.TabIndex = tabIndex++; _panningAccelerationUpDown.Setting = Program.Preferences.Settings.PanningAcceleration; tabPage.Controls.Add(_enablePanningCheckBox, label, _panningAccelerationUpDown); } tabPage.Controls.Add(_connectionBarEnabledCheckBox, _connectionBarAutoHiddenCheckBox); return(tabPage); }
protected void Create(out int rowIndex, out int tabIndex) { tabIndex = 0; rowIndex = 0; CreateInheritanceControl(ref rowIndex, ref tabIndex); Label label = FormTools.NewLabel("ËõÂÔͼ±ÈÀý:", 0, rowIndex); label.Size = new Size(140, 20); RdcNumericUpDown rdcNumericUpDown = new RdcNumericUpDown(); rdcNumericUpDown.Location = FormTools.NewLocation(1, rowIndex++); rdcNumericUpDown.Location = new Point(rdcNumericUpDown.Location.X, rdcNumericUpDown.Location.Y + 2); rdcNumericUpDown.Minimum = 1m; rdcNumericUpDown.Maximum = 9m; TSettingsGroup settings = base.Settings; rdcNumericUpDown.Setting = settings.ThumbnailScale; rdcNumericUpDown.Size = new Size(40, 20); rdcNumericUpDown.TabIndex = tabIndex++; RdcCheckBox rdcCheckBox = FormTools.NewCheckBox("Ëõ·ÅÍ£¿¿µÄÔ¶³Ì×ÀÃæÒÔÊʺϴ°¿Ú", 0, rowIndex++, tabIndex++); TSettingsGroup settings2 = base.Settings; rdcCheckBox.Setting = settings2.SmartSizeDockedWindow; RdcCheckBox rdcCheckBox2 = FormTools.NewCheckBox("Ëõ·Åδͣ¿¿µÄÔ¶³Ì×ÀÃæÒÔÊʺϴ°¿Ú", 0, rowIndex++, tabIndex++); TSettingsGroup settings3 = base.Settings; rdcCheckBox2.Setting = settings3.SmartSizeUndockedWindow; base.Controls.Add(label, rdcNumericUpDown, rdcCheckBox, rdcCheckBox2); }
private TabPage CreateClientAreaPage() { _casCustomButton = new Button(); _casCustomRadio = new RadioButton(); _thumbnailPercentageRadio = new RadioButton(); _thumbnailPixelsRadio = new RadioButton(); _thumbnailPixelsButton = new Button(); TabPage tabPage = NewTabPage("客户区"); _casSizeGroup = new GroupBox { Text = "客户区大小" }; _casSizeGroup.Controls.AddRange(FormTools.NewSizeRadios()); _casCustomRadio.Size = new Size(72, 24); _casCustomRadio.Text = "自定义"; _casSizeGroup.Controls.Add(_casCustomRadio); FormTools.LayoutGroupBox(_casSizeGroup, 2, null, 1, 1); RdcCheckBox rdcCheckBox = new RdcCheckBox(); rdcCheckBox.Size = new Size(480, 24); rdcCheckBox.Text = "锁定窗口大小"; rdcCheckBox.Location = FormTools.NewLocation(0, 0); rdcCheckBox.TabIndex = 0; rdcCheckBox.TabStop = true; rdcCheckBox.Setting = Program.Preferences.Settings.LockWindowSize; RdcCheckBox value = rdcCheckBox; _casSizeGroup.Controls.Add(value); _casCustomButton.Location = new Point(_casCustomRadio.Right + 10, _casCustomRadio.Location.Y); _casCustomButton.TabIndex = _casCustomRadio.TabIndex + 1; _casCustomButton.Click += CustomSizeClick; _casSizeGroup.Controls.Add(_casCustomButton); GroupBox groupBox = new GroupBox(); groupBox.Size = new Size(512, 72); groupBox.Text = "缩略图单位大小"; GroupBox groupBox2 = groupBox; groupBox2.Controls.Add(_thumbnailPixelsRadio, _thumbnailPercentageRadio); _thumbnailPixelsRadio.Size = new Size(80, 24); _thumbnailPixelsRadio.Text = "像素"; _thumbnailPercentageRadio.Size = new Size(88, 24); _thumbnailPercentageRadio.Text = "百分比"; _thumbnailPercentageRadio.CheckedChanged += ThumbnailPercentageRadioCheckedChanged; FormTools.LayoutGroupBox(groupBox2, 1, _casSizeGroup); int num = Math.Max(_thumbnailPixelsRadio.Right, _thumbnailPercentageRadio.Right); _thumbnailPixelsButton.Location = new Point(num + 10, _thumbnailPixelsRadio.Location.Y); _thumbnailPixelsButton.TabIndex = _thumbnailPercentageRadio.TabIndex + 1; _thumbnailPixelsButton.Click += CustomSizeClick; _thumbnailPercentageTextBox = new NumericTextBox(1, 100, "百分比必须介于1到100之间(含1和100)"); _thumbnailPercentageTextBox.Enabled = false; _thumbnailPercentageTextBox.Location = new Point(num + 11, _thumbnailPercentageRadio.Location.Y + 2); _thumbnailPercentageTextBox.Size = new Size(72, 20); _thumbnailPercentageTextBox.TabIndex = _thumbnailPercentageRadio.TabIndex + 1; groupBox2.Controls.Add(_thumbnailPixelsButton, _thumbnailPercentageTextBox); tabPage.Controls.Add(_casSizeGroup, groupBox2); return(tabPage); }
public SmartGroupPropertiesTabPage(TabbedSettingsDialog dialog, SmartGroupSettings settings) : base(dialog, settings, settings.Name) { _ruleGroup = ((dialog as SmartGroupPropertiesDialog).AssociatedNode as SmartGroup).RuleGroup; int rowIndex = 0; int tabIndex = 0; AddGroupName(ref rowIndex, ref tabIndex); AddParentCombo(ref rowIndex, ref tabIndex); rowIndex++; Label label = new Label { Location = FormTools.NewLocation(0, rowIndex++), Text = "符合以下", TextAlign = ContentAlignment.MiddleLeft, Size = new Size(56, 20) }; _anyAllCombo = new ValueComboBox <RuleGroupOperator>(Helpers.EnumValues <RuleGroupOperator>(), (RuleGroupOperator v) => v.ToString()) { Location = new Point(label.Right, label.Top), Size = new Size(50, 20), TabIndex = tabIndex++, SelectedValue = RuleGroupOperator.All }; Label label2 = new Label { Location = new Point(_anyAllCombo.Right + 5, label.Top), Text = "规则的服务器", TextAlign = ContentAlignment.MiddleLeft, Size = new Size(140, 20) }; base.Controls.Add(label, _anyAllCombo, label2); GroupBox groupBox = new GroupBox { Location = FormTools.NewLocation(0, rowIndex++) }; _rulePanel = new Panel { Location = FormTools.NewLocation(0, 0), AutoScroll = true }; int num = 302 - groupBox.Top - 40; _rulePanel.Size = new Size(480, num); _rulePanel.VerticalScroll.LargeChange = num; _rulePanel.VerticalScroll.SmallChange = num / 20; groupBox.Size = new Size(496, num + _rulePanel.Top * 2); groupBox.Controls.Add(_rulePanel); _nextRuleTabIndex = tabIndex; base.Controls.Add(groupBox); }
protected void AddLabel(string text, ref int rowIndex, ref int tabIndex) { Label label = new Label(); label.Location = FormTools.NewLocation(0, rowIndex++); label.Text = text; label.TextAlign = ContentAlignment.MiddleLeft; label.Size = new Size(500, 20); Label value = label; base.Controls.Add(value); }
private void AddHotKeyBox(Control parent, string label, string prefix, EnumSetting <Keys> setting, ref int rowIndex, ref int tabIndex) { parent.Controls.Add(FormTools.NewLabel(label, 0, rowIndex)); HotKeyBox hotKeyBox = new HotKeyBox(); hotKeyBox.Prefix = prefix; hotKeyBox.Location = FormTools.NewLocation(1, rowIndex++); hotKeyBox.Size = new Size(340, 20); hotKeyBox.TabIndex = tabIndex++; hotKeyBox.Setting = setting; HotKeyBox value = hotKeyBox; parent.Controls.Add(value); }
public ImportServersPropertiesPage(TabbedSettingsDialog dialog) : base(dialog, (SettingsGroup)null, "Server Settings") { int tabIndex = 0; int num = 0; Label value = new Label { Location = FormTools.NewLocation(0, num), Size = new Size(480, 48), Text = "选择包含服务器信息的文件,或在下面的文本框中输入信息。 服务器名称由逗号和换行符分隔。 允许扩展。" }; num += 2; base.Controls.Add(value); Button browseButton = new Button { TabIndex = tabIndex++, Text = "&B浏览" }; browseButton.Click += OnBrowseClick; _fileNameTextBox = FormTools.AddLabeledTextBox(this, "&File name:", ref num, ref tabIndex); _fileNameTextBox.Enabled = true; _fileNameTextBox.Width -= browseButton.Width + 8; browseButton.Location = new Point(_fileNameTextBox.Right + 8, _fileNameTextBox.Top); _serversTextBox = FormTools.NewTextBox(1, num, tabIndex++, 7); _serversTextBox.AcceptsReturn = true; _serversTextBox.Enabled = true; _serversTextBox.ScrollBars = ScrollBars.Vertical; num += 6; base.Controls.Add(browseButton, _serversTextBox); AddParentCombo(ref num, ref tabIndex); RdcTextBox fileNameTextBox = _fileNameTextBox; EventHandler value2 = delegate { _serversTextBox.Enabled = string.IsNullOrEmpty(_fileNameTextBox.Text); }; fileNameTextBox.TextChanged += value2; _serversTextBox.TextChanged += delegate { RdcTextBox fileNameTextBox2 = _fileNameTextBox; bool enabled = browseButton.Enabled = string.IsNullOrEmpty(_serversTextBox.Text); fileNameTextBox2.Enabled = enabled; }; base.FocusControl = _fileNameTextBox; }
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; }
public LocalResourcesTabPage(TabbedSettingsDialog dialog, LocalResourcesSettings settings) : base(dialog, settings) { int tabIndex = 0; int rowIndex = 0; CreateInheritanceControl(ref rowIndex, ref tabIndex); FormTools.AddLabeledEnumDropDown(this, "Remote &sound", base.Settings.AudioRedirectionMode, ref rowIndex, ref tabIndex, RdpClient.AudioRedirectionModeToString); if (RdpClient.SupportsAdvancedAudioVideoRedirection) { FormTools.AddLabeledEnumDropDown(this, "Sound &quality", base.Settings.AudioRedirectionQuality, ref rowIndex, ref tabIndex, RdpClient.AudioRedirectionQualityToString); FormTools.AddLabeledEnumDropDown(this, "Remote &recording", base.Settings.AudioCaptureRedirectionMode, ref rowIndex, ref tabIndex, RdpClient.AudioCaptureRedirectionModeToString); } FormTools.AddLabeledEnumDropDown(this, "&Windows key combos", base.Settings.KeyboardHookMode, ref rowIndex, ref tabIndex, RdpClient.KeyboardHookModeToString); Label value = FormTools.NewLabel("Redirect options", 0, rowIndex); TreeView treeView = new TreeView { Location = FormTools.NewLocation(1, rowIndex), Size = new Size(340, 140), CheckBoxes = true, Scrollable = true, ShowLines = false }; treeView.AfterCheck += RedirectView_AfterCheck; _redirectClipboardCheckBox = treeView.Nodes.Add("Clipboard"); _redirectPrintersCheckBox = treeView.Nodes.Add("Printers"); _redirectSmartCardsCheckBox = treeView.Nodes.Add("Smart cards"); _redirectPortsCheckBox = treeView.Nodes.Add("Ports"); _redirectDrivesCheckBox = treeView.Nodes.Add("Drives"); _redirectPnpDevicesCheckBox = treeView.Nodes.Add("PnP devices"); if (RdpClient.SupportsFineGrainedRedirection) { IMsRdpDriveCollection driveCollection = RdpClient.DriveCollection; for (uint num = 0u; num < driveCollection.DriveCount; num++) { IMsRdpDrive msRdpDrive = driveCollection.get_DriveByIndex(num); _redirectDrivesCheckBox.Nodes.Add(msRdpDrive.Name.Substring(0, msRdpDrive.Name.Length - 1)); } } base.Controls.Add(value); base.Controls.Add(treeView); }
private void AddButton(int colIndex, int rowIndex, char key, string text, Operation operation, ServerBase server) { Button button = new Button(); button.Location = FormTools.NewLocation(colIndex, rowIndex); button.FlatStyle = FlatStyle.Flat; button.Text = $"{key} - {text}"; button.Tag = new SelectedObject { Key = key, Operation = operation, Server = server }; Button button2 = button; button2.Width = 140; button2.Click += Button_Click; button2.KeyDown += Button_KeyDown; base.Controls.Add(button2); }
protected void AddListView(ref int rowIndex, ref int tabIndex) { ListView = new RdcListView { CheckBoxes = true, FullRowSelect = true, Location = FormTools.NewLocation(0, rowIndex++), MultiSelect = false, Size = new Size(500, 300), TabIndex = tabIndex++, View = View.Details }; ListView.KeyDown += List_KeyDownHandler; ListView.MouseDoubleClick += List_MouseDoubleClick; ListView.ItemChecked += ListView_ItemChecked; ListView.Columns.AddRange(new ColumnHeader[3] { new ColumnHeader { Text = string.Empty, Width = 22 }, new ColumnHeader { Text = "Server", Width = 130 }, new ColumnHeader { Text = "Group", Width = 349 } }); base.Controls.Add(ListView); if (RdcListView.SupportsHeaderCheckBoxes) { ListView.SetColumnHeaderToCheckBox(0); ListView.HeaderCheckBoxClick += ListView_HeaderCheckBoxClick; } }
protected int CreateProfileManagementTabPage() { int result = 0; TabPage tabPage = FormTools.NewTabPage("配置管理"); Label label = FormTools.NewLabel("配置", 0, result++); _credentialsListBox = new ListBox { Location = FormTools.NewLocation(0, result++), Size = new Size(340, 200) }; _credentialsListBox.KeyDown += CredentialsListBox_KeyDown; _credentialsListBox.DoubleClick += EditButton_Click; _credentialsListBox.VisibleChanged += CredentialsListBox_VisibleChanged; Button button = new Button(); button.Text = "添加"; button.Location = new Point(_credentialsListBox.Right + 20, _credentialsListBox.Top); Button button2 = button; button2.Click += AddButton_Click; Button button3 = new Button(); button3.Text = "编辑"; button3.Location = new Point(_credentialsListBox.Right + 20, button2.Bottom + 4); Button button4 = button3; button4.Click += EditButton_Click; Button button5 = new Button(); button5.Text = "删除"; button5.Location = new Point(_credentialsListBox.Right + 20, button4.Bottom + 4); Button button6 = button5; button6.Click += DeleteButton_Click; tabPage.Controls.Add(label, _credentialsListBox, button2, button4, button6); tabPage.ResumeLayout(); AddTabPage(tabPage); return(result); }
public ServerPropertiesTabPage(TabbedSettingsDialog dialog, ServerSettings settings) : base(dialog, settings, "Server Settings") { int tabIndex = 0; int rowIndex = 0; _serverNameTextBox = FormTools.AddLabeledTextBox(this, "&Server name:", base.Settings.ServerName, ref rowIndex, ref tabIndex); _serverNameTextBox.Enabled = true; _serverNameTextBox.TextChanged += ServerNameChanged; _serverNameTextBox.Validate = ValidateServerName; _vmConsoleConnectCheckBox = FormTools.NewCheckBox("&VM console connect", 0, rowIndex, tabIndex++, 140); _vmConsoleConnectCheckBox.CheckedChanged += VMConsoleConnectCheckBox_CheckedChanged; _vmIdLabel = new Label { Location = FormTools.NewLocation(1, rowIndex++), Size = new Size(30, 20), Text = "&id:", TextAlign = ContentAlignment.MiddleLeft, Visible = false }; _vmIdTextBox = new RdcTextBox { Location = new Point(_vmIdLabel.Right, _vmIdLabel.Top), Setting = base.Settings.VirtualMachineId, Size = new Size(340 - _vmIdLabel.Width, 20), TabIndex = tabIndex++, Visible = false }; _displayNameTextBox = FormTools.AddLabeledTextBox(this, "&Display name:", base.Settings.DisplayName, ref rowIndex, ref tabIndex); _displayNameTextBox.Enabled = true; _displayNameTextBox.TextChanged += DisplayNameChanged; _displayNameTextBox.Validate = ValidateDisplayName; _displayNameUserCreated = !base.Settings.ServerName.Value.Equals(base.Settings.DisplayName.Value); AddParentCombo(ref rowIndex, ref tabIndex); AddComment(ref rowIndex, ref tabIndex).Setting = base.Settings.Comment; base.Controls.Add(_vmConsoleConnectCheckBox, _vmIdLabel, _vmIdTextBox); base.FocusControl = _serverNameTextBox; }
public ConnectionSettingsTabPage(TabbedSettingsDialog dialog, ConnectionSettings settings) : base(dialog, settings) { int tabIndex = 0; int rowIndex = 0; CreateInheritanceControl(ref rowIndex, ref tabIndex); FormTools.AddCheckBox(this, "连接到控制台", settings.ConnectToConsole, 1, ref rowIndex, ref tabIndex); FormTools.AddLabeledTextBox(this, "启动程序:", settings.StartProgram, ref rowIndex, ref tabIndex); FormTools.AddLabeledTextBox(this, "工作目录:", settings.WorkingDir, ref rowIndex, ref tabIndex); Label label = FormTools.NewLabel("端口:", 0, rowIndex); _portUpDown = new NumericUpDown(); ((ISupportInitialize)_portUpDown).BeginInit(); _portUpDown.Location = FormTools.NewLocation(1, rowIndex++); _portUpDown.Size = new Size(160, 20); _portUpDown.Minimum = 1m; _portUpDown.Maximum = 65535m; NumericUpDown portUpDown = _portUpDown; KeyEventHandler value = delegate { UpdatePortDefaultLabel(); }; portUpDown.KeyUp += value; _portUpDown.ValueChanged += delegate { UpdatePortDefaultLabel(); }; _portUpDown.TabIndex = tabIndex++; ((ISupportInitialize)_portUpDown).EndInit(); _portDefaultLabel = new Label(); _portDefaultLabel.Location = new Point(_portUpDown.Location.X + _portUpDown.Width, _portUpDown.Location.Y - 1); _portDefaultLabel.Size = new Size(140, 20); _portDefaultLabel.TextAlign = ContentAlignment.MiddleLeft; FormTools.AddLabeledTextBox(this, "加载负载平衡配置:", settings.LoadBalanceInfo, ref rowIndex, ref tabIndex); base.Controls.Add(label, _portUpDown, _portDefaultLabel); }
public void Create(Control parent, ref int rowIndex, ref int tabIndex) { _disabledLabel = new Label { Enabled = true, Location = new Point(0, (parent.Height - 20) / 2), Size = new Size(parent.Width, 20), TextAlign = ContentAlignment.MiddleCenter, Visible = false }; FromParentCheck = FormTools.NewCheckBox("In&herit from parent", 1, rowIndex++, tabIndex++); FromParentCheck.CheckedChanged += CheckChangedHandler; _sourceButton = new Button { Location = FormTools.NewLocation(1, rowIndex++) }; _sourceButton.Size = new Size(340, _sourceButton.Height); _sourceButton.Click += SourceButton_Click; _sourceButton.TextChanged += SourceButton_TextChanged; parent.Controls.Add(_disabledLabel); parent.Controls.Add(FromParentCheck); parent.Controls.Add(_sourceButton); }