当前位置: 首页>>代码示例>>C#>>正文


C# Graphics.ResetClip方法代码示例

本文整理汇总了C#中Graphics.ResetClip方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.ResetClip方法的具体用法?C# Graphics.ResetClip怎么用?C# Graphics.ResetClip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Graphics的用法示例。


在下文中一共展示了Graphics.ResetClip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnPaint

    protected override void OnPaint(PaintEventArgs e)
    {
        G = e.Graphics;
        G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

        G.Clear(BackColor);
        G.SmoothingMode = SmoothingMode.AntiAlias;

        GP1 = ThemeModule.CreateRound(0, 0, Width - 1, Height - 1, 7);
        GP2 = ThemeModule.CreateRound(1, 1, Width - 3, Height - 3, 7);

        GB1 = new LinearGradientBrush(ClientRectangle, Color.FromArgb(60, 60, 60), Color.FromArgb(55, 55, 55), 90f);
        G.SetClip(GP1);
        G.FillRectangle(GB1, ClientRectangle);
        G.ResetClip();

        G.DrawPath(P1, GP1);
        G.DrawPath(P4, GP2);

        SZ1 = G.MeasureString(Text, Font);
        PT1 = new PointF(5, Height / 2 - SZ1.Height / 2);

        G.DrawString(Text, Font, Brushes.Black, PT1.X + 1, PT1.Y + 1);
        G.DrawString(Text, Font, Brushes.White, PT1);

        G.DrawLine(P3, Width - 15, 10, Width - 11, 13);
        G.DrawLine(P3, Width - 7, 10, Width - 11, 13);
        G.DrawLine(Pens.Black, Width - 11, 13, Width - 11, 14);

        G.DrawLine(P2, Width - 16, 9, Width - 12, 12);
        G.DrawLine(P2, Width - 8, 9, Width - 12, 12);
        G.DrawLine(Pens.White, Width - 12, 12, Width - 12, 13);

        G.DrawLine(P1, Width - 22, 0, Width - 22, Height);
        G.DrawLine(P4, Width - 23, 1, Width - 23, Height - 2);
        G.DrawLine(P4, Width - 21, 1, Width - 21, Height - 2);
    }
开发者ID:massimoca,项目名称:Wedit,代码行数:37,代码来源:Theme.cs

示例2: DrawGlow

 /// <summary>
 /// Draws the glow for the button when the
 /// mouse is inside the client area using
 /// the GlowColor property.
 /// </summary>
 /// <param name="g">The graphics object used in the paint event.</param>
 private void DrawGlow(Graphics g)
 {
     if (this.mButtonState == State.Pressed) { return; }
     SetClip(g);
     using (GraphicsPath glow = new GraphicsPath())
         {
         glow.AddEllipse(-5, this.Height / 2 - 10, this.Width + 11, this.Height + 11);
         using (PathGradientBrush gl = new PathGradientBrush(glow))
             {
             gl.CenterColor = Color.FromArgb(mGlowAlpha, this.GlowColor);
             gl.SurroundColors = new Color[] { Color.FromArgb(0, this.GlowColor) };
             g.FillPath(gl, glow);
             }
         }
     g.ResetClip();
 }
开发者ID:RobertFurer,项目名称:Picasso23,代码行数:22,代码来源:VistaButton.cs

示例3: DrawBackground

 /// <summary>
 /// Draws the background for the control
 /// using the background image and the 
 /// BaseColor.
 /// </summary>
 /// <param name="g">The graphics object used in the paint event.</param>
 private void DrawBackground(Graphics g)
 {
     if (this.ButtonStyle == Style.Flat && this.mButtonState == State.None) { return; }
     int alpha = (mButtonState == State.Pressed) ? 204 : 127;
     Rectangle r = this.ClientRectangle;
     r.Width--; r.Height--;
     using (GraphicsPath rr = RoundRect(r, CornerRadius, CornerRadius, CornerRadius, CornerRadius))
         {
         using (SolidBrush sb = new SolidBrush(this.BaseColor))
             {
             g.FillPath(sb, rr);
             }
         SetClip(g);
         if (this.BackImage != null) { g.DrawImage(this.BackImage, this.ClientRectangle); }
         g.ResetClip();
         using (SolidBrush sb = new SolidBrush(Color.FromArgb(alpha, this.ButtonColor)))
             {
             g.FillPath(sb, rr);
             }
         }
 }
开发者ID:RobertFurer,项目名称:Picasso23,代码行数:27,代码来源:VistaButton.cs


注:本文中的Graphics.ResetClip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。