internal FileDialog () { form = new DialogForm (this); vfs = new MWFVFS (); Size formConfigSize = Size.Empty; Point formConfigLocation = Point.Empty; object formWidth = MWFConfig.GetValue (filedialog_string, width_string); object formHeight = MWFConfig.GetValue (filedialog_string, height_string); if (formHeight != null && formWidth != null) formConfigSize = new Size ((int)formWidth, (int)formHeight); object formLocationX = MWFConfig.GetValue (filedialog_string, x_string); object formLocationY = MWFConfig.GetValue (filedialog_string, y_string); if (formLocationX != null && formLocationY != null) formConfigLocation = new Point ((int)formLocationX, (int)formLocationY); configFileNames = (string[])MWFConfig.GetValue (filedialog_string, filenames_string); fileTypeComboBox = new ComboBox (); backToolBarButton = new ToolBarButton (); newdirToolBarButton = new ToolBarButton (); searchSaveLabel = new Label (); mwfFileView = new MWFFileView (vfs); fileNameLabel = new Label (); fileNameComboBox = new ComboBox (); dirComboBox = new DirComboBox (vfs); smallButtonToolBar = new ToolBar (); menueToolBarButton = new ToolBarButton (); fileTypeLabel = new Label (); openSaveButton = new Button (); helpButton = new Button (); popupButtonPanel = new PopupButtonPanel (); upToolBarButton = new ToolBarButton (); cancelButton = new Button (); form.CancelButton = cancelButton; imageListTopToolbar = new ImageList (); menueToolBarButtonContextMenu = new ContextMenu (); readonlyCheckBox = new CheckBox (); form.SuspendLayout (); //imageListTopToolbar imageListTopToolbar.ColorDepth = ColorDepth.Depth32Bit; imageListTopToolbar.ImageSize = new Size (16, 16); // 16, 16 imageListTopToolbar.Images.Add (ResourceImageLoader.Get ("go-previous.png")); imageListTopToolbar.Images.Add (ResourceImageLoader.Get ("go-top.png")); imageListTopToolbar.Images.Add (ResourceImageLoader.Get ("folder-new.png")); imageListTopToolbar.Images.Add (ResourceImageLoader.Get ("preferences-system-windows.png")); imageListTopToolbar.TransparentColor = Color.Transparent; // searchLabel searchSaveLabel.FlatStyle = FlatStyle.System; searchSaveLabel.Location = new Point (6, 6); searchSaveLabel.Size = new Size (86, 22); searchSaveLabel.TextAlign = ContentAlignment.MiddleRight; // dirComboBox dirComboBox.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); dirComboBox.DropDownStyle = ComboBoxStyle.DropDownList; dirComboBox.Location = new Point (99, 6); dirComboBox.Size = new Size (261, 22); dirComboBox.TabIndex = 7; // smallButtonToolBar smallButtonToolBar.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right))); smallButtonToolBar.Appearance = ToolBarAppearance.Flat; smallButtonToolBar.AutoSize = false; smallButtonToolBar.Buttons.AddRange (new ToolBarButton [] { backToolBarButton, upToolBarButton, newdirToolBarButton, menueToolBarButton}); smallButtonToolBar.ButtonSize = new Size (24, 24); // 21, 16 smallButtonToolBar.Divider = false; smallButtonToolBar.Dock = DockStyle.None; smallButtonToolBar.DropDownArrows = true; smallButtonToolBar.ImageList = imageListTopToolbar; smallButtonToolBar.Location = new Point (372, 6); smallButtonToolBar.ShowToolTips = true; smallButtonToolBar.Size = new Size (140, 28); smallButtonToolBar.TabIndex = 8; smallButtonToolBar.TextAlign = ToolBarTextAlign.Right; // buttonPanel popupButtonPanel.Dock = DockStyle.None; popupButtonPanel.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left)))); popupButtonPanel.Location = new Point (6, 35); popupButtonPanel.Size = new Size (87, 338); popupButtonPanel.TabIndex = 9; // mwfFileView mwfFileView.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); mwfFileView.Location = new Point (99, 35); mwfFileView.Size = new Size (450, 283); mwfFileView.MultiSelect = false; mwfFileView.TabIndex = 10; mwfFileView.RegisterSender (dirComboBox); mwfFileView.RegisterSender (popupButtonPanel); // fileNameLabel fileNameLabel.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); fileNameLabel.FlatStyle = FlatStyle.System; fileNameLabel.Location = new Point (101, 326); fileNameLabel.Size = new Size (70, 21); fileNameLabel.Text = "File name:"; fileNameLabel.TextAlign = ContentAlignment.MiddleLeft; // fileNameComboBox fileNameComboBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); fileNameComboBox.Location = new Point (195, 326); fileNameComboBox.Size = new Size (246, 22); fileNameComboBox.TabIndex = 1; fileNameComboBox.MaxDropDownItems = MaxFileNameItems; fileNameComboBox.RestoreContextMenu (); UpdateRecentFiles (); // fileTypeLabel fileTypeLabel.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); fileTypeLabel.FlatStyle = FlatStyle.System; fileTypeLabel.Location = new Point (101, 355); fileTypeLabel.Size = new Size (90, 21); fileTypeLabel.Text = "Files of type:"; fileTypeLabel.TextAlign = ContentAlignment.MiddleLeft; // fileTypeComboBox fileTypeComboBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); fileTypeComboBox.DropDownStyle = ComboBoxStyle.DropDownList; fileTypeComboBox.Location = new Point (195, 355); fileTypeComboBox.Size = new Size (246, 22); fileTypeComboBox.TabIndex = 2; // backToolBarButton backToolBarButton.ImageIndex = 0; backToolBarButton.Enabled = false; backToolBarButton.Style = ToolBarButtonStyle.PushButton; mwfFileView.AddControlToEnableDisableByDirStack (backToolBarButton); // upToolBarButton upToolBarButton.ImageIndex = 1; upToolBarButton.Style = ToolBarButtonStyle.PushButton; mwfFileView.SetFolderUpToolBarButton (upToolBarButton); // newdirToolBarButton newdirToolBarButton.ImageIndex = 2; newdirToolBarButton.Style = ToolBarButtonStyle.PushButton; // menueToolBarButton menueToolBarButton.ImageIndex = 3; menueToolBarButton.DropDownMenu = menueToolBarButtonContextMenu; menueToolBarButton.Style = ToolBarButtonStyle.DropDownButton; // menueToolBarButtonContextMenu menueToolBarButtonContextMenu.MenuItems.AddRange (mwfFileView.ViewMenuItems); // openSaveButton openSaveButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); openSaveButton.FlatStyle = FlatStyle.System; openSaveButton.Location = new Point (474, 326); openSaveButton.Size = new Size (75, 23); openSaveButton.TabIndex = 4; openSaveButton.FlatStyle = FlatStyle.System; // cancelButton cancelButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); cancelButton.FlatStyle = FlatStyle.System; cancelButton.Location = new Point (474, 353); cancelButton.Size = new Size (75, 23); cancelButton.TabIndex = 5; cancelButton.Text = "Cancel"; cancelButton.FlatStyle = FlatStyle.System; // helpButton helpButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); helpButton.FlatStyle = FlatStyle.System; helpButton.Location = new Point (474, 353); helpButton.Size = new Size (75, 23); helpButton.TabIndex = 6; helpButton.Text = "Help"; helpButton.FlatStyle = FlatStyle.System; helpButton.Visible = false; // checkBox readonlyCheckBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right))); readonlyCheckBox.Text = "Open Readonly"; readonlyCheckBox.Location = new Point (195, 350); readonlyCheckBox.Size = new Size (245, 21); readonlyCheckBox.TabIndex = 3; readonlyCheckBox.FlatStyle = FlatStyle.System; readonlyCheckBox.Visible = false; form.SizeGripStyle = SizeGripStyle.Show; form.AcceptButton = openSaveButton; form.MaximizeBox = true; form.MinimizeBox = true; form.FormBorderStyle = FormBorderStyle.Sizable; form.ClientSize = new Size (555, 385); form.MinimumSize = form.Size; form.Controls.Add (smallButtonToolBar); form.Controls.Add (cancelButton); form.Controls.Add (openSaveButton); form.Controls.Add (mwfFileView); form.Controls.Add (fileTypeLabel); form.Controls.Add (fileNameLabel); form.Controls.Add (fileTypeComboBox); form.Controls.Add (fileNameComboBox); form.Controls.Add (dirComboBox); form.Controls.Add (searchSaveLabel); form.Controls.Add (popupButtonPanel); form.Controls.Add (helpButton); form.Controls.Add (readonlyCheckBox); form.ResumeLayout (true); if (formConfigSize != Size.Empty) { form.ClientSize = formConfigSize; } if (formConfigLocation != Point.Empty) { form.Location = formConfigLocation; } openSaveButton.Click += new EventHandler (OnClickOpenSaveButton); cancelButton.Click += new EventHandler (OnClickCancelButton); helpButton.Click += new EventHandler (OnClickHelpButton); smallButtonToolBar.ButtonClick += new ToolBarButtonClickEventHandler (OnClickSmallButtonToolBar); fileTypeComboBox.SelectedIndexChanged += new EventHandler (OnSelectedIndexChangedFileTypeComboBox); mwfFileView.SelectedFileChanged += new EventHandler (OnSelectedFileChangedFileView); mwfFileView.ForceDialogEnd += new EventHandler (OnForceDialogEndFileView); mwfFileView.SelectedFilesChanged += new EventHandler (OnSelectedFilesChangedFileView); mwfFileView.ColumnClick += new ColumnClickEventHandler(OnColumnClickFileView); dirComboBox.DirectoryChanged += new EventHandler (OnDirectoryChangedDirComboBox); popupButtonPanel.DirectoryChanged += new EventHandler (OnDirectoryChangedPopupButtonPanel); readonlyCheckBox.CheckedChanged += new EventHandler (OnCheckCheckChanged); #if NET_2_0 form.FormClosed += new FormClosedEventHandler (OnFileDialogFormClosed); custom_places = new FileDialogCustomPlacesCollection (); #else form.Closed += new EventHandler (OnFileDialogFormClosed); #endif }
public FontDialog( ) { form = new DialogForm (this); example_panel_text = char_sets [0]; okButton = new Button( ); cancelButton = new Button( ); applyButton = new Button( ); helpButton = new Button( ); fontTextBox = new TextBox( ); fontstyleTextBox = new TextBox( ); fontsizeTextBox = new TextBox( ); fontListBox = new MouseWheelListBox (); fontsizeListBox = new MouseWheelListBox (); fontstyleListBox = new MouseWheelListBox (); fontLabel = new Label( ); fontstyleLabel = new Label( ); sizeLabel = new Label( ); scriptLabel = new Label( ); exampleGroupBox = new GroupBox( ); effectsGroupBox = new GroupBox( ); underlinedCheckBox = new CheckBox( ); strikethroughCheckBox = new CheckBox( ); scriptComboBox = new ComboBox( ); examplePanel = new Panel( ); colorComboBox = new ColorComboBox( this ); exampleGroupBox.SuspendLayout( ); effectsGroupBox.SuspendLayout( ); form.SuspendLayout( ); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.MaximizeBox = false; // fontsizeListBox fontsizeListBox.Location = new Point( 284, 47 ); fontsizeListBox.Size = new Size( 52, 95 ); fontsizeListBox.TabIndex = 10; fontListBox.Sorted = true; // fontTextBox fontTextBox.Location = new Point( 16, 26 ); fontTextBox.Size = new Size( 140, 21 ); fontTextBox.TabIndex = 5; fontTextBox.Text = ""; // fontstyleLabel fontstyleLabel.Location = new Point( 164, 10 ); fontstyleLabel.Size = new Size( 100, 16 ); fontstyleLabel.TabIndex = 1; fontstyleLabel.Text = "Font Style:"; // typesizeTextBox fontsizeTextBox.Location = new Point( 284, 26 ); fontsizeTextBox.Size = new Size( 52, 21 ); fontsizeTextBox.TabIndex = 7; fontsizeTextBox.Text = ""; fontsizeTextBox.MaxLength = 2; // schriftartListBox fontListBox.Location = new Point( 16, 47 ); fontListBox.Size = new Size( 140, 95 ); fontListBox.TabIndex = 8; fontListBox.Sorted = true; // exampleGroupBox exampleGroupBox.Controls.Add( examplePanel ); exampleGroupBox.FlatStyle = FlatStyle.System; exampleGroupBox.Location = new Point( 164, 158 ); exampleGroupBox.Size = new Size( 172, 70 ); exampleGroupBox.TabIndex = 12; exampleGroupBox.TabStop = false; exampleGroupBox.Text = "Example"; // fontstyleListBox fontstyleListBox.Location = new Point( 164, 47 ); fontstyleListBox.Size = new Size( 112, 95 ); fontstyleListBox.TabIndex = 9; // schriftartLabel fontLabel.Location = new Point( 16, 10 ); fontLabel.Size = new Size( 88, 16 ); fontLabel.TabIndex = 0; fontLabel.Text = "Font:"; // effectsGroupBox effectsGroupBox.Controls.Add( underlinedCheckBox ); effectsGroupBox.Controls.Add( strikethroughCheckBox ); effectsGroupBox.Controls.Add( colorComboBox ); effectsGroupBox.FlatStyle = FlatStyle.System; effectsGroupBox.Location = new Point( 16, 158 ); effectsGroupBox.Size = new Size( 140, 116 ); effectsGroupBox.TabIndex = 11; effectsGroupBox.TabStop = false; effectsGroupBox.Text = "Effects"; // strikethroughCheckBox strikethroughCheckBox.FlatStyle = FlatStyle.System; strikethroughCheckBox.Location = new Point( 8, 16 ); strikethroughCheckBox.TabIndex = 0; strikethroughCheckBox.Text = "Strikethrough"; // colorComboBox colorComboBox.Location = new Point( 8, 70 ); colorComboBox.Size = new Size( 130, 21 ); // sizeLabel sizeLabel.Location = new Point( 284, 10 ); sizeLabel.Size = new Size( 100, 16 ); sizeLabel.TabIndex = 2; sizeLabel.Text = "Size:"; // scriptComboBox scriptComboBox.Location = new Point( 164, 253 ); scriptComboBox.Size = new Size( 172, 21 ); scriptComboBox.TabIndex = 14; scriptComboBox.DropDownStyle = ComboBoxStyle.DropDownList; // okButton okButton.FlatStyle = FlatStyle.System; okButton.Location = new Point( 352, 26 ); okButton.Size = new Size( 70, 23 ); okButton.TabIndex = 3; okButton.Text = "OK"; // cancelButton cancelButton.FlatStyle = FlatStyle.System; cancelButton.Location = new Point( 352, 52 ); cancelButton.Size = new Size( 70, 23 ); cancelButton.TabIndex = 4; cancelButton.Text = "Cancel"; // applyButton applyButton.FlatStyle = FlatStyle.System; applyButton.Location = new Point( 352, 78 ); applyButton.Size = new Size( 70, 23 ); applyButton.TabIndex = 5; applyButton.Text = "Apply"; // helpButton helpButton.FlatStyle = FlatStyle.System; helpButton.Location = new Point( 352, 104 ); helpButton.Size = new Size( 70, 23 ); helpButton.TabIndex = 6; helpButton.Text = "Help"; // underlinedCheckBox underlinedCheckBox.FlatStyle = FlatStyle.System; underlinedCheckBox.Location = new Point( 8, 36 ); underlinedCheckBox.TabIndex = 1; underlinedCheckBox.Text = "Underlined"; // fontstyleTextBox fontstyleTextBox.Location = new Point( 164, 26 ); fontstyleTextBox.Size = new Size( 112, 21 ); fontstyleTextBox.TabIndex = 6; fontstyleTextBox.Text = ""; // scriptLabel scriptLabel.Location = new Point( 164, 236 ); scriptLabel.Size = new Size( 100, 16 ); scriptLabel.TabIndex = 13; scriptLabel.Text = "Script:"; // examplePanel examplePanel.Location = new Point( 8, 20 ); examplePanel.TabIndex = 0; examplePanel.Size = new Size( 156, 40 ); examplePanel.BorderStyle = BorderStyle.Fixed3D; form.AcceptButton = okButton; form.CancelButton = cancelButton; form.Controls.Add( scriptComboBox ); form.Controls.Add( scriptLabel ); form.Controls.Add( exampleGroupBox ); form.Controls.Add( effectsGroupBox ); form.Controls.Add( fontsizeListBox ); form.Controls.Add( fontstyleListBox ); form.Controls.Add( fontListBox ); form.Controls.Add( fontsizeTextBox ); form.Controls.Add( fontstyleTextBox ); form.Controls.Add( fontTextBox ); form.Controls.Add( cancelButton ); form.Controls.Add( okButton ); form.Controls.Add( sizeLabel ); form.Controls.Add( fontstyleLabel ); form.Controls.Add( fontLabel ); form.Controls.Add( applyButton ); form.Controls.Add( helpButton ); exampleGroupBox.ResumeLayout( false ); effectsGroupBox.ResumeLayout( false ); form.Size = new Size( 430, 318 ); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.MaximizeBox = false; form.Text = "Font"; form.ResumeLayout( false ); scriptComboBox.BeginUpdate (); scriptComboBox.Items.AddRange (char_sets_names); scriptComboBox.SelectedIndex = 0; scriptComboBox.EndUpdate (); applyButton.Hide( ); helpButton.Hide( ); colorComboBox.Hide( ); cancelButton.Click += new EventHandler( OnClickCancelButton ); okButton.Click += new EventHandler( OnClickOkButton ); applyButton.Click += new EventHandler (OnApplyButton); examplePanel.Paint += new PaintEventHandler( OnPaintExamplePanel ); fontListBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedFontListBox ); fontsizeListBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedSizeListBox ); fontstyleListBox.SelectedIndexChanged += new EventHandler( OnSelectedIndexChangedFontStyleListBox ); underlinedCheckBox.CheckedChanged += new EventHandler( OnCheckedChangedUnderlinedCheckBox ); strikethroughCheckBox.CheckedChanged += new EventHandler( OnCheckedChangedStrikethroughCheckBox ); scriptComboBox.SelectedIndexChanged += new EventHandler (OnSelectedIndexChangedScriptComboBox); fontTextBox.KeyPress += new KeyPressEventHandler (OnFontTextBoxKeyPress); fontstyleTextBox.KeyPress += new KeyPressEventHandler (OnFontStyleTextBoxKeyPress); fontsizeTextBox.KeyPress += new KeyPressEventHandler (OnFontSizeTextBoxKeyPress); fontTextBox.TextChanged += new EventHandler (OnFontTextBoxTextChanged); fontstyleTextBox.TextChanged += new EventHandler (OnFontStyleTextTextChanged); fontsizeTextBox.TextChanged += new EventHandler (OnFontSizeTextBoxTextChanged); fontTextBox.KeyDown += new KeyEventHandler (OnFontTextBoxKeyDown); fontstyleTextBox.KeyDown += new KeyEventHandler (OnFontStyleTextBoxKeyDown); fontsizeTextBox.KeyDown += new KeyEventHandler (OnFontSizeTextBoxKeyDown); fontTextBox.MouseWheel += new MouseEventHandler (OnFontTextBoxMouseWheel); fontstyleTextBox.MouseWheel += new MouseEventHandler (OnFontStyleTextBoxMouseWheel); fontsizeTextBox.MouseWheel += new MouseEventHandler (OnFontSizeTextBoxMouseWheel); PopulateFontList (); }
public FolderBrowserDialog() { form = new DialogForm(this); Size formConfigSize = Size.Empty; Point formConfigLocation = Point.Empty; object formWidth = MWFConfig.GetValue(folderbrowserdialog_string, width_string); object formHeight = MWFConfig.GetValue(folderbrowserdialog_string, height_string); if (formHeight != null && formWidth != null) { formConfigSize = new Size((int)formWidth, (int)formHeight); } object formLocationX = MWFConfig.GetValue(folderbrowserdialog_string, x_string); object formLocationY = MWFConfig.GetValue(folderbrowserdialog_string, y_string); if (formLocationX != null && formLocationY != null) { formConfigLocation = new Point((int)formLocationX, (int)formLocationY); } newFolderButton = new Button(); folderBrowserTreeView = new FolderBrowserTreeView(this); okButton = new Button(); cancelButton = new Button(); descriptionLabel = new Label(); folderBrowserTreeViewContextMenu = new ContextMenu(); form.AcceptButton = okButton; form.CancelButton = cancelButton; form.SuspendLayout(); form.ClientSize = new Size(322, 324); form.MinimumSize = new Size(310, 254); form.Text = "Browse For Folder"; form.SizeGripStyle = SizeGripStyle.Show; newFolderMenuItem = new MenuItem("New Folder", new EventHandler(OnClickNewFolderButton)); folderBrowserTreeViewContextMenu.MenuItems.Add(newFolderMenuItem); // descriptionLabel descriptionLabel.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); descriptionLabel.Location = new Point(15, 14); descriptionLabel.Size = new Size(292, 40); descriptionLabel.TabIndex = 0; descriptionLabel.Text = string.Empty; // folderBrowserTreeView folderBrowserTreeView.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); folderBrowserTreeView.ImageIndex = -1; folderBrowserTreeView.Location = new Point(15, 60); folderBrowserTreeView.SelectedImageIndex = -1; folderBrowserTreeView.Size = new Size(292, 212); folderBrowserTreeView.TabIndex = 3; folderBrowserTreeView.ShowLines = false; folderBrowserTreeView.ShowPlusMinus = true; folderBrowserTreeView.HotTracking = true; folderBrowserTreeView.BorderStyle = BorderStyle.Fixed3D; folderBrowserTreeView.ContextMenu = folderBrowserTreeViewContextMenu; //folderBrowserTreeView.Indent = 2; // newFolderButton newFolderButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); newFolderButton.FlatStyle = FlatStyle.System; newFolderButton.Location = new Point(15, 285); newFolderButton.Size = new Size(105, 23); newFolderButton.TabIndex = 4; newFolderButton.Text = "Make New Folder"; newFolderButton.Enabled = true; // okButton okButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); okButton.FlatStyle = FlatStyle.System; okButton.Location = new Point(135, 285); okButton.Size = new Size(80, 23); okButton.TabIndex = 1; okButton.Text = "OK"; // cancelButton cancelButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); cancelButton.DialogResult = DialogResult.Cancel; cancelButton.FlatStyle = FlatStyle.System; cancelButton.Location = new Point(227, 285); cancelButton.Size = new Size(80, 23); cancelButton.TabIndex = 2; cancelButton.Text = "Cancel"; form.Controls.Add(cancelButton); form.Controls.Add(okButton); form.Controls.Add(newFolderButton); form.Controls.Add(folderBrowserTreeView); form.Controls.Add(descriptionLabel); form.ResumeLayout(false); if (formConfigSize != Size.Empty) { form.Size = formConfigSize; } if (formConfigLocation != Point.Empty) { form.Location = formConfigLocation; } okButton.Click += new EventHandler(OnClickOKButton); cancelButton.Click += new EventHandler(OnClickCancelButton); newFolderButton.Click += new EventHandler(OnClickNewFolderButton); form.VisibleChanged += new EventHandler(OnFormVisibleChanged); RootFolder = rootFolder; }
public ColorDialog () : base() { form = new DialogForm (this); form.SuspendLayout (); form.Text = "Color"; form.FormBorderStyle = FormBorderStyle.FixedDialog; form.MaximizeBox = false; satTextBox = new TextBox (); briTextBox = new TextBox (); blueTextBox = new TextBox (); greenTextBox = new TextBox (); redTextBox = new TextBox (); hueTextBox = new TextBox (); redLabel = new Label (); blueLabel = new Label (); greenLabel = new Label (); colorBaseLabel = new Label (); hueLabel = new Label (); satLabel = new Label (); briLabel = new Label (); okButton = new Button (); cancelButton = new Button (); form.CancelButton = cancelButton; helpButton = new Button (); defineColoursButton = new Button (); addColoursButton = new Button (); baseColorControl = new BaseColorControl (this); colorMatrixControl = new ColorMatrixControl (this); brightnessControl = new BrightnessControl (this); triangleControl = new TriangleControl (this); selectedColorPanel = new Panel (); // hueTextBox hueTextBox.Location = new Point (324, 203); hueTextBox.Size = new Size (27, 21); hueTextBox.TabIndex = 11; hueTextBox.MaxLength = 3; // satTextBox satTextBox.Location = new Point (324, 225); satTextBox.Size = new Size (27, 21); satTextBox.TabIndex = 15; satTextBox.MaxLength = 3; // greenTextBox greenTextBox.Location = new Point (404, 225); greenTextBox.Size = new Size (27, 21); greenTextBox.TabIndex = 18; greenTextBox.MaxLength = 3; // briTextBox briTextBox.Location = new Point (324, 247); briTextBox.Size = new Size (27, 21); briTextBox.TabIndex = 16; briTextBox.MaxLength = 3; // blueTextBox blueTextBox.Location = new Point (404, 247); blueTextBox.Size = new Size (27, 21); blueTextBox.TabIndex = 19; blueTextBox.MaxLength = 3; // redTextBox redTextBox.Location = new Point (404, 203); redTextBox.Size = new Size (27, 21); redTextBox.TabIndex = 17; redTextBox.MaxLength = 3; // redLabel redLabel.FlatStyle = FlatStyle.System; redLabel.Location = new Point (361, 206); redLabel.Size = new Size (40, 16); redLabel.TabIndex = 25; redLabel.Text = Locale.GetText ("Red") + ":"; redLabel.TextAlign = ContentAlignment.MiddleRight; // blueLabel blueLabel.FlatStyle = FlatStyle.System; blueLabel.Location = new Point (361, 250); blueLabel.Size = new Size (40, 16); blueLabel.TabIndex = 26; blueLabel.Text = Locale.GetText ("Blue") + ":"; blueLabel.TextAlign = ContentAlignment.MiddleRight; // greenLabel greenLabel.FlatStyle = FlatStyle.System; greenLabel.Location = new Point (361, 228); greenLabel.Size = new Size (40, 16); greenLabel.TabIndex = 27; greenLabel.Text = Locale.GetText ("Green") + ":"; greenLabel.TextAlign = ContentAlignment.MiddleRight; // colorBaseLabel colorBaseLabel.Location = new Point (228, 247); colorBaseLabel.Size = new Size (60, 25); colorBaseLabel.TabIndex = 28; colorBaseLabel.Text = Locale.GetText ("Color"); colorBaseLabel.TextAlign = ContentAlignment.MiddleCenter; // hueLabel hueLabel.FlatStyle = FlatStyle.System; hueLabel.Location = new Point (287, 206); hueLabel.Size = new Size (36, 16); hueLabel.TabIndex = 23; hueLabel.Text = Locale.GetText ("Hue") + ":"; hueLabel.TextAlign = ContentAlignment.MiddleRight; // satLabel satLabel.FlatStyle = FlatStyle.System; satLabel.Location = new Point (287, 228); satLabel.Size = new Size (36, 16); satLabel.TabIndex = 22; satLabel.Text = Locale.GetText ("Sat") + ":"; satLabel.TextAlign = ContentAlignment.MiddleRight; // briLabel briLabel.FlatStyle = FlatStyle.System; briLabel.Location = new Point (287, 250); briLabel.Size = new Size (36, 16); briLabel.TabIndex = 24; briLabel.Text = Locale.GetText ("Bri") + ":"; briLabel.TextAlign = ContentAlignment.MiddleRight; // defineColoursButton defineColoursButton.FlatStyle = FlatStyle.System; defineColoursButton.Location = new Point (5, 244); defineColoursButton.Size = new Size (210, 22); defineColoursButton.TabIndex = 6; // FIXME: update resource files defineColoursButton.Text = "Define Custom Colors >>"; //defineColoursButton.Text = Locale.GetText ("Define Custom Colors >>"); // okButton okButton.FlatStyle = FlatStyle.System; okButton.Location = new Point (5, 271); okButton.Size = new Size (66, 22); okButton.TabIndex = 0; okButton.Text = Locale.GetText ("OK"); // cancelButton cancelButton.FlatStyle = FlatStyle.System; cancelButton.Location = new Point (78, 271); cancelButton.Size = new Size (66, 22); cancelButton.TabIndex = 1; cancelButton.Text = Locale.GetText ("Cancel"); // helpButton helpButton.FlatStyle = FlatStyle.System; helpButton.Location = new Point (149, 271); helpButton.Size = new Size (66, 22); helpButton.TabIndex = 5; helpButton.Text = Locale.GetText ("Help"); helpButton.Hide (); // addColoursButton addColoursButton.FlatStyle = FlatStyle.System; addColoursButton.Location = new Point (227, 271); addColoursButton.Size = new Size (213, 22); addColoursButton.TabIndex = 7; // FIXME: update resource files addColoursButton.Text = "Add To Custom Colors"; //addColoursButton.Text = Locale.GetText ("Add To Custom Colors"); // baseColorControl baseColorControl.Location = new Point (3, 6); baseColorControl.Size = new Size (212, 231); baseColorControl.TabIndex = 13; // colorMatrixControl colorMatrixControl.Location = new Point (227, 7); colorMatrixControl.Size = new Size (179, 190); colorMatrixControl.TabIndex = 14; // triangleControl triangleControl.Location = new Point (432, 0); triangleControl.Size = new Size (16, 204); triangleControl.TabIndex = 12; // brightnessControl brightnessControl.Location = new Point (415, 7); brightnessControl.Size = new Size (14, 190); brightnessControl.TabIndex = 20; // selectedColorPanel selectedColorPanel.BackColor = SystemColors.Desktop; selectedColorPanel.BorderStyle = BorderStyle.Fixed3D; selectedColorPanel.Location = new Point (227, 202); selectedColorPanel.Size = new Size (60, 42); selectedColorPanel.TabIndex = 10; form.Controls.Add (hueTextBox); form.Controls.Add (satTextBox); form.Controls.Add (briTextBox); form.Controls.Add (redTextBox); form.Controls.Add (greenTextBox); form.Controls.Add (blueTextBox); form.Controls.Add (defineColoursButton); form.Controls.Add (okButton); form.Controls.Add (cancelButton); form.Controls.Add (addColoursButton); form.Controls.Add (helpButton); form.Controls.Add (baseColorControl); form.Controls.Add (colorMatrixControl); form.Controls.Add (brightnessControl); form.Controls.Add (triangleControl); form.Controls.Add (colorBaseLabel); form.Controls.Add (greenLabel); form.Controls.Add (blueLabel); form.Controls.Add (redLabel); form.Controls.Add (briLabel); form.Controls.Add (hueLabel); form.Controls.Add (satLabel); form.Controls.Add (selectedColorPanel); form.ResumeLayout (false); Color = Color.Black; defineColoursButton.Click += new EventHandler (OnClickButtonDefineColours); addColoursButton.Click += new EventHandler (OnClickButtonAddColours); helpButton.Click += new EventHandler (OnClickHelpButton); cancelButton.Click += new EventHandler (OnClickCancelButton); okButton.Click += new EventHandler (OnClickOkButton); hueTextBox.KeyPress += new KeyPressEventHandler (OnKeyPressTextBoxes); satTextBox.KeyPress += new KeyPressEventHandler (OnKeyPressTextBoxes); briTextBox.KeyPress += new KeyPressEventHandler (OnKeyPressTextBoxes); redTextBox.KeyPress += new KeyPressEventHandler (OnKeyPressTextBoxes); greenTextBox.KeyPress += new KeyPressEventHandler (OnKeyPressTextBoxes); blueTextBox.KeyPress += new KeyPressEventHandler (OnKeyPressTextBoxes); hueTextBox.TextChanged += new EventHandler (OnTextChangedTextBoxes); satTextBox.TextChanged += new EventHandler (OnTextChangedTextBoxes); briTextBox.TextChanged += new EventHandler (OnTextChangedTextBoxes); redTextBox.TextChanged += new EventHandler (OnTextChangedTextBoxes); greenTextBox.TextChanged += new EventHandler (OnTextChangedTextBoxes); blueTextBox.TextChanged += new EventHandler (OnTextChangedTextBoxes); hueTextBox.GotFocus += new EventHandler (OnGotFocusTextBoxes); satTextBox.GotFocus += new EventHandler (OnGotFocusTextBoxes); briTextBox.GotFocus += new EventHandler (OnGotFocusTextBoxes); redTextBox.GotFocus += new EventHandler (OnGotFocusTextBoxes); greenTextBox.GotFocus += new EventHandler (OnGotFocusTextBoxes); blueTextBox.GotFocus += new EventHandler (OnGotFocusTextBoxes); hueTextBox.LostFocus += new EventHandler (OnLostFocusTextBoxes); satTextBox.LostFocus += new EventHandler (OnLostFocusTextBoxes); briTextBox.LostFocus += new EventHandler (OnLostFocusTextBoxes); redTextBox.LostFocus += new EventHandler (OnLostFocusTextBoxes); greenTextBox.LostFocus += new EventHandler (OnLostFocusTextBoxes); blueTextBox.LostFocus += new EventHandler (OnLostFocusTextBoxes); ResetCustomColors (); }
public FontDialog( ) { form = new DialogForm(this); example_panel_text = char_sets [0]; okButton = new Button( ); cancelButton = new Button( ); applyButton = new Button( ); helpButton = new Button( ); fontTextBox = new TextBox( ); fontstyleTextBox = new TextBox( ); fontsizeTextBox = new TextBox( ); fontListBox = new MouseWheelListBox(); fontsizeListBox = new MouseWheelListBox(); fontstyleListBox = new MouseWheelListBox(); fontLabel = new Label( ); fontstyleLabel = new Label( ); sizeLabel = new Label( ); scriptLabel = new Label( ); exampleGroupBox = new GroupBox( ); effectsGroupBox = new GroupBox( ); underlinedCheckBox = new CheckBox( ); strikethroughCheckBox = new CheckBox( ); scriptComboBox = new ComboBox( ); examplePanel = new Panel( ); colorComboBox = new ColorComboBox(this); exampleGroupBox.SuspendLayout( ); effectsGroupBox.SuspendLayout( ); form.SuspendLayout( ); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.MaximizeBox = false; // fontsizeListBox fontsizeListBox.Location = new Point(284, 47); fontsizeListBox.Size = new Size(52, 95); fontsizeListBox.TabIndex = 10; fontListBox.Sorted = true; // fontTextBox fontTextBox.Location = new Point(16, 26); fontTextBox.Size = new Size(140, 21); fontTextBox.TabIndex = 5; fontTextBox.Text = ""; // fontstyleLabel fontstyleLabel.Location = new Point(164, 10); fontstyleLabel.Size = new Size(100, 16); fontstyleLabel.TabIndex = 1; fontstyleLabel.Text = "Font Style:"; // typesizeTextBox fontsizeTextBox.Location = new Point(284, 26); fontsizeTextBox.Size = new Size(52, 21); fontsizeTextBox.TabIndex = 7; fontsizeTextBox.Text = ""; fontsizeTextBox.MaxLength = 2; // schriftartListBox fontListBox.Location = new Point(16, 47); fontListBox.Size = new Size(140, 95); fontListBox.TabIndex = 8; fontListBox.Sorted = true; // exampleGroupBox exampleGroupBox.Controls.Add(examplePanel); exampleGroupBox.FlatStyle = FlatStyle.System; exampleGroupBox.Location = new Point(164, 158); exampleGroupBox.Size = new Size(172, 70); exampleGroupBox.TabIndex = 12; exampleGroupBox.TabStop = false; exampleGroupBox.Text = "Example"; // fontstyleListBox fontstyleListBox.Location = new Point(164, 47); fontstyleListBox.Size = new Size(112, 95); fontstyleListBox.TabIndex = 9; // schriftartLabel fontLabel.Location = new Point(16, 10); fontLabel.Size = new Size(88, 16); fontLabel.TabIndex = 0; fontLabel.Text = "Font:"; // effectsGroupBox effectsGroupBox.Controls.Add(underlinedCheckBox); effectsGroupBox.Controls.Add(strikethroughCheckBox); effectsGroupBox.Controls.Add(colorComboBox); effectsGroupBox.FlatStyle = FlatStyle.System; effectsGroupBox.Location = new Point(16, 158); effectsGroupBox.Size = new Size(140, 116); effectsGroupBox.TabIndex = 11; effectsGroupBox.TabStop = false; effectsGroupBox.Text = "Effects"; // strikethroughCheckBox strikethroughCheckBox.FlatStyle = FlatStyle.System; strikethroughCheckBox.Location = new Point(8, 16); strikethroughCheckBox.TabIndex = 0; strikethroughCheckBox.Text = "Strikethrough"; // colorComboBox colorComboBox.Location = new Point(8, 70); colorComboBox.Size = new Size(130, 21); // sizeLabel sizeLabel.Location = new Point(284, 10); sizeLabel.Size = new Size(100, 16); sizeLabel.TabIndex = 2; sizeLabel.Text = "Size:"; // scriptComboBox scriptComboBox.Location = new Point(164, 253); scriptComboBox.Size = new Size(172, 21); scriptComboBox.TabIndex = 14; scriptComboBox.DropDownStyle = ComboBoxStyle.DropDownList; // okButton okButton.FlatStyle = FlatStyle.System; okButton.Location = new Point(352, 26); okButton.Size = new Size(70, 23); okButton.TabIndex = 3; okButton.Text = "OK"; // cancelButton cancelButton.FlatStyle = FlatStyle.System; cancelButton.Location = new Point(352, 52); cancelButton.Size = new Size(70, 23); cancelButton.TabIndex = 4; cancelButton.Text = "Cancel"; // applyButton applyButton.FlatStyle = FlatStyle.System; applyButton.Location = new Point(352, 78); applyButton.Size = new Size(70, 23); applyButton.TabIndex = 5; applyButton.Text = "Apply"; // helpButton helpButton.FlatStyle = FlatStyle.System; helpButton.Location = new Point(352, 104); helpButton.Size = new Size(70, 23); helpButton.TabIndex = 6; helpButton.Text = "Help"; // underlinedCheckBox underlinedCheckBox.FlatStyle = FlatStyle.System; underlinedCheckBox.Location = new Point(8, 36); underlinedCheckBox.TabIndex = 1; underlinedCheckBox.Text = "Underlined"; // fontstyleTextBox fontstyleTextBox.Location = new Point(164, 26); fontstyleTextBox.Size = new Size(112, 21); fontstyleTextBox.TabIndex = 6; fontstyleTextBox.Text = ""; // scriptLabel scriptLabel.Location = new Point(164, 236); scriptLabel.Size = new Size(100, 16); scriptLabel.TabIndex = 13; scriptLabel.Text = "Script:"; // examplePanel examplePanel.Location = new Point(8, 20); examplePanel.TabIndex = 0; examplePanel.Size = new Size(156, 40); examplePanel.BorderStyle = BorderStyle.Fixed3D; form.AcceptButton = okButton; form.CancelButton = cancelButton; form.Controls.Add(scriptComboBox); form.Controls.Add(scriptLabel); form.Controls.Add(exampleGroupBox); form.Controls.Add(effectsGroupBox); form.Controls.Add(fontsizeListBox); form.Controls.Add(fontstyleListBox); form.Controls.Add(fontListBox); form.Controls.Add(fontsizeTextBox); form.Controls.Add(fontstyleTextBox); form.Controls.Add(fontTextBox); form.Controls.Add(cancelButton); form.Controls.Add(okButton); form.Controls.Add(sizeLabel); form.Controls.Add(fontstyleLabel); form.Controls.Add(fontLabel); form.Controls.Add(applyButton); form.Controls.Add(helpButton); exampleGroupBox.ResumeLayout(false); effectsGroupBox.ResumeLayout(false); form.Size = new Size(430, 318); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.MaximizeBox = false; form.Text = "Font"; form.ResumeLayout(false); scriptComboBox.BeginUpdate(); scriptComboBox.Items.AddRange(char_sets_names); scriptComboBox.SelectedIndex = 0; scriptComboBox.EndUpdate(); applyButton.Hide( ); helpButton.Hide( ); colorComboBox.Hide( ); cancelButton.Click += new EventHandler(OnClickCancelButton); okButton.Click += new EventHandler(OnClickOkButton); applyButton.Click += new EventHandler(OnApplyButton); examplePanel.Paint += new PaintEventHandler(OnPaintExamplePanel); fontListBox.SelectedIndexChanged += new EventHandler(OnSelectedIndexChangedFontListBox); fontsizeListBox.SelectedIndexChanged += new EventHandler(OnSelectedIndexChangedSizeListBox); fontstyleListBox.SelectedIndexChanged += new EventHandler(OnSelectedIndexChangedFontStyleListBox); underlinedCheckBox.CheckedChanged += new EventHandler(OnCheckedChangedUnderlinedCheckBox); strikethroughCheckBox.CheckedChanged += new EventHandler(OnCheckedChangedStrikethroughCheckBox); scriptComboBox.SelectedIndexChanged += new EventHandler(OnSelectedIndexChangedScriptComboBox); fontTextBox.KeyPress += new KeyPressEventHandler(OnFontTextBoxKeyPress); fontstyleTextBox.KeyPress += new KeyPressEventHandler(OnFontStyleTextBoxKeyPress); fontsizeTextBox.KeyPress += new KeyPressEventHandler(OnFontSizeTextBoxKeyPress); fontTextBox.TextChanged += new EventHandler(OnFontTextBoxTextChanged); fontstyleTextBox.TextChanged += new EventHandler(OnFontStyleTextTextChanged); fontsizeTextBox.TextChanged += new EventHandler(OnFontSizeTextBoxTextChanged); fontTextBox.KeyDown += new KeyEventHandler(OnFontTextBoxKeyDown); fontstyleTextBox.KeyDown += new KeyEventHandler(OnFontStyleTextBoxKeyDown); fontsizeTextBox.KeyDown += new KeyEventHandler(OnFontSizeTextBoxKeyDown); fontTextBox.MouseWheel += new MouseEventHandler(OnFontTextBoxMouseWheel); fontstyleTextBox.MouseWheel += new MouseEventHandler(OnFontStyleTextBoxMouseWheel); fontsizeTextBox.MouseWheel += new MouseEventHandler(OnFontSizeTextBoxMouseWheel); PopulateFontList(); }
public FolderBrowserDialog () { form = new DialogForm (this); Size formConfigSize = Size.Empty; Point formConfigLocation = Point.Empty; object formWidth = MWFConfig.GetValue (folderbrowserdialog_string, width_string); object formHeight = MWFConfig.GetValue (folderbrowserdialog_string, height_string); if (formHeight != null && formWidth != null) formConfigSize = new Size ((int)formWidth, (int)formHeight); object formLocationX = MWFConfig.GetValue (folderbrowserdialog_string, x_string); object formLocationY = MWFConfig.GetValue (folderbrowserdialog_string, y_string); if (formLocationX != null && formLocationY != null) formConfigLocation = new Point ((int)formLocationX, (int)formLocationY); newFolderButton = new Button (); folderBrowserTreeView = new FolderBrowserTreeView (this); okButton = new Button (); cancelButton = new Button (); descriptionLabel = new Label (); folderBrowserTreeViewContextMenu = new ContextMenu (); form.AcceptButton = okButton; form.CancelButton = cancelButton; form.SuspendLayout (); form.ClientSize = new Size (322, 324); form.MinimumSize = new Size (310, 254); form.Text = "Browse For Folder"; form.SizeGripStyle = SizeGripStyle.Show; newFolderMenuItem = new MenuItem("New Folder", new EventHandler (OnClickNewFolderButton)); folderBrowserTreeViewContextMenu.MenuItems.Add(newFolderMenuItem); // descriptionLabel descriptionLabel.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); descriptionLabel.Location = new Point (15, 14); descriptionLabel.Size = new Size (292, 40); descriptionLabel.TabIndex = 0; descriptionLabel.Text = string.Empty; // folderBrowserTreeView folderBrowserTreeView.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); folderBrowserTreeView.ImageIndex = -1; folderBrowserTreeView.Location = new Point (15, 60); folderBrowserTreeView.SelectedImageIndex = -1; folderBrowserTreeView.Size = new Size (292, 212); folderBrowserTreeView.TabIndex = 3; folderBrowserTreeView.ShowLines = false; folderBrowserTreeView.ShowPlusMinus = true; folderBrowserTreeView.HotTracking = true; folderBrowserTreeView.BorderStyle = BorderStyle.Fixed3D; folderBrowserTreeView.ContextMenu = folderBrowserTreeViewContextMenu; //folderBrowserTreeView.Indent = 2; // newFolderButton newFolderButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); newFolderButton.FlatStyle = FlatStyle.System; newFolderButton.Location = new Point (15, 285); newFolderButton.Size = new Size (105, 23); newFolderButton.TabIndex = 4; newFolderButton.Text = "Make New Folder"; newFolderButton.Enabled = true; // okButton okButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); okButton.FlatStyle = FlatStyle.System; okButton.Location = new Point (135, 285); okButton.Size = new Size (80, 23); okButton.TabIndex = 1; okButton.Text = "OK"; // cancelButton cancelButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); cancelButton.DialogResult = DialogResult.Cancel; cancelButton.FlatStyle = FlatStyle.System; cancelButton.Location = new Point (227, 285); cancelButton.Size = new Size (80, 23); cancelButton.TabIndex = 2; cancelButton.Text = "Cancel"; form.Controls.Add (cancelButton); form.Controls.Add (okButton); form.Controls.Add (newFolderButton); form.Controls.Add (folderBrowserTreeView); form.Controls.Add (descriptionLabel); form.ResumeLayout (false); if (formConfigSize != Size.Empty) { form.Size = formConfigSize; } if (formConfigLocation != Point.Empty) { form.Location = formConfigLocation; } okButton.Click += new EventHandler (OnClickOKButton); cancelButton.Click += new EventHandler (OnClickCancelButton); newFolderButton.Click += new EventHandler (OnClickNewFolderButton); form.VisibleChanged += new EventHandler (OnFormVisibleChanged); RootFolder = rootFolder; }