public SkinFormBackgroundRenderEventArgs( SkinForm skinForm, Graphics g, Rectangle clipRect) : base(g, clipRect) { _skinForm = skinForm; }
public SkinFormBorderRenderEventArgs( SkinForm skinForm, Graphics g, Rectangle clipRect, bool active) : base(g, clipRect) { _skinForm = skinForm; _active = active; }
public SkinFormCaptionRenderEventArgs( SkinForm skinForm, Graphics g, Rectangle clipRect, bool active) : base(g, clipRect) { _skinForm = skinForm; _active = active; _backColor = Color.Transparent; }
public override Region CreateRegion(SkinForm form) { Rectangle rect = new Rectangle(Point.Empty, form.Size); using (GraphicsPath path = GraphicsPathHelper.CreatePath( rect, form.Radius, form.RoundStyle, false)) { return new Region(path); } }
public SkinFormControlBoxRenderEventArgs( SkinForm form, Graphics graphics, Rectangle clipRect, bool active, ControlBoxStyle controlBoxStyle, ControlBoxState controlBoxState) : base(graphics, clipRect) { _form = form; _active = active; _controlBoxState = controlBoxState; _controlBoxStyle = controlBoxStyle; }
public SkinFormCaptionRenderEventArgs( SkinForm skinForm, Graphics g, Rectangle clipRect, Color backcolor , Image backImage, bool active) : base(g, clipRect) { _skinForm = skinForm; _active = active; _backColor = backcolor; _backImage = backImage; }
private void RenderSkinFormSysBottomInternal( Graphics g, Rectangle rect, ControlBoxState state, bool active, SkinForm form) { Bitmap image = null; SkinPictureForm imageForm = (SkinPictureForm)form; Color controlBoxActive = this.ColorTable.ControlBoxActive; if (state == ControlBoxState.Pressed) { image = (Bitmap)imageForm.SysBottomDown; controlBoxActive = this.ColorTable.ControlBoxPressed; } else if (state == ControlBoxState.Hover) { image = (Bitmap)imageForm.SysBottomMouse; controlBoxActive = this.ColorTable.ControlBoxHover; } else { image = (Bitmap)imageForm.SysBottomNorml; controlBoxActive = active ? this.ColorTable.ControlBoxActive : this.ColorTable.ControlBoxDeactive; } if (image != null) { g.DrawImage(image, rect); } else { RoundStyle bottomLeft = RoundStyle.BottomLeft; using (new AntiAliasGraphics(g)) { RenderHelper.RenderBackgroundInternal(g, rect, controlBoxActive, controlBoxActive, this.ColorTable.ControlBoxInnerBorder, bottomLeft, 6, 0.38f, true, false, LinearGradientMode.Vertical); using (Pen pen = new Pen(this.ColorTable.Border)) { g.DrawLine(pen, rect.X, rect.Y, rect.Right, rect.Y); } } } }
protected override void OnRenderSkinFormBackground( SkinFormBackgroundRenderEventArgs e) { Graphics g = e.Graphics; Rectangle rect = e.ClipRectangle; SkinForm form = e.SkinForm; using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g)) { using (Brush brush = new SolidBrush(ColorTable.Back)) { using (GraphicsPath path = GraphicsPathHelper.CreatePath( rect, form.Radius, form.RoundStyle, false)) { g.FillPath(brush, path); } } } }
protected override void OnRenderSkinFormControlBox( SkinFormControlBoxRenderEventArgs e) { SkinForm form = e.Form; Graphics g = e.Graphics; Rectangle rect = e.ClipRectangle; ControlBoxState state = e.ControlBoxtate; bool active = e.Active; bool minimizeBox = form.ControlBox && form.MinimizeBox; bool maximizeBox = form.ControlBox && form.MaximizeBox; switch (e.ControlBoxStyle) { case ControlBoxStyle.Close: RenderSkinFormCloseBoxInternal( g, rect, state, active, minimizeBox, maximizeBox); break; case ControlBoxStyle.Maximize: RenderSkinFormMaximizeBoxInternal( g, rect, state, active, minimizeBox, form.WindowState == FormWindowState.Maximized); break; case ControlBoxStyle.Minimize: RenderSkinFormMinimizeBoxInternal( g, rect, state, active); break; } }
/// <summary> /// 呈现窗体的标题 /// </summary> /// <param name="e"></param> protected override void OnRenderSkinFormCaption(SkinFormCaptionRenderEventArgs e) { Graphics g = e.Graphics; Rectangle rect = e.ClipRectangle;//标题栏的矩形 SkinForm form = e.SkinForm; Rectangle iconRect = form.IconRect; Rectangle textRect = Rectangle.Empty; bool closeBox = form.ControlBox; bool minimizeBox = form.ControlBox && form.MinimizeBox; bool maximizeBox = form.ControlBox && form.MaximizeBox; int textWidthDec = 0; if (closeBox) { textWidthDec += form.CloseBoxSize.Width + form.ControlBoxOffset.X; } if (maximizeBox) { textWidthDec += form.MaximizeBoxSize.Width + form.ControlBoxSpace; } if (minimizeBox) { textWidthDec += form.MinimizeBoxSize.Width + form.ControlBoxSpace; } int textRectHeight = form.IconRect.Height; //form.BorderWidth + (int)form.CaptionFont.GetHeight() + 2; if (form.ShowIcon == false) { textRectHeight = form.BorderWidth + (int)form.CaptionFont.GetHeight() + 2; } textRect = new Rectangle( iconRect.Right + 3, form.BorderWidth, rect.Width - iconRect.Right - textWidthDec - 6, textRectHeight); using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g)) { DrawCaptionBackground( g, rect, e.Active, e.BackColor, e.BackImage); if (form.ShowIcon && form.Icon != null) { DrawIcon(g, iconRect, form.Icon); } if (!string.IsNullOrEmpty(form.Text)) { DrawCaptionText( g, textRect, form.Text, form.CaptionFont, form.ForeColor); } } }
private void RenderSkinFormCloseBoxInternal( Graphics g, Rectangle rect, ControlBoxState state, bool active, bool minimizeBox, bool maximizeBox, SkinForm form) { Bitmap image = null; Color baseColor = ColorTable.ControlBoxActive; SkinPictureForm imageForm = (SkinPictureForm)form; if (state == ControlBoxState.Pressed) { image = (Bitmap)imageForm.CloseDownBack; baseColor = ColorTable.ControlCloseBoxPressed; } else if (state == ControlBoxState.Hover) { image = (Bitmap)imageForm.CloseMouseBack; baseColor = ColorTable.ControlCloseBoxHover; } else { image = (Bitmap)imageForm.CloseNormlBack; baseColor = active ? ColorTable.ControlBoxActive : ColorTable.ControlBoxDeactive; } if (image != null) { g.DrawImage(image, rect); } else { RoundStyle roundStyle = minimizeBox || maximizeBox ? RoundStyle.BottomRight : RoundStyle.Bottom; using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g)) { RenderHelper.RenderBackgroundInternal( g, rect, baseColor, baseColor, ColorTable.ControlBoxInnerBorder, roundStyle, 6, .38F, true, false, LinearGradientMode.Vertical); using (Pen pen = new Pen(ColorTable.Border)) { g.DrawLine(pen, rect.X, rect.Y, rect.Right, rect.Y); } using (GraphicsPath path = DrawUtil.CreateCloseFlagPath(rect)) { g.FillPath(Brushes.White, path); using (Pen pen = new Pen(baseColor)) { g.DrawPath(pen, path); } } } } }
public void Dispose() { _owner = null; }
public abstract void InitSkinForm(SkinForm form);
public abstract Region CreateRegion(SkinForm form);
public override void InitSkinForm(SkinForm form) { form.BackColor = ColorTable.Back; }
private void RenderSkinFormCloseBoxInternal( Graphics g, Rectangle rect, ControlBoxState state, bool active, bool minimizeBox, bool maximizeBox, SkinForm form) { Bitmap image = null; Color baseColor = ColorTable.ControlBoxActive; SkinPictureForm imageForm = (SkinPictureForm) form; if (state == ControlBoxState.Pressed) { image = (Bitmap)imageForm.CloseDownBack; baseColor = ColorTable.ControlCloseBoxPressed; } else if (state == ControlBoxState.Hover) { image = (Bitmap)imageForm.CloseMouseBack; baseColor = ColorTable.ControlCloseBoxHover; } else { image = (Bitmap)imageForm.CloseNormlBack; baseColor = active ? ColorTable.ControlBoxActive : ColorTable.ControlBoxDeactive; } if (image != null) { g.DrawImage(image , rect ); } else { RoundStyle roundStyle = minimizeBox || maximizeBox ? RoundStyle.BottomRight : RoundStyle.Bottom; using (AntiAliasGraphics antiGraphics = new AntiAliasGraphics(g)) { RenderHelper.RenderBackgroundInternal( g, rect, baseColor, baseColor, ColorTable.ControlBoxInnerBorder, roundStyle, 6, .38F, true, false, LinearGradientMode.Vertical); using (Pen pen = new Pen(ColorTable.Border)) { g.DrawLine(pen, rect.X, rect.Y, rect.Right, rect.Y); } using (GraphicsPath path = DrawUtil.CreateCloseFlagPath(rect)) { g.FillPath(Brushes.White, path); using (Pen pen = new Pen(baseColor)) { g.DrawPath(pen, path); } } } } }
public ControlBoxManager(SkinForm owner) { _owner = owner; }