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


C# PaintEventArgs.SetGraphics方法代码示例

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


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

示例1: Start

            public void Start (PaintEventArgs pe) {
                // We need to get the graphics for every paint.
                real_graphics.Push(pe.SetGraphics (XplatUI.GetOffscreenGraphics (back_buffer)));
            }
开发者ID:nlhepler,项目名称:mono,代码行数:4,代码来源:Control.cs

示例2: End

            public void End (PaintEventArgs pe) {
                Graphics buffered_graphics;
                buffered_graphics = pe.SetGraphics ((Graphics) real_graphics.Pop ());

                if (pending_disposal) 
                    Dispose ();
                else {
                    XplatUI.BlitFromOffscreen (parent.Handle, pe.Graphics, back_buffer, buffered_graphics, pe.ClipRectangle);
                    InvalidRegion.Exclude (pe.ClipRectangle);
                }
                buffered_graphics.Dispose ();
            }
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:Control.cs

示例3: PaintControlBackground

        // This method exists so controls overriding OnPaintBackground can have default background painting done
        internal virtual void PaintControlBackground (PaintEventArgs pevent) {

            bool tbstyle_flat = ((CreateParams.Style & (int) ToolBarStyles.TBSTYLE_FLAT) != 0);

            // If we have transparent background
            if (((BackColor.A != 0xff) && GetStyle(ControlStyles.SupportsTransparentBackColor)) || tbstyle_flat) {
                if (parent != null) {
                    PaintEventArgs	parent_pe;
                    GraphicsState	state;

                    parent_pe = new PaintEventArgs(pevent.Graphics, new Rectangle(pevent.ClipRectangle.X + Left, pevent.ClipRectangle.Y + Top, pevent.ClipRectangle.Width, pevent.ClipRectangle.Height));

                    state = parent_pe.Graphics.Save();
                    parent_pe.Graphics.TranslateTransform(-Left, -Top);
                    parent.OnPaintBackground(parent_pe);
                    parent_pe.Graphics.Restore(state);

                    state = parent_pe.Graphics.Save();
                    parent_pe.Graphics.TranslateTransform(-Left, -Top);
                    parent.OnPaint(parent_pe);
                    parent_pe.Graphics.Restore(state);
                    parent_pe.SetGraphics(null);
                }
            }

            if ((clip_region != null) && (XplatUI.UserClipWontExposeParent)) {
                if (parent != null) {
                    PaintEventArgs	parent_pe;
                    Region		region;
                    GraphicsState	state;
                    Hwnd		hwnd;

                    hwnd = Hwnd.ObjectFromHandle(Handle);

                    if (hwnd != null) {
                        parent_pe = new PaintEventArgs(pevent.Graphics, new Rectangle(pevent.ClipRectangle.X + Left, pevent.ClipRectangle.Y + Top, pevent.ClipRectangle.Width, pevent.ClipRectangle.Height));

                        region = new Region ();
                        region.MakeEmpty();
                        region.Union(ClientRectangle);

                        foreach (Rectangle r in hwnd.ClipRectangles) {
                            region.Union (r);
                        }

                        state = parent_pe.Graphics.Save();
                        parent_pe.Graphics.Clip = region;

                        parent_pe.Graphics.TranslateTransform(-Left, -Top);
                        parent.OnPaintBackground(parent_pe);
                        parent_pe.Graphics.Restore(state);

                        state = parent_pe.Graphics.Save();
                        parent_pe.Graphics.Clip = region;

                        parent_pe.Graphics.TranslateTransform(-Left, -Top);
                        parent.OnPaint(parent_pe);
                        parent_pe.Graphics.Restore(state);
                        parent_pe.SetGraphics(null);

                        region.Intersect(clip_region);
                        pevent.Graphics.Clip = region;
                    }
                }
            }

            if (background_image == null) {
                if (!tbstyle_flat) {
                    Rectangle paintRect = pevent.ClipRectangle;
                    Brush pen = ThemeEngine.Current.ResPool.GetSolidBrush(BackColor);
                    pevent.Graphics.FillRectangle(pen, paintRect);
                }
                return;
            }

            DrawBackgroundImage (pevent.Graphics);
        }
开发者ID:nlhepler,项目名称:mono,代码行数:78,代码来源:Control.cs


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