private void InitializeColors(Button button) { ColorComboBox box = _buttonComboBoxMapping[button]; string propertyName = _buttonSettingsPropertyMapping[button]; Type settingsType = typeof(VisualizerSettings); PropertyInfo cloneProperty = settingsType.GetProperty(propertyName); Color currentValue = (Color)cloneProperty.GetMethod.Invoke(VisualizerSettings.Clone, null); InitializeColorComboBox(box, currentValue); }
private void InitializeColorComboBox(ColorComboBox box, Color currentValue) { box.Items.Clear(); box.Items.Add(currentValue); foreach (Color color in _knownColors) { box.Items.Add(color); } box.SelectedIndex = 0; }
public ColorPicker() { InitializeComponent(); Init(); SetContextData(); this.source = new ColorComboBox(); this.DataContext = this.source; #region Event this.colorComboBox.DropDownClosed += OnDropDownClosed; this.colorComboBox.Loaded += OnColorComboBoxLoaded; #endregion }
private void radioButton3_CheckedChanged(object sender, EventArgs e) { label4.Show(); numericUpDown2.Show(); radioButton1.Show(); radioButton2.Show(); checkBox1.Text = "Application kit"; label1.Text = "Color"; label2.Text = "Amount used (sheet)"; numericUpDown1.Value = VINYL_DEFAULT_QUANTITY; numericUpDown1.Increment = VINYL_INCREMENT; StickerNameCombo.Hide(); ColorComboBox.Show(); isVinylOrder = true; }
private void radioButton4_CheckedChanged(object sender, EventArgs e) { StickerNameCombo.Show(); label4.Hide(); numericUpDown2.Hide(); radioButton1.Hide(); radioButton2.Hide(); checkBox1.Text = "Sticker Kit"; label1.Text = "Name"; ColorComboBox.Hide(); label2.Text = "Quantity"; numericUpDown1.Value = STICKER_DEFAULT_QUANTITY; numericUpDown1.Increment = STICKER_INCREMENT; isVinylOrder = false; }
private static void comboBox_ColorSelected(object sender, EventArgs e) { ColorComboBox comboBox = sender as ColorComboBox; string propertyName = comboBox.Tag.ToString(); if (comboBox.Color == Color.Transparent) { editedSeries.DeleteCustomProperty(propertyName); } else { editedSeries[propertyName] = new ColorConverter().ConvertToString(null, CultureInfo.InvariantCulture, comboBox.Color); } if (changeEventHandler != null) { changeEventHandler(sender, e); } }
private static void AddColorComboBox(string propertyName) { ColorComboBox comboBox = new ColorComboBox(); comboBox.Parent = controlParent; comboBox.Location = new Point(128, top); comboBox.Size = new Size(172, 20); comboBox.Tag = propertyName; comboBox.ShowColorName = true; string editedValue = editedSeries[propertyName]; if (!String.IsNullOrEmpty(editedValue)) { comboBox.Color = (Color)Converter.FromString(typeof(Color), editedValue); } comboBox.ColorSelected += new EventHandler(comboBox_ColorSelected); top += 28; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ColorComboWithTransparency)); this.transparencySlider = new System.Windows.Forms.TrackBar(); this.percentageLabel = new System.Windows.Forms.Label(); this.colorCombo = new Maestro.Editors.Common.ColorComboBox(); ((System.ComponentModel.ISupportInitialize)(this.transparencySlider)).BeginInit(); this.SuspendLayout(); // // transparencySlider // resources.ApplyResources(this.transparencySlider, "transparencySlider"); this.transparencySlider.Maximum = 255; this.transparencySlider.Name = "transparencySlider"; this.transparencySlider.TickStyle = System.Windows.Forms.TickStyle.None; this.transparencySlider.ValueChanged += new System.EventHandler(this.transparencySlider_ValueChanged); // // percentageLabel // resources.ApplyResources(this.percentageLabel, "percentageLabel"); this.percentageLabel.Name = "percentageLabel"; // // colorCombo // resources.ApplyResources(this.colorCombo, "colorCombo"); this.colorCombo.FormattingEnabled = true; this.colorCombo.Name = "colorCombo"; this.colorCombo.SelectedIndexChanged += new System.EventHandler(this.colorCombo_SelectedIndexChanged); // // ColorComboWithTransparency // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.Controls.Add(this.percentageLabel); this.Controls.Add(this.transparencySlider); this.Controls.Add(this.colorCombo); this.Name = "ColorComboWithTransparency"; resources.ApplyResources(this, "$this"); ((System.ComponentModel.ISupportInitialize)(this.transparencySlider)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void ComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (_isInitializing) { return; } ColorComboBox box = sender as ColorComboBox; KeyValuePair <Button, ColorComboBox> mapping = _buttonComboBoxMapping.FirstOrDefault(b => b.Value == box); if (mapping.Value == box) { Button button = mapping.Key; string propertyName = _buttonSettingsPropertyMapping[button]; Type settingsType = typeof(VisualizerSettings); PropertyInfo cloneProperty = settingsType.GetProperty(propertyName); Color newColor = (Color)box.SelectedItem; cloneProperty.SetMethod.Invoke(VisualizerSettings.Clone, new object[1] { newColor }); } }
private void Form1_Load(object sender, EventArgs e) { // \\\\\\\\\\\\\\\\\\\\\\\ CB = new ColorComboBox(); CB.Location = new Point(10, 80); CB.SelectedIndex = 34; CB.Parent = groupBox1; CenterX = pictureBox1.Size.Width / 2; CenterY = pictureBox1.Size.Height / 2; p = new Pen(Color.Black); rnd = new Random(); for (int i = 0; i < 4; i++) { point[i] = new Point(0, 0); } comboBox1.Items.AddRange(combBox_name); comboBox1.SelectedIndex = 0; // \\\\\\\\\\\\\\\\\\\\\\\ g = Graphics.FromHwnd(pictureBox1.Handle); p2 = new Pen(Color.Black); size = (int)numericUpDown1.Value; szshare2 = size / ((int)numericUpDown3.Value); CenterX = pictureBox1.Size.Width / 2; CenterY = pictureBox1.Size.Height / 2; x0 = CenterX - size / 2; y0 = CenterY - size / 2; // \\\\\\\\\\\\\\\\\\\\\\\ numNew3 = 0; numNew4 = 0; numNew5 = 0; p3 = new Pen(Color.Black); }
private void CustomButton_Click(object sender, EventArgs e) { Button button = sender as Button; if (_buttonComboBoxMapping.ContainsKey(button) == false) { return; } ColorComboBox box = _buttonComboBoxMapping[button]; if (box.Items.Count > 0) { using (ColorDialog dialog = new ColorDialog()) { dialog.AnyColor = true; dialog.FullOpen = true; dialog.Color = (Color)box.Items[0]; if (dialog.ShowDialog() == DialogResult.OK) { box.Items[0] = dialog.Color; } } } }
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 (); }
/// <include file='doc\BordersPage.uex' path='docs/doc[@for="BordersPage.InitForm"]/*' /> /// <devdoc> /// Creates the UI of the page. /// </devdoc> private void InitForm() { GroupLabel cellMarginGroup = new GroupLabel(); Label cellPaddingLabel = new Label(); this.cellPaddingEdit = new NumberEdit(); Label cellSpacingLabel = new Label(); this.cellSpacingEdit = new NumberEdit(); GroupLabel borderLinesGroup = new GroupLabel(); Label gridLinesLabel = new Label(); this.gridLinesCombo = new ComboBox(); Label colorLabel = new Label(); this.borderColorCombo = new ColorComboBox(); this.borderColorPickerButton = new Button(); Label borderWidthLabel = new Label(); this.borderWidthUnit = new UnitControl(); cellMarginGroup.SetBounds(4, 4, 300, 16); cellMarginGroup.Text = SR.GetString(SR.BDLBor_CellMarginsGroup); cellMarginGroup.TabStop = false; cellMarginGroup.TabIndex = 0; cellPaddingLabel.Text = SR.GetString(SR.BDLBor_CellPadding); cellPaddingLabel.SetBounds(12, 24, 120, 14); cellPaddingLabel.TabStop = false; cellPaddingLabel.TabIndex = 1; cellPaddingEdit.SetBounds(12, 40, 70, 20); cellPaddingEdit.AllowDecimal = false; cellPaddingEdit.AllowNegative = false; cellPaddingEdit.TabIndex = 2; cellPaddingEdit.TextChanged += new EventHandler(this.OnBordersChanged); cellSpacingLabel.Text = SR.GetString(SR.BDLBor_CellSpacing); cellSpacingLabel.SetBounds(160, 24, 120, 14); cellSpacingLabel.TabStop = false; cellSpacingLabel.TabIndex = 3; cellSpacingEdit.SetBounds(160, 40, 70, 20); cellSpacingEdit.AllowDecimal = false; cellSpacingEdit.AllowNegative = false; cellSpacingEdit.TabIndex = 4; cellSpacingEdit.TextChanged += new EventHandler(this.OnBordersChanged); borderLinesGroup.SetBounds(4, 70, 300, 16); borderLinesGroup.Text = SR.GetString(SR.BDLBor_BorderLinesGroup); borderLinesGroup.TabStop = false; borderLinesGroup.TabIndex = 5; gridLinesLabel.Text = SR.GetString(SR.BDLBor_GridLines); gridLinesLabel.SetBounds(12, 90, 150, 14); gridLinesLabel.TabStop = false; gridLinesLabel.TabIndex = 6; gridLinesCombo.SetBounds(12, 106, 140, 21); gridLinesCombo.DropDownStyle = ComboBoxStyle.DropDownList; gridLinesCombo.Items.Clear(); gridLinesCombo.Items.AddRange(new object[] { SR.GetString(SR.BDLBor_GL_Horz), SR.GetString(SR.BDLBor_GL_Vert), SR.GetString(SR.BDLBor_GL_Both), SR.GetString(SR.BDLBor_GL_None) }); gridLinesCombo.TabIndex = 7; gridLinesCombo.SelectedIndexChanged += new EventHandler(this.OnBordersChanged); colorLabel.Text = SR.GetString(SR.BDLBor_BorderColor); colorLabel.SetBounds(12, 134, 150, 14); colorLabel.TabStop = false; colorLabel.TabIndex = 8; borderColorCombo.SetBounds(12, 150, 140, 21); borderColorCombo.TabIndex = 9; borderColorCombo.TextChanged += new EventHandler(this.OnBordersChanged); borderColorCombo.SelectedIndexChanged += new EventHandler(this.OnBordersChanged); borderColorPickerButton.SetBounds(156, 149, 24, 22); borderColorPickerButton.Text = "..."; borderColorPickerButton.TabIndex = 10; borderColorPickerButton.FlatStyle = FlatStyle.System; borderColorPickerButton.Click += new EventHandler(this.OnClickColorPicker); borderWidthLabel.Text = SR.GetString(SR.BDLBor_BorderWidth); borderWidthLabel.SetBounds(12, 178, 150, 14); borderWidthLabel.TabStop = false; borderWidthLabel.TabIndex = 11; borderWidthUnit.SetBounds(12, 194, 102, 22); borderWidthUnit.AllowNegativeValues = false; borderWidthUnit.AllowPercentValues = false; borderWidthUnit.DefaultUnit = UnitControl.UNIT_PX; borderWidthUnit.TabIndex = 12; borderWidthUnit.Changed += new EventHandler(OnBordersChanged); this.Text = SR.GetString(SR.BDLBor_Text); this.Size = new Size(308, 156); this.CommitOnDeactivate = true; this.Icon = new Icon(this.GetType(), "BordersPage.ico"); this.Controls.Clear(); this.Controls.AddRange(new Control[] { borderWidthUnit, borderWidthLabel, borderColorPickerButton, borderColorCombo, colorLabel, gridLinesCombo, gridLinesLabel, borderLinesGroup, cellSpacingEdit, cellSpacingLabel, cellPaddingEdit, cellPaddingLabel, cellMarginGroup }); }
private void Busqueda_SelectedIndexChanged(object sender, EventArgs e) //maneja las opciones de muestra segun la seleccion para el patron { OpcionesPanel.Visible = true; if (busqueda.SelectedItem.ToString() == "Sentence:" || busqueda.SelectedItem.ToString() == "Name:" || busqueda.SelectedItem.ToString() == "Surname:" || busqueda.SelectedItem.ToString() == "Address:" || busqueda.SelectedItem.ToString() == "Photographer:" || busqueda.SelectedItem.ToString() == "Photomotive:") { OpcionesPanel.Controls.Clear(); SentenceBox.Text = "Sentence"; SentenceBox.Visible = true; UnionComboBox.Visible = true; AddButton.Visible = true; OpcionesPanel.Controls.Add(SentenceBox); } else if (busqueda.SelectedItem.ToString() == "GeographicLocation:") { OpcionesPanel.Controls.Clear(); Longitud.ResetText(); Latitud.ResetText(); Longitud.Visible = true; Latitud.Visible = true; UnionComboBox.Visible = true; AddButton.Visible = true; OpcionesPanel.Controls.Add(Longitud); OpcionesPanel.Controls.Add(Latitud); } else if (busqueda.SelectedItem.ToString() == "Selfie:") { OpcionesPanel.Controls.Clear(); YesNo.ResetText(); YesNo.Visible = true; UnionComboBox.Visible = true; AddButton.Visible = true; OpcionesPanel.Controls.Add(YesNo); } else if (busqueda.SelectedItem.ToString() == "Nationality:") { OpcionesPanel.Controls.Clear(); NationalityComboBox.ResetText(); NationalityComboBox.Visible = true; UnionComboBox.Visible = true; AddButton.Visible = true; OpcionesPanel.Controls.Add(NationalityComboBox); } else if (busqueda.SelectedItem.ToString() == "HairColor:" || busqueda.SelectedItem.ToString() == "EyesColor:") { OpcionesPanel.Controls.Clear(); ColorComboBox.ResetText(); ColorComboBox.Visible = true; UnionComboBox.Visible = true; AddButton.Visible = true; OpcionesPanel.Controls.Add(ColorComboBox); } else if (busqueda.SelectedItem.ToString() == "Sex:") { OpcionesPanel.Controls.Clear(); SexComboBox.ResetText(); SexComboBox.Visible = true; UnionComboBox.Visible = true; AddButton.Visible = true; OpcionesPanel.Controls.Add(SexComboBox); } else if (busqueda.SelectedItem.ToString() == "Birthdate:") { OpcionesPanel.Controls.Clear(); BirthDate.ResetText(); BirthDate.Visible = true; UnionComboBox.Visible = true; AddButton.Visible = true; OpcionesPanel.Controls.Add(BirthDate); } else if (busqueda.SelectedItem.ToString() == "Filter:") { OpcionesPanel.Controls.Clear(); FiltroComboBox.ResetText(); UnionComboBox.Visible = true; AddButton.Visible = true; FiltroComboBox.Visible = true; OpcionesPanel.Controls.Add(FiltroComboBox); } else if (busqueda.SelectedItem.ToString() == "Calification:") { OpcionesPanel.Controls.Clear(); CalificationUp.ResetText(); CalificationUp.Visible = true; AddButton.Visible = true; UnionComboBox.Visible = true; OpcionesPanel.Controls.Add(CalificationUp); } OpcionesPanel.Controls.Add(UnionComboBox); OpcionesPanel.Controls.Add(AddButton); }
private static Func <Color> Bind(ColorComboBox cbx) { return(() => cbx.SelectedColor); }
private void InitForm() { System.Windows.Forms.Label label = new System.Windows.Forms.Label(); this.formatTree = new System.Windows.Forms.TreeView(); this.stylePanel = new System.Windows.Forms.Panel(); GroupLabel label2 = new GroupLabel(); System.Windows.Forms.Label label3 = new System.Windows.Forms.Label(); this.foreColorCombo = new ColorComboBox(); this.foreColorPickerButton = new System.Windows.Forms.Button(); System.Windows.Forms.Label label4 = new System.Windows.Forms.Label(); this.backColorCombo = new ColorComboBox(); this.backColorPickerButton = new System.Windows.Forms.Button(); System.Windows.Forms.Label label5 = new System.Windows.Forms.Label(); this.fontNameCombo = new ComboBox(); System.Windows.Forms.Label label6 = new System.Windows.Forms.Label(); this.fontSizeCombo = new UnsettableComboBox(); this.fontSizeUnit = new UnitControl(); this.boldCheck = new System.Windows.Forms.CheckBox(); this.italicCheck = new System.Windows.Forms.CheckBox(); this.underlineCheck = new System.Windows.Forms.CheckBox(); this.strikeOutCheck = new System.Windows.Forms.CheckBox(); this.overlineCheck = new System.Windows.Forms.CheckBox(); GroupLabel label7 = new GroupLabel(); System.Windows.Forms.Label label8 = new System.Windows.Forms.Label(); this.horzAlignCombo = new UnsettableComboBox(); this.vertAlignLabel = new System.Windows.Forms.Label(); this.vertAlignCombo = new UnsettableComboBox(); this.allowWrappingCheck = new System.Windows.Forms.CheckBox(); GroupLabel label9 = null; System.Windows.Forms.Label label10 = null; if (base.IsDataGridMode) { this.columnPanel = new System.Windows.Forms.Panel(); label9 = new GroupLabel(); label10 = new System.Windows.Forms.Label(); this.widthUnit = new UnitControl(); } label.SetBounds(4, 4, 0x6f, 14); label.Text = System.Design.SR.GetString("BDLFmt_Objects"); label.TabStop = false; label.TabIndex = 2; this.formatTree.SetBounds(4, 20, 0xa2, 350); this.formatTree.HideSelection = false; this.formatTree.TabIndex = 3; this.formatTree.AfterSelect += new TreeViewEventHandler(this.OnSelChangedFormatObject); this.stylePanel.SetBounds(0xb1, 4, 230, 370); this.stylePanel.TabIndex = 6; this.stylePanel.Visible = false; label2.SetBounds(0, 2, 0xe0, 14); label2.Text = System.Design.SR.GetString("BDLFmt_AppearanceGroup"); label2.TabStop = false; label2.TabIndex = 1; label3.SetBounds(8, 0x13, 160, 14); label3.Text = System.Design.SR.GetString("BDLFmt_ForeColor"); label3.TabStop = false; label3.TabIndex = 2; this.foreColorCombo.SetBounds(8, 0x25, 0x66, 0x16); this.foreColorCombo.TabIndex = 3; this.foreColorCombo.TextChanged += new EventHandler(this.OnFormatChanged); this.foreColorCombo.SelectedIndexChanged += new EventHandler(this.OnFormatChanged); this.foreColorPickerButton.SetBounds(0x72, 0x24, 0x18, 0x16); this.foreColorPickerButton.TabIndex = 4; this.foreColorPickerButton.Text = "..."; this.foreColorPickerButton.FlatStyle = FlatStyle.System; this.foreColorPickerButton.Click += new EventHandler(this.OnClickForeColorPicker); this.foreColorPickerButton.AccessibleName = System.Design.SR.GetString("BDLFmt_ChooseColorButton"); this.foreColorPickerButton.AccessibleDescription = System.Design.SR.GetString("BDLFmt_ChooseForeColorDesc"); label4.SetBounds(8, 0x3e, 160, 14); label4.Text = System.Design.SR.GetString("BDLFmt_BackColor"); label4.TabStop = false; label4.TabIndex = 5; this.backColorCombo.SetBounds(8, 0x4e, 0x66, 0x16); this.backColorCombo.TabIndex = 6; this.backColorCombo.TextChanged += new EventHandler(this.OnFormatChanged); this.backColorCombo.SelectedIndexChanged += new EventHandler(this.OnFormatChanged); this.backColorPickerButton.SetBounds(0x72, 0x4d, 0x18, 0x16); this.backColorPickerButton.TabIndex = 7; this.backColorPickerButton.Text = "..."; this.backColorPickerButton.FlatStyle = FlatStyle.System; this.backColorPickerButton.Click += new EventHandler(this.OnClickBackColorPicker); this.backColorPickerButton.AccessibleName = System.Design.SR.GetString("BDLFmt_ChooseColorButton"); this.backColorPickerButton.AccessibleDescription = System.Design.SR.GetString("BDLFmt_ChooseBackColorDesc"); label5.SetBounds(8, 0x68, 160, 14); label5.Text = System.Design.SR.GetString("BDLFmt_FontName"); label5.TabStop = false; label5.TabIndex = 8; this.fontNameCombo.SetBounds(8, 120, 200, 0x16); this.fontNameCombo.Sorted = true; this.fontNameCombo.TabIndex = 9; this.fontNameCombo.SelectedIndexChanged += new EventHandler(this.OnFontNameChanged); this.fontNameCombo.TextChanged += new EventHandler(this.OnFontNameChanged); label6.SetBounds(8, 0x92, 160, 14); label6.Text = System.Design.SR.GetString("BDLFmt_FontSize"); label6.TabStop = false; label6.TabIndex = 10; this.fontSizeCombo.SetBounds(8, 0xa2, 100, 0x16); this.fontSizeCombo.TabIndex = 11; this.fontSizeCombo.MaxDropDownItems = 11; this.fontSizeCombo.DropDownStyle = ComboBoxStyle.DropDownList; this.fontSizeCombo.Items.AddRange(new object[] { System.Design.SR.GetString("BDLFmt_FS_Smaller"), System.Design.SR.GetString("BDLFmt_FS_Larger"), System.Design.SR.GetString("BDLFmt_FS_XXSmall"), System.Design.SR.GetString("BDLFmt_FS_XSmall"), System.Design.SR.GetString("BDLFmt_FS_Small"), System.Design.SR.GetString("BDLFmt_FS_Medium"), System.Design.SR.GetString("BDLFmt_FS_Large"), System.Design.SR.GetString("BDLFmt_FS_XLarge"), System.Design.SR.GetString("BDLFmt_FS_XXLarge"), System.Design.SR.GetString("BDLFmt_FS_Custom") }); this.fontSizeCombo.SelectedIndexChanged += new EventHandler(this.OnFontSizeChanged); this.fontSizeUnit.SetBounds(0x70, 0xa2, 0x60, 0x16); this.fontSizeUnit.AllowNegativeValues = false; this.fontSizeUnit.TabIndex = 12; this.fontSizeUnit.Changed += new EventHandler(this.OnFormatChanged); this.fontSizeUnit.ValueAccessibleDescription = System.Design.SR.GetString("BDLFmt_FontSizeValueDesc"); this.fontSizeUnit.ValueAccessibleName = System.Design.SR.GetString("BDLFmt_FontSizeValueName"); this.fontSizeUnit.UnitAccessibleDescription = System.Design.SR.GetString("BDLFmt_FontSizeUnitDesc"); this.fontSizeUnit.UnitAccessibleName = System.Design.SR.GetString("BDLFmt_FontSizeUnitName"); this.boldCheck.SetBounds(8, 0xba, 0x6a, 20); this.boldCheck.Text = System.Design.SR.GetString("BDLFmt_FontBold"); this.boldCheck.TabIndex = 13; this.boldCheck.TextAlign = ContentAlignment.MiddleLeft; this.boldCheck.FlatStyle = FlatStyle.System; this.boldCheck.CheckedChanged += new EventHandler(this.OnFormatChanged); this.italicCheck.SetBounds(8, 0xcc, 0x6a, 20); this.italicCheck.Text = System.Design.SR.GetString("BDLFmt_FontItalic"); this.italicCheck.TabIndex = 14; this.italicCheck.TextAlign = ContentAlignment.MiddleLeft; this.italicCheck.FlatStyle = FlatStyle.System; this.italicCheck.CheckedChanged += new EventHandler(this.OnFormatChanged); this.underlineCheck.SetBounds(8, 0xde, 0x6a, 20); this.underlineCheck.Text = System.Design.SR.GetString("BDLFmt_FontUnderline"); this.underlineCheck.TabIndex = 15; this.underlineCheck.TextAlign = ContentAlignment.MiddleLeft; this.underlineCheck.FlatStyle = FlatStyle.System; this.underlineCheck.CheckedChanged += new EventHandler(this.OnFormatChanged); this.strikeOutCheck.SetBounds(120, 0xba, 0x6a, 20); this.strikeOutCheck.Text = System.Design.SR.GetString("BDLFmt_FontStrikeout"); this.strikeOutCheck.TabIndex = 0x10; this.strikeOutCheck.TextAlign = ContentAlignment.MiddleLeft; this.strikeOutCheck.FlatStyle = FlatStyle.System; this.strikeOutCheck.CheckedChanged += new EventHandler(this.OnFormatChanged); this.overlineCheck.SetBounds(120, 0xcc, 0x6a, 20); this.overlineCheck.Text = System.Design.SR.GetString("BDLFmt_FontOverline"); this.overlineCheck.TabIndex = 0x11; this.overlineCheck.TextAlign = ContentAlignment.MiddleLeft; this.overlineCheck.FlatStyle = FlatStyle.System; this.overlineCheck.CheckedChanged += new EventHandler(this.OnFormatChanged); label7.SetBounds(0, 0xf6, 0xe0, 14); label7.Text = System.Design.SR.GetString("BDLFmt_AlignmentGroup"); label7.TabStop = false; label7.TabIndex = 0x12; label8.SetBounds(8, 0x108, 160, 14); label8.Text = System.Design.SR.GetString("BDLFmt_HorzAlign"); label8.TabStop = false; label8.TabIndex = 0x13; this.horzAlignCombo.SetBounds(8, 280, 190, 0x16); this.horzAlignCombo.DropDownStyle = ComboBoxStyle.DropDownList; this.horzAlignCombo.Items.AddRange(new object[] { System.Design.SR.GetString("BDLFmt_HA_Left"), System.Design.SR.GetString("BDLFmt_HA_Center"), System.Design.SR.GetString("BDLFmt_HA_Right"), System.Design.SR.GetString("BDLFmt_HA_Justify") }); this.horzAlignCombo.TabIndex = 20; this.horzAlignCombo.SelectedIndexChanged += new EventHandler(this.OnFormatChanged); this.vertAlignLabel.SetBounds(8, 0x132, 160, 14); this.vertAlignLabel.Text = System.Design.SR.GetString("BDLFmt_VertAlign"); this.vertAlignLabel.TabStop = false; this.vertAlignLabel.TabIndex = 0x15; this.vertAlignCombo.SetBounds(8, 0x142, 190, 0x16); this.vertAlignCombo.DropDownStyle = ComboBoxStyle.DropDownList; this.vertAlignCombo.Items.AddRange(new object[] { System.Design.SR.GetString("BDLFmt_VA_Top"), System.Design.SR.GetString("BDLFmt_VA_Middle"), System.Design.SR.GetString("BDLFmt_VA_Bottom") }); this.vertAlignCombo.TabIndex = 0x16; this.vertAlignCombo.SelectedIndexChanged += new EventHandler(this.OnFormatChanged); this.allowWrappingCheck.SetBounds(8, 0x15c, 200, 0x11); this.allowWrappingCheck.Text = System.Design.SR.GetString("BDLFmt_AllowWrapping"); this.allowWrappingCheck.TabIndex = 0x18; this.allowWrappingCheck.FlatStyle = FlatStyle.System; this.allowWrappingCheck.CheckedChanged += new EventHandler(this.OnFormatChanged); if (base.IsDataGridMode) { this.columnPanel.SetBounds(0xb1, 4, 0x117, 350); this.columnPanel.TabIndex = 7; this.columnPanel.Visible = false; label9.SetBounds(0, 0, 0x117, 14); label9.Text = System.Design.SR.GetString("BDLFmt_LayoutGroup"); label9.TabStop = false; label9.TabIndex = 0; label10.SetBounds(8, 20, 0x40, 14); label10.Text = System.Design.SR.GetString("BDLFmt_Width"); label10.TabStop = false; label10.TabIndex = 1; this.widthUnit.SetBounds(80, 0x11, 0x66, 0x16); this.widthUnit.AllowNegativeValues = false; this.widthUnit.DefaultUnit = 0; this.widthUnit.TabIndex = 2; this.widthUnit.Changed += new EventHandler(this.OnFormatChanged); this.widthUnit.ValueAccessibleName = System.Design.SR.GetString("BDLFmt_WidthValueName"); this.widthUnit.ValueAccessibleDescription = System.Design.SR.GetString("BDLFmt_WidthValueDesc"); this.widthUnit.UnitAccessibleName = System.Design.SR.GetString("BDLFmt_WidthUnitName"); this.widthUnit.UnitAccessibleDescription = System.Design.SR.GetString("BDLFmt_WidthUnitDesc"); } this.Text = System.Design.SR.GetString("BDLFmt_Text"); base.AccessibleDescription = System.Design.SR.GetString("BDLFmt_Desc"); base.Size = new Size(0x198, 370); base.CommitOnDeactivate = true; base.Icon = new Icon(base.GetType(), "FormatPage.ico"); this.stylePanel.Controls.Clear(); this.stylePanel.Controls.AddRange(new Control[] { this.allowWrappingCheck, this.vertAlignCombo, this.vertAlignLabel, this.horzAlignCombo, label8, label7, this.overlineCheck, this.strikeOutCheck, this.underlineCheck, this.italicCheck, this.boldCheck, this.fontSizeUnit, this.fontSizeCombo, label6, this.fontNameCombo, label5, this.backColorPickerButton, this.backColorCombo, label4, this.foreColorPickerButton, this.foreColorCombo, label3, label2 }); if (base.IsDataGridMode) { this.columnPanel.Controls.Clear(); this.columnPanel.Controls.AddRange(new Control[] { this.widthUnit, label10, label9 }); base.Controls.Clear(); base.Controls.AddRange(new Control[] { this.columnPanel, this.stylePanel, this.formatTree, label }); } else { base.Controls.Clear(); base.Controls.AddRange(new Control[] { this.stylePanel, this.formatTree, label }); } }
public void Init() { source = new ColorComboBox(); }
private void InitForm() { GroupLabel label = new GroupLabel(); System.Windows.Forms.Label label2 = new System.Windows.Forms.Label(); this.cellPaddingEdit = new NumberEdit(); System.Windows.Forms.Label label3 = new System.Windows.Forms.Label(); this.cellSpacingEdit = new NumberEdit(); GroupLabel label4 = new GroupLabel(); System.Windows.Forms.Label label5 = new System.Windows.Forms.Label(); this.gridLinesCombo = new ComboBox(); System.Windows.Forms.Label label6 = new System.Windows.Forms.Label(); this.borderColorCombo = new ColorComboBox(); this.borderColorPickerButton = new System.Windows.Forms.Button(); System.Windows.Forms.Label label7 = new System.Windows.Forms.Label(); this.borderWidthUnit = new UnitControl(); label.SetBounds(4, 4, 300, 0x10); label.Text = System.Design.SR.GetString("BDLBor_CellMarginsGroup"); label.TabStop = false; label.TabIndex = 0; label2.Text = System.Design.SR.GetString("BDLBor_CellPadding"); label2.SetBounds(12, 0x18, 120, 14); label2.TabStop = false; label2.TabIndex = 1; this.cellPaddingEdit.SetBounds(12, 40, 70, 20); this.cellPaddingEdit.AllowDecimal = false; this.cellPaddingEdit.AllowNegative = false; this.cellPaddingEdit.TabIndex = 2; this.cellPaddingEdit.TextChanged += new EventHandler(this.OnBordersChanged); label3.Text = System.Design.SR.GetString("BDLBor_CellSpacing"); label3.SetBounds(160, 0x18, 120, 14); label3.TabStop = false; label3.TabIndex = 3; this.cellSpacingEdit.SetBounds(160, 40, 70, 20); this.cellSpacingEdit.AllowDecimal = false; this.cellSpacingEdit.AllowNegative = false; this.cellSpacingEdit.TabIndex = 4; this.cellSpacingEdit.TextChanged += new EventHandler(this.OnBordersChanged); label4.SetBounds(4, 70, 300, 0x10); label4.Text = System.Design.SR.GetString("BDLBor_BorderLinesGroup"); label4.TabStop = false; label4.TabIndex = 5; label5.Text = System.Design.SR.GetString("BDLBor_GridLines"); label5.SetBounds(12, 90, 150, 14); label5.TabStop = false; label5.TabIndex = 6; this.gridLinesCombo.SetBounds(12, 0x6a, 140, 0x15); this.gridLinesCombo.DropDownStyle = ComboBoxStyle.DropDownList; this.gridLinesCombo.Items.Clear(); this.gridLinesCombo.Items.AddRange(new object[] { System.Design.SR.GetString("BDLBor_GL_Horz"), System.Design.SR.GetString("BDLBor_GL_Vert"), System.Design.SR.GetString("BDLBor_GL_Both"), System.Design.SR.GetString("BDLBor_GL_None") }); this.gridLinesCombo.TabIndex = 7; this.gridLinesCombo.SelectedIndexChanged += new EventHandler(this.OnBordersChanged); label6.Text = System.Design.SR.GetString("BDLBor_BorderColor"); label6.SetBounds(12, 0x86, 150, 14); label6.TabStop = false; label6.TabIndex = 8; this.borderColorCombo.SetBounds(12, 150, 140, 0x15); this.borderColorCombo.TabIndex = 9; this.borderColorCombo.TextChanged += new EventHandler(this.OnBordersChanged); this.borderColorCombo.SelectedIndexChanged += new EventHandler(this.OnBordersChanged); this.borderColorPickerButton.SetBounds(0x9c, 0x95, 0x18, 0x16); this.borderColorPickerButton.Text = "..."; this.borderColorPickerButton.TabIndex = 10; this.borderColorPickerButton.FlatStyle = FlatStyle.System; this.borderColorPickerButton.Click += new EventHandler(this.OnClickColorPicker); this.borderColorPickerButton.AccessibleName = System.Design.SR.GetString("BDLBor_ChooseColorButton"); this.borderColorPickerButton.AccessibleDescription = System.Design.SR.GetString("BDLBor_ChooseColorDesc"); label7.Text = System.Design.SR.GetString("BDLBor_BorderWidth"); label7.SetBounds(12, 0xb2, 150, 14); label7.TabStop = false; label7.TabIndex = 11; this.borderWidthUnit.SetBounds(12, 0xc2, 0x66, 0x16); this.borderWidthUnit.AllowNegativeValues = false; this.borderWidthUnit.AllowPercentValues = false; this.borderWidthUnit.DefaultUnit = 0; this.borderWidthUnit.TabIndex = 12; this.borderWidthUnit.Changed += new EventHandler(this.OnBordersChanged); this.borderWidthUnit.ValueAccessibleDescription = System.Design.SR.GetString("BDLBor_BorderWidthValueDesc"); this.borderWidthUnit.ValueAccessibleName = System.Design.SR.GetString("BDLBor_BorderWidthValueName"); this.borderWidthUnit.UnitAccessibleDescription = System.Design.SR.GetString("BDLBor_BorderWidthUnitDesc"); this.borderWidthUnit.UnitAccessibleName = System.Design.SR.GetString("BDLBor_BorderWidthUnitName"); this.Text = System.Design.SR.GetString("BDLBor_Text"); base.AccessibleDescription = System.Design.SR.GetString("BDLBor_Desc"); base.Size = new Size(0x134, 0x9c); base.CommitOnDeactivate = true; base.Icon = new Icon(base.GetType(), "BordersPage.ico"); base.Controls.Clear(); base.Controls.AddRange(new Control[] { this.borderWidthUnit, label7, this.borderColorPickerButton, this.borderColorCombo, label6, this.gridLinesCombo, label5, label4, this.cellSpacingEdit, label3, this.cellPaddingEdit, label2, label }); }
private void AddItem(string name, object value, string bindingName) { Func <ComboBoxItem, bool> predicate = null; var type = value.GetType(); var element = new Grid { Margin = new Thickness(0.0, 0.0, 0.0, 10.0) }; var definition4 = new ColumnDefinition { Width = new GridLength(126.0) }; element.ColumnDefinitions.Add(definition4); var definition5 = new ColumnDefinition { Width = new GridLength(1.0, GridUnitType.Star) }; element.ColumnDefinitions.Add(definition5); var block = new TextBlock { Text = name, Foreground = Brushes.White }; element.Children.Add(block); if (((type == typeof(double)) || (type == typeof(int))) || ((type == typeof(float)) || (type == typeof(Thickness)))) { var binding = new Binding(bindingName) { Mode = BindingMode.TwoWay }; var textBox = new TextBox(); textBox.TextChanged += delegate { foreach (var ch in textBox.Text) { switch (ch) { case ',': case '.': return; } } textBox.Text = new string(( from c in textBox.Text where char.IsDigit(c) select c ).ToArray()); textBox.SelectionStart = textBox.Text.Length; }; textBox.Text = value.ToString(); Grid.SetColumn(textBox, 1); textBox.SetBinding(TextBox.TextProperty, binding); element.Children.Add(textBox); } else if (type == typeof(SolidColorBrush)) { var binding2 = new Binding(bindingName) { Mode = BindingMode.TwoWay, Converter = Resources["brushToColorConverter"] as Legacy.BrushToColorConverter }; var box = new ColorComboBox { Margin = new Thickness(0.0, -4.0, 0.0, 4.0) }; Grid.SetColumn(box, 1); box.SetBinding(ColorComboBox.SelectedColorProperty, binding2); element.Children.Add(box); } else { if (type == typeof(string)) { var grid2 = new Grid { Margin = new Thickness(0.0, 0.0, 0.0, 10.0) }; var definition = new ColumnDefinition { Width = new GridLength(0.3, GridUnitType.Star) }; grid2.ColumnDefinitions.Add(definition); var definition2 = new ColumnDefinition { Width = new GridLength(1.0, GridUnitType.Auto) }; grid2.ColumnDefinitions.Add(definition2); var definition3 = new ColumnDefinition { Width = new GridLength(0.3, GridUnitType.Star) }; grid2.ColumnDefinitions.Add(definition3); var grid3 = new Grid { Height = 1.0, Background = Brushes.White }; Grid.SetColumn(grid3, 0); var grid4 = new Grid { Height = 1.0, Background = Brushes.White }; Grid.SetColumn(grid4, 2); var block2 = new TextBlock { Text = value.ToString(), Foreground = Brushes.White, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(5.0, 0.0, 5.0, 0.0) }; Grid.SetColumn(block2, 1); grid2.Children.Add(grid3); grid2.Children.Add(grid4); grid2.Children.Add(block2); spEditor.Children.Add(grid2); return; } if (type == typeof(FontFamily)) { var binding3 = new Binding(bindingName) { Mode = BindingMode.TwoWay }; var list = (from f in new InstalledFontCollection().Families select new ComboBoxItem { Content = f.Name, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch, FontFamily = new FontFamily(f.Name) }).ToList <ComboBoxItem>(); var combo = new ComboBox { ItemsSource = list }; combo.SetBinding(FontFamilyProperty, binding3); combo.SelectionChanged += delegate { if (combo.SelectedItem != null) { var selectedItem = (ComboBoxItem)combo.SelectedItem; combo.FontFamily = selectedItem.FontFamily; } }; predicate = c => c.FontFamily.ToString() == value.ToString(); combo.SelectedItem = combo.Items.Cast <ComboBoxItem>().FirstOrDefault <ComboBoxItem>(predicate); Grid.SetColumn(combo, 1); element.Children.Add(combo); } else if (type == typeof(FontWeight)) { var binding4 = new Binding(bindingName) { Mode = BindingMode.TwoWay }; var combo = new ComboBox { ItemsSource = Resources["fontWeights"] as FontWeight[] }; combo.SetBinding(FontWeightProperty, binding4); combo.SelectionChanged += delegate { if (combo.SelectedItem != null) { combo.FontWeight = (FontWeight)combo.SelectedItem; } }; combo.SelectedItem = (FontWeight)value; Grid.SetColumn(combo, 1); element.Children.Add(combo); } } spEditor.Children.Add(element); }
public NewFontDialog() { FormBorderStyle = FormBorderStyle.FixedDialog; MinimizeBox = MaximizeBox = ShowInTaskbar = false; Text = "Font"; AutoSize = true; TableLayoutPanel table = new TableLayoutPanel(); table.Parent = this; table.AutoSize = true; table.ColumnCount = 4; table.RowCount = 3; table.Padding = new Padding(base.Font.Height); Label lbl = new Label(); lbl.Text = "&Font:"; lbl.AutoSize = true; table.Controls.Add(lbl, 0, 0); comboFont = new ComboBox(); comboFont.DropDownStyle = ComboBoxStyle.Simple; comboFont.AutoSize = true; comboFont.TextChanged += OnComboBoxTextChanged; table.Controls.Add(comboFont, 0, 1); // Fill the comboFont box with the font families. foreach (FontFamily fntfam in FontFamily.Families) { comboFont.Items.Add(fntfam.Name); } lbl = new Label(); lbl.Text = "&Font st&yle:"; lbl.AutoSize = true; table.Controls.Add(lbl, 1, 0); comboStyle = new StyleComboBox(); comboStyle.DropDownStyle = ComboBoxStyle.Simple; comboStyle.AutoSize = true; comboStyle.TextChanged += OnComboBoxTextChanged; table.Controls.Add(comboStyle, 1, 1); lbl = new Label(); lbl.Text = "&Size:"; lbl.AutoSize = true; table.Controls.Add(lbl, 2, 0); comboSize = new ComboBox(); comboSize.DropDownStyle = ComboBoxStyle.Simple; comboSize.AutoSize = true; comboSize.TextChanged += OnComboBoxTextChanged; table.Controls.Add(comboSize, 2, 1); // Add the font sizes to the combo box. for (int i = 8; i < 12; i++) { comboSize.Items.Add(i); } for (int i = 12; i < 30; i += 2) { comboSize.Items.Add(i); } for (int i = 36; i <= 72; i += 12) { comboSize.Items.Add(i); } comboSize.SelectedIndex = 0; // Effects GroupPanel. GroupPanel grppnl = new GroupPanel(); grppnl.Text = "Effects"; table.Controls.Add(grppnl, 0, 2); // Strikeout CheckBox. chkboxStrikeout = new CheckBox(); chkboxStrikeout.Text = "Stri&keout"; chkboxStrikeout.AutoSize = true; chkboxStrikeout.Click += delegate { ShowNewFont(); }; grppnl.Controls.Add(chkboxStrikeout); // Underline CheckBox. chkboxUnderline = new CheckBox(); chkboxUnderline.Text = "&Underline"; chkboxUnderline.AutoSize = true; chkboxUnderline.Click += delegate { ShowNewFont(); }; grppnl.Controls.Add(chkboxUnderline); // Color Label. lblColor = new Label(); lblColor.Text = "&Color:"; lblColor.AutoSize = true; lblColor.Visible = false; grppnl.Controls.Add(lblColor); // Color ComboBox comboColor = new ColorComboBox(); comboColor.Visible = false; comboColor.AutoSize = true; comboColor.TextChanged += OnComboBoxTextChanged; grppnl.Controls.Add(comboColor); // Flow panel for sample and script FlowLayoutPanel flow = new FlowLayoutPanel(); flow.AutoSize = true; flow.FlowDirection = FlowDirection.TopDown; table.Controls.Add(flow, 1, 2); table.SetColumnSpan(flow, 2); // GroupPanel for sample. grppnl = new GroupPanel(); grppnl.Text = "Sample"; flow.Controls.Add(grppnl); // Sample label. lblSample = new Label(); lblSample.Text = "AaBbYyZz"; lblSample.Font = base.Font; lblSample.TextAlign = ContentAlignment.MiddleCenter; lblSample.BorderStyle = BorderStyle.Fixed3D; lblSample.Size = new Size(20 * base.Font.Height, 3 * base.Font.Height); grppnl.Controls.Add(lblSample); // Flow panel for buttons. flow = new FlowLayoutPanel(); flow.AutoSize = true; flow.FlowDirection = FlowDirection.TopDown; table.Controls.Add(flow, 3, 1); // OK button. Button btn = new Button(); btn.Text = "OK"; btn.AutoSize = true; btn.DialogResult = DialogResult.OK; AcceptButton = btn; flow.Controls.Add(btn); // Cancel button. btn = new Button(); btn.Text = "Cancel"; btn.AutoSize = true; btn.DialogResult = DialogResult.Cancel; CancelButton = btn; flow.Controls.Add(btn); // Generate event for filling style box. comboFont.SelectedItem = base.Font.FontFamily.Name; }
private void button1_Click(object sender, EventArgs e) { //NicsInventory1DataSet.ColorsDataTable Colors; //Add to order tables string ColorName = ColorComboBox.Text; int firstSpace = ColorName.IndexOf(" "); ColorName = ColorName.Substring(0, firstSpace); //int ColorID = Convert.ToInt32(comboBox5.SelectedValue); //MessageBox.Show(boxmessage); SqlConnection conn = new SqlConnection(connstr); using (conn) { conn.Open(); /*using (var cmd = new SqlCommand("SELECT ID FROM Products WHERE VinylType = @VinylType AND ColorID = @ColorID", conn)) * { * cmd.Parameters.AddWithValue("@VinylType", VinylTypeID); * cmd.Parameters.AddWithValue("@ColorID", ColorID); * * int result = Convert.ToInt32(cmd.ExecuteScalar()); * * if (result != 0) * { * prodID = result; * MessageBox.Show("Product ID found"); * } * else * { * MessageBox.Show("No Product found."); * } * }*/ string costTextBox = textBox1.Text; decimal orderPrice; if (!decimal.TryParse(costTextBox, out orderPrice)) { MessageBox.Show("Order not created. Please enter a valid price as #.## or ##"); textBox1.Text = "0.00"; return; } SqlCommand cmdNewOrder = new SqlCommand("spAddOrder", conn); cmdNewOrder.CommandType = CommandType.StoredProcedure; cmdNewOrder.Parameters.Add(new SqlParameter("@pDate", SqlDbType.DateTime)); cmdNewOrder.Parameters["@pDate"].Value = dateTimePicker1.Value; cmdNewOrder.Parameters.Add(new SqlParameter("@pPrice", SqlDbType.Decimal)); cmdNewOrder.Parameters["@pPrice"].Value = orderPrice; cmdNewOrder.Parameters.Add(new SqlParameter("@pID", SqlDbType.Int)); cmdNewOrder.Parameters["@pID"].Direction = ParameterDirection.Output; try { cmdNewOrder.ExecuteNonQuery(); this.OrderID = (int)cmdNewOrder.Parameters["@pID"].Value; string boxmessage = "This returned order #" + OrderID; MessageBox.Show(boxmessage); } catch { //NC-14 A simple catch. MessageBox.Show("Order ID was not returned. Order could not be created."); } if (isVinylOrder) { int prodID = Convert.ToInt32(ColorComboBox.SelectedValue); DataClasses1DataContext context = new DataClasses1DataContext(); //TO DO -- Add product and quantities to a List object and iterate through VinylOrderItem vinylOrderItem = new VinylOrderItem(); vinylOrderItem.ProductID = prodID; vinylOrderItem.OrderID = OrderID; vinylOrderItem.Quantity = numericUpDown1.Value; context.VinylOrderItems.InsertOnSubmit(vinylOrderItem); SecondaryOrderItem TransferTape = new SecondaryOrderItem(); TransferTape.SecondaryID = GetSecondaryItemID(TransferTapeType); TransferTape.OrderID = OrderID; TransferTape.Quantity = numericUpDown2.Value; context.SecondaryOrderItems.InsertOnSubmit(TransferTape); try { context.SubmitChanges(); } catch (Exception ex) { Console.Write(ex.Message); } bool result = Product.Outgoing(prodID, (double)numericUpDown1.Value); if (!result) { MessageBox.Show("There was a problem decreasing vinyl inventory. Tell your wife she did something wrong"); } } else { DataClasses1DataContext context = new DataClasses1DataContext(); StickerOrderItem stickerOrderItem = new StickerOrderItem(); stickerOrderItem.OrderID = OrderID; stickerOrderItem.Quantity = (int)numericUpDown1.Value; stickerOrderItem.StickerID = stickerID; try { context.SubmitChanges(); } catch (Exception ex) { Console.Write(ex.Message); } bool result = Sticker.Outgoing(stickerID, (int)numericUpDown1.Value); if (!result) { MessageBox.Show("There was a problem decreasing sticker inventory. Tell your wife she did something wrong"); } if (Sticker.CheckNotify(stickerID)) { MessageBox.Show("You're getting low on " + Sticker.GetName(stickerID)); } } } //Decrement stock textBox3.Clear(); ScrapLengthTB.Clear(); ScrapWidthTB.Clear(); textBox6.Clear(); textBox1.Text = "0.00"; checkBox1.Checked = false; checkBox5.Checked = false; numericUpDown1.Value = VINYL_DEFAULT_QUANTITY; numericUpDown2.Value = TRANSFER_TAPE_DEFAULT_QUANTITY; ColorComboBox.Show(); StickerNameCombo.Hide(); }