コード例 #1
0
ファイル: FontDialog.cs プロジェクト: KonajuGames/SharpLang
		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 ();
		}
コード例 #2
0
        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();
        }