public SidebarGutter() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); buttonChevron = new BitmapButton(this.components); ColorizedResources.Instance.ColorizationChanged += new EventHandler(ColorizationChanged); buttonChevron.BackColor = ColorizedResources.Instance.SidebarHeaderBackgroundColor; buttonChevron.BitmapEnabled = bitmapChevronLeft; buttonChevron.BitmapSelected = bitmapChevronLeftHover; buttonChevron.BitmapPushed = bitmapChevronLeftHover; buttonChevron.Bounds = RectangleHelper.Center(new Size(10, 9), new Rectangle(0, 0, ClientSize.Width, BLOCK_HEIGHT), false); buttonChevron.ButtonStyle = ButtonStyle.Bitmap; buttonChevron.ButtonText = Res.Get(StringId.ShowSidebar); buttonChevron.ToolTip = Res.Get(StringId.ShowSidebar); buttonChevron.Click += new EventHandler(buttonChevron_Click); buttonChevron.AccessibleName = Res.Get(StringId.ShowSidebar); buttonChevron.TabStop = true; buttonChevron.TabIndex = 0; buttonChevron.RightToLeft = (BidiHelper.IsRightToLeft ? RightToLeft.No : RightToLeft.Yes); buttonChevron.AllowMirroring = true; Controls.Add(buttonChevron); AccessibleRole = AccessibleRole.PushButton; }
public HtmlEditorSidebarTitle() { // enable double buffered painting. SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); Height = 30; buttonChevron = new BitmapButton(this.components); buttonChevron.ButtonStyle = ButtonStyle.Bitmap; buttonChevron.ButtonText = Res.Get(StringId.HideSidebar); buttonChevron.ToolTip = Res.Get(StringId.HideSidebar); buttonChevron.Click += new EventHandler(ClickHandler); buttonChevron.AccessibleName = Res.Get(StringId.HideSidebar); buttonChevron.TabStop = true; buttonChevron.TabIndex = 0; buttonChevron.RightToLeft = (BidiHelper.IsRightToLeft ? RightToLeft.No : RightToLeft.Yes); buttonChevron.AllowMirroring = true; Controls.Add(buttonChevron); Click += new EventHandler(ClickHandler); //create the UI theme _uiTheme = new SidebarTitleUITheme(this); buttonChevron.Bounds = RectangleHelper.Center(_uiTheme.bmpChevronRight.Size, new Rectangle(0, 0, 20, ClientSize.Height), false); }
protected override void OnPaint(PaintEventArgs e) { BidiGraphics g = new BidiGraphics(e.Graphics, ClientRectangle); if (m_pressed) { SystemButtonHelper.DrawSystemButtonFacePushed(g, false, ClientRectangle, false); } else if (m_hover) { SystemButtonHelper.DrawSystemButtonFace(g, false, false, ClientRectangle, false); } Rectangle colorRect = new Rectangle(PADDING, PADDING, COLOR_SIZE, COLOR_SIZE); Rectangle dropDownArrowRect = new Rectangle(Width - PADDING - m_dropDownArrow.Width, PADDING, m_dropDownArrow.Width, colorRect.Height); Rectangle textRect = new Rectangle(PADDING + GUTTER_SIZE + colorRect.Width, PADDING, Width - (PADDING + GUTTER_SIZE + colorRect.Width) - (PADDING + GUTTER_SIZE + dropDownArrowRect.Width), colorRect.Height); using (Brush b = new SolidBrush(EffectiveColor)) g.FillRectangle(b, colorRect); using (Pen p = new Pen(SystemColors.Highlight, 1)) g.DrawRectangle(p, colorRect); g.DrawText(Text, Font, textRect, SystemColors.ControlText, ShowKeyboardCues ? TextFormatFlags.Default : TextFormatFlags.NoPrefix); g.DrawImage(false, m_dropDownArrow, RectangleHelper.Center(m_dropDownArrow.Size, dropDownArrowRect, false), 0, 0, m_dropDownArrow.Width, m_dropDownArrow.Height, GraphicsUnit.Pixel); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Rectangle outerRect = new Rectangle(0, 0, this.Width, this.Height); Rectangle innerRect = RectangleHelper.Center(new Size(COLOR_WELL_SIZE, COLOR_WELL_SIZE), outerRect, false); if (Selected) { outerRect.Inflate(1, 1); } if (!highlighted) { outerRect.Inflate(COLOR_WELL_SIZE - BORDER_SIZE, COLOR_WELL_SIZE - BORDER_SIZE); } using (Brush b = new SolidBrush(SystemColors.Highlight)) e.Graphics.FillRectangle(b, outerRect); using (Brush b = new SolidBrush(this._color)) e.Graphics.FillRectangle(b, innerRect); }