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


C# Graphics.SetClip方法代码示例

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


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

示例1: Render

        /// <summary>
        /// Renders the specified HTML source on the specified area clipping if specified
        /// </summary>
        /// <param name="g">Device to draw</param>
        /// <param name="html">HTML source</param>
        /// <param name="area">Area where HTML should be drawn</param>
        /// <param name="clip">If true, it will only paint on the specified area</param>
        public static void Render(Graphics g, string html, RectangleF area, bool clip)
        {
            InitialContainer container = new InitialContainer(html);
            Region prevClip = g.Clip;

            if (clip) g.SetClip(area);

            container.SetBounds(area);
            container.MeasureBounds(g);
            container.Paint(g);

            if (clip) g.SetClip(prevClip, System.Drawing.Drawing2D.CombineMode.Replace);
        }
开发者ID:emanueldejanu,项目名称:ycup,代码行数:20,代码来源:HtmlRenderer.cs

示例2: 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

示例3: DrawTabStrip_Document

                private void DrawTabStrip_Document(Graphics g)
                {
                    int count = Tabs.Count;
                    if (count == 0)
                    {
                        return;
                    }

                    g.DrawLine(OutlineOuterPen, ClientRectangle.Left, ClientRectangle.Bottom - 1, ClientRectangle.Right, ClientRectangle.Bottom - 1);

                    // Draw the tabs
                    Rectangle rectTabs = TabsRectangle;
                    Rectangle rectTab = Rectangle.Empty;
                    g.SetClip(rectTabs, CombineMode.Replace);

                    int j = 0;
                    for (int i = 0; i <= count - 1; i++)
                    {
                        rectTab = GetTabRectangle(i);
                        if (rectTab.IntersectsWith(rectTabs))
                        {
                            DrawTab(g, Tabs[i].Content, rectTab, j);
                            j++;
                        }
                    }
                }
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:26,代码来源:DockPaneStripFromBase.cs

示例4: DrawComboBox

	/// <summary>
	/// Draws a combo box in the Windows Vista (and newer) style.
	/// </summary>
	/// <param name="graphics"></param>
	/// <param name="bounds"></param>
	/// <param name="state"></param>
	internal static void DrawComboBox(Graphics graphics, Rectangle bounds, ComboBoxState state) {
		Rectangle comboBounds = bounds;
		comboBounds.Inflate(1, 1);
		ButtonRenderer.DrawButton(graphics, comboBounds, GetPushButtonState(state));

		Rectangle buttonBounds = new Rectangle(
			bounds.Left + (bounds.Width - 17),
			bounds.Top,
			17,
			bounds.Height - (state != ComboBoxState.Pressed ? 1 : 0)
		);

		Rectangle buttonClip = buttonBounds;
		buttonClip.Inflate(-2, -2);

		using (Region oldClip = graphics.Clip.Clone()) {
			graphics.SetClip(buttonClip, System.Drawing.Drawing2D.CombineMode.Intersect);
			ComboBoxRenderer.DrawDropDownButton(graphics, buttonBounds, state);
			graphics.SetClip(oldClip, System.Drawing.Drawing2D.CombineMode.Replace);
		}
	}
开发者ID:BruceNielsen,项目名称:_V4.7-Proxy,代码行数:27,代码来源:GroupedComboBox.cs

示例5: SetClip

 private void SetClip(Graphics g)
 {
     Rectangle r = this.ClientRectangle;
     r.X++; r.Y++; r.Width -= 3; r.Height -= 3;
     using (GraphicsPath rr = RoundRect(r, CornerRadius, CornerRadius, CornerRadius, CornerRadius))
         {
         g.SetClip(rr);
         }
 }
开发者ID:RobertFurer,项目名称:Picasso23,代码行数:9,代码来源:VistaButton.cs


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