本文整理汇总了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)));
}
示例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 ();
}
示例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);
}