protected virtual void DrawBorderAndFill(Graphics graphics) { int borderWidth = BorderWidth; double borderRound = BorderRound; Color borderColor = BorderColor; Color fillColor = BackColor; if (mEnableMouseEffect && mIsMouseOver && Enabled) { Color highLight = Color.FromKnownColor(KnownColor.Highlight); fillColor = Color.FromArgb(75, highLight); if (borderWidth == 0) { borderWidth = 1; } borderColor = highLight; } DevAge.Drawing.RoundedRectangle roundedRect = new DevAge.Drawing.RoundedRectangle(ClientRectangle, borderRound); using (SolidBrush brush = new SolidBrush(fillColor)) { DevAge.Drawing.Utilities.FillRoundedRectangle(graphics, roundedRect, brush); } if (borderWidth > 0) { using (Pen pen = new Pen(borderColor, borderWidth)) { DevAge.Drawing.Utilities.DrawRoundedRectangle(graphics, roundedRect, pen); } } }
protected override void OnDraw(DevAge.Drawing.GraphicsCache graphics, RectangleF area) { DevAge.Drawing.RoundedRectangle rounded = new DevAge.Drawing.RoundedRectangle(Rectangle.Round(area), Round); using (System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(area, Color.RoyalBlue, Color.WhiteSmoke, System.Drawing.Drawing2D.LinearGradientMode.Vertical)) { graphics.Graphics.FillRegion(brush, new Region(rounded.ToGraphicsPath())); } //Border DevAge.Drawing.Utilities.DrawRoundedRectangle(graphics.Graphics, rounded, Pens.RoyalBlue); }
protected virtual void DrawBorderAndFill(Graphics graphics) { int borderWidth = BorderWidth; double borderRound = BorderRound; Color borderColor = BorderColor; Color fillColor = BackColor; if (mEnableMouseEffect && mIsMouseOver && Enabled) { Color highLight = Color.FromKnownColor(KnownColor.Highlight); fillColor = Color.FromArgb(75, highLight); if (borderWidth == 0) borderWidth = 1; borderColor = highLight; } DevAge.Drawing.RoundedRectangle roundedRect = new DevAge.Drawing.RoundedRectangle(ClientRectangle, borderRound); using (SolidBrush brush = new SolidBrush(fillColor)) { DevAge.Drawing.Utilities.FillRoundedRectangle(graphics, roundedRect, brush); } if (borderWidth > 0) { using (Pen pen = new Pen(borderColor, borderWidth)) { DevAge.Drawing.Utilities.DrawRoundedRectangle(graphics, roundedRect, pen); } } }