private void btnUline_Click(object sender, EventArgs e) { if (SelectedElement != null) { if (SelectedElement is Text txt) { Font currentFont = txt.Fnt; if (txt.Fnt.Underline) { txt.Fnt = new Font(currentFont.FontFamily, currentFont.Size, currentFont.Style & ~FontStyle.Underline); } else { txt.Fnt = new Font(currentFont.FontFamily, currentFont.Size, FontStyle.Underline | currentFont.Style); } } PaintPreview(); } if (UnderlineSelected) { UnderlineSelected = false; btnUline.BackColor = SystemColors.Control; btnUline.Image = Properties.Resources.underline; } else { UnderlineSelected = true; btnUline.BackColor = Color.Black; btnUline.Image = ImageInverting.InvertImage((Bitmap)btnUline.Image); } }
public void DESelectTool(ref PictureBox toSelect) { toSelect.BackColor = Color.White; if (toSelect.Tag != null && toSelect.Tag.ToString() == "selected") // If it isn't selected already { toSelect.Image = ImageInverting.InvertImage((Bitmap)toSelect.Image); } toSelect.Tag = ""; }
/// <summary> /// Shows the properties panel with the specified options. /// </summary> /// <param name="title">The text to put as the label.</param> /// <param name="showFColor">Show the Fill Color.</param> /// <param name="showBColor">Show the Border Color.</param> /// <param name="showColor">Show the Color.</param> /// <param name="showBWidth">Show the Border Size.</param> /// <param name="showThickness">Show the Thickness.</param> /// <param name="showText">Show the Text tools.</param> /// <param name="objectColor">The color of this object (if this is a selection)</param> /// <param name="text">The text to put into the "Text" box.</param> /// <param name="fnt">The font to put into the "Font" box.</param> public void ShowProperties(string title, bool showFColor, bool showBColor, bool showColor, bool showBWidth, bool showThickness, bool showText, Color objectColor, Color borderColor = new Color(), string text = "", Font fnt = null) { properties.Show(); propertiesLbl.Text = title; // Below if the selection tool is on then set the object's color otherwise set the palette's color! if (showFColor) { label4.Show(); clrFill.Show(); clrFill.BackColor = objectColor; } else { label4.Hide(); clrFill.Hide(); } if (showBColor) { label5.Show(); clrBord.Show(); clrBord.BackColor = borderColor; } else { label5.Hide(); clrBord.Hide(); } if (showColor) { label6.Show(); clrNorm.Show(); clrNorm.BackColor = objectColor; } else { label6.Hide(); clrNorm.Hide(); } if (showBWidth) { label7.Show(); txtBWidth.Show(); } else { label7.Hide(); txtBWidth.Hide(); } if (showThickness) { label8.Show(); txtBThick.Show(); } else { label8.Hide(); txtBThick.Hide(); } if (showText) { label2.Show(); label10.Show(); pnlFont.Show(); txtTText.Show(); txtTText.Text = text; if (fnt != null) { cmbFont.Text = fnt.FontFamily.Name; cmbSize.Text = fnt.Size.ToString(CultureInfo.CurrentCulture); if (fnt.Bold) { BoldSelected = true; btnBold.BackColor = Color.Black; btnBold.Image = ImageInverting.InvertImage((Bitmap)btnBold.Image); } else { BoldSelected = false; btnBold.BackColor = SystemColors.Control; btnBold.Image = Properties.Resources.bold; } if (fnt.Italic) { ItalicSelected = true; btnItl.BackColor = Color.Black; btnItl.Image = ImageInverting.InvertImage((Bitmap)btnItl.Image); } else { ItalicSelected = false; btnItl.BackColor = SystemColors.Control; btnItl.Image = Properties.Resources.italic; } if (fnt.Underline) { UnderlineSelected = true; btnUline.BackColor = Color.Black; btnUline.Image = ImageInverting.InvertImage((Bitmap)btnUline.Image); } else { UnderlineSelected = false; btnUline.BackColor = SystemColors.Control; btnUline.Image = Properties.Resources.underline; } } } else { label2.Hide(); label10.Hide(); pnlFont.Hide(); txtTText.Hide(); } }