本文整理汇总了C#中System.Windows.Forms.PaintEventArgs.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# PaintEventArgs.Dispose方法的具体用法?C# PaintEventArgs.Dispose怎么用?C# PaintEventArgs.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.PaintEventArgs
的用法示例。
在下文中一共展示了PaintEventArgs.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Dispose
public void Dispose ()
{
PaintEventArgs pea = new PaintEventArgs (default_graphics, default_rect);
pea.Dispose ();
// uho, under 2.0 we not really disposing the stuff - it means it's not ours to dispose!
Assert.IsTrue (pea.Graphics.Transform.IsIdentity, "Graphics.Transform");
}
示例2: DrawRectangles
public static void DrawRectangles(object sender, PaintEventArgs e)
{
TopRectangle(ref e);
CenterRectangle(ref e);
BottomRectangle(ref e);
e.Dispose();
}
示例3: zombieCharacterRad_Paint
//Creates a red box with a red x until the design for a planned feature is finished.
private void zombieCharacterRad_Paint(object sender, PaintEventArgs e)
{
Pen pen = new Pen(Color.Red, 10);
e.Graphics.DrawRectangle(pen, new Rectangle(0, 0, 156, 36));
pen.Width = 3;
e.Graphics.DrawLine(pen, -15, 0, 171, 36);
e.Graphics.DrawLine(pen, 171, 0, -15, 36);
e.Dispose();
pen.Dispose();
}
示例4: UpdateBackground
// Event Methods
protected void UpdateBackground()
{
PaintEventArgs e = new PaintEventArgs(this.CreateGraphics(), ClientRectangle);
try
{
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
OnBackPaint(e);
}
finally
{
e.Dispose();
}
}
示例5: WndProc
protected override void WndProc(ref System.Windows.Forms.Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_Paint || m.Msg == WM_SETFOCUS || m.Msg == WM_LBUTTONDOWN)
{
using (Graphics gfx = base.CreateGraphics())
{
PaintEventArgs pe = new PaintEventArgs(gfx, base.ClientRectangle);
this.OnPaint(pe);
if (Paint != null)
{
Paint(this, pe);
}
pe.Dispose();
}
}
}
示例6: GamePanelPaint
/// <summary>
/// Method fired when gamePanel.Invalidate() is called
/// Draws the current Snake, food and information to the PictureBox
/// </summary>
/// <param name="sender">Sender object</param>
/// <param name="e">Information about the paint event</param>
private void GamePanelPaint(object sender, PaintEventArgs e)
{
lock (this)
{
// Get a Bitmap for the PictureBox and Graphics object to allow painting onto the Bitmap
var image = new Bitmap(gamePanel.Width, gamePanel.Height);
Graphics g = Graphics.FromImage(image);
try
{
// Enable anti-aliasing to make the game look better
g.SmoothingMode = SmoothingMode.AntiAlias;
// Fill the image with a black background
g.FillRectangle(new SolidBrush(Color.Black), 0, 0, gamePanel.Width, gamePanel.Height);
// Draw the snake, food and information about the game
DrawSnake(g);
DrawFood(g);
DrawInfo(g);
// Paint prompts the user depending on the current state of the game
if (!gameStarted)
DrawGameBegin(g);
if (gameEnded)
DrawGameEnded(g);
if (gamePaused)
DrawGamePaused(g);
// Paint the Bitmap onto the PictureBox
e.Graphics.DrawImage(image, 0, 0);
}
finally
{
e.Dispose();
g.Dispose();
}
}
}
示例7: WndProc
// Keep in mind that messages are recieved for the child controls if routed
//
protected virtual void WndProc (ref Message m)
{
// Filter out kb input
//
if ((Native.Msg) m.Msg >= Native.Msg.WM_KEYFIRST && (Native.Msg) m.Msg <= Native.Msg.WM_KEYLAST)
return;
// Mouse messages should be routed the control, if GetHitTest (virtual) returns true.
//
if (IsMouseMessage ((Native.Msg) m.Msg) &&
this.GetHitTest (new Point (Native.LoWord((int) m.LParam), Native.HiWord (((int) m.LParam))))) {
this.DefWndProc (ref m);
return;
}
switch ((Native.Msg) m.Msg) {
case Native.Msg.WM_CREATE:
this.DefWndProc (ref m);
if (m.HWnd == this.Control.Handle)
OnCreateHandle ();
break;
case Native.Msg.WM_CONTEXTMENU:
OnContextMenu (Native.LoWord ((int) m.LParam), Native.HiWord ((int) m.LParam));
break;
case Native.Msg.WM_SETCURSOR:
if (this.GetHitTest (new Point (Native.LoWord ((int) m.LParam), Native.HiWord ((int) m.LParam))))
this.DefWndProc (ref m);
else
OnSetCursor ();
break;
case Native.Msg.WM_SETFOCUS:
this.DefWndProc (ref m);
break;
case Native.Msg.WM_PAINT:
// Wait for control's WM_PAINT to complete first.
//
this.DefWndProc (ref m);
Graphics gfx = Graphics.FromHwnd (m.HWnd);
PaintEventArgs args = new PaintEventArgs (gfx, this.Control.Bounds);
OnPaintAdornments (args);
gfx.Dispose ();
args.Dispose ();
break;
case Native.Msg.WM_NCRBUTTONDOWN:
case Native.Msg.WM_NCLBUTTONDOWN:
case Native.Msg.WM_NCMBUTTONDOWN:
case Native.Msg.WM_NCLBUTTONDBLCLK:
case Native.Msg.WM_NCRBUTTONDBLCLK:
break;
case Native.Msg.WM_LBUTTONDBLCLK:
case Native.Msg.WM_RBUTTONDBLCLK:
case Native.Msg.WM_MBUTTONDBLCLK:
if ((Native.Msg)m.Msg == Native.Msg.WM_LBUTTONDBLCLK)
_mouseButtonDown = MouseButtons.Left;
else if ((Native.Msg)m.Msg == Native.Msg.WM_RBUTTONDBLCLK)
_mouseButtonDown = MouseButtons.Right;
else if ((Native.Msg)m.Msg == Native.Msg.WM_MBUTTONDBLCLK)
_mouseButtonDown = MouseButtons.Middle;
OnMouseDoubleClick ();
this.BaseWndProc (ref m);
break;
case Native.Msg.WM_MOUSEHOVER:
OnMouseHover ();
break;
case Native.Msg.WM_LBUTTONDOWN:
case Native.Msg.WM_RBUTTONDOWN:
case Native.Msg.WM_MBUTTONDOWN:
_mouseMoveAfterMouseDown = true;
if ((Native.Msg)m.Msg == Native.Msg.WM_LBUTTONDOWN)
_mouseButtonDown = MouseButtons.Left;
else if ((Native.Msg)m.Msg == Native.Msg.WM_RBUTTONDOWN)
_mouseButtonDown = MouseButtons.Right;
else if ((Native.Msg)m.Msg == Native.Msg.WM_MBUTTONDOWN)
_mouseButtonDown = MouseButtons.Middle;
if (_firstMouseMoveInClient) {
OnMouseEnter ();
_firstMouseMoveInClient = false;
}
this.OnMouseDown (Native.LoWord ((int)m.LParam), Native.HiWord ((int)m.LParam));
this.BaseWndProc (ref m);
break;
case Native.Msg.WM_MOUSELEAVE:
_firstMouseMoveInClient = false;
OnMouseLeave ();
this.BaseWndProc (ref m);
break;
//.........这里部分代码省略.........
示例8: OnPaint
protected override void OnPaint(PaintEventArgs pevent)
{
base.OnPaint(pevent);
#region Graphics Setup
Graphics graphics = pevent.Graphics;
graphics.Clear(Parent.BackColor);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
#endregion
#region Text Formatting
StringFormat stringFormat = new StringFormat();
stringFormat.Alignment = StringAlignment.Center;
stringFormat.LineAlignment = StringAlignment.Center;
#endregion
#region Model Setup
Rectangle CheckRectangle = new Rectangle(0, this.Height / 2 - (CheckBoxScale / 2), CheckBoxScale, CheckBoxScale);
Rectangle CheckedRectangle = new Rectangle(CheckRectangle.X, CheckRectangle.Y, CheckRectangle.Width, CheckRectangle.Height);
CheckedRectangle.Inflate(-3, -3);
GraphicsPath CheckModel = Base.RoundRectangle.RoundRect(CheckRectangle, 5);
GraphicsPath CheckedModel = Base.RoundRectangle.RoundRect(CheckedRectangle, 5);
Rectangle TextBounds = new Rectangle(CheckRectangle.Width + TextOffset, 0, Width - (CheckRectangle.Width + 17), Height);
#endregion
#region Brush Setup
SolidBrush CheckBoxBrush = new SolidBrush(CheckBoxColor);
SolidBrush CheckBrush = new SolidBrush(CheckColor);
SolidBrush HoverHighlightBrush = new SolidBrush(Base.Highlight(Color.FromArgb(50, 255, 255, 255), 100));
SolidBrush ClickHighlightBrush = new SolidBrush(Base.Highlight(Color.FromArgb(115, 255, 255, 255), 200));
#endregion
if (!this.Enabled)
{
Console.WriteLine("aweaw");
CheckBoxBrush.Color = Base.ConvertToGrayscale(CheckBoxBrush.Color);
CheckBrush.Color = Base.ConvertToGrayscale(CheckBrush.Color);
}
graphics.FillPath(CheckBoxBrush, CheckModel);
graphics.DrawPath(Pens.Black, CheckModel);
graphics.DrawString(Text, Font, new SolidBrush(Color.FromArgb(76, 76, 95)), TextBounds, new StringFormat { LineAlignment = StringAlignment.Center });
if (Checked)
{
graphics.FillPath(CheckBrush, CheckedModel);
}
if (StateController.CurrentState == UIState.Hovered)
{
graphics.FillPath(HoverHighlightBrush, CheckedModel);
}
else if (StateController.CurrentState == UIState.Clicked)
{
graphics.FillPath(ClickHighlightBrush, CheckedModel);
}
pevent.Dispose();
}
示例9: Draw3DSurface_Paint
public static void Draw3DSurface_Paint(Object sender, PaintEventArgs e)
{
PictureBox pBox = (PictureBox)sender;
//remove any attached mouse events if we are no longer using the 3d surface
if (!CapturingMouse_3DSurface)
{
pBox.Paint -= Draw3DSurface_Paint;
pBox.MouseWheel -= Draw3DSurface_MouseWheel;
pBox.MouseDown -= Draw3DSurface_MouseDown;
pBox.MouseUp -= Draw3DSurface_MouseUp;
pBox.MouseMove -= Draw3DSurface_MouseMove;
return;
}
e.Graphics.Clear(pBox.BackColor);
renderer3d.RenderSurface(e.Graphics, pixelMatrix, AdjustmentValue);
e.Dispose();
}
示例10: OnPaint
protected override void OnPaint(PaintEventArgs e)
{
e.Dispose();
Repaint();
}
示例11: OnPaintBackground
protected override void OnPaintBackground(PaintEventArgs e)
{
e.Dispose();
}
示例12: OnPaint
protected override void OnPaint(PaintEventArgs pe)
{
Draw(pe.Graphics);
pe.Dispose();
}
示例13: MyCustomTextBox_Paint
private void MyCustomTextBox_Paint(object sender, PaintEventArgs e)
{
//MessageBox.Show("voila");
Image img=null;
if (State == TextBoxState.FOCUSED || State == TextBoxState.HOVERED)
img = (Image)resourceManager.GetObject("back_textbox_hover");
if(img==null)
img = (Image)resourceManager.GetObject("back_textbox");
e.Graphics.DrawImage(img, this.ClientRectangle);
e.Dispose();
img.Dispose();
}
示例14: panel2_Paint
//Panel2 contains the line under the play, for/back wardButtons
private void panel2_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(new Pen(Color.FromArgb(255, 38, 126, 200), 1), 20, 5, panel2.Width - 35, 5);
e.Dispose();
}
示例15: WndProc
protected override void WndProc(ref Message m)
{
if (m.Msg == 20)
{
m.Result = IntPtr.Zero;
}
else
{
base.WndProc(ref m);
if (m.Msg == 8270)
{
Fusionbird.FusionToolkit.NativeMethods.NMHDR nmhdr = (Fusionbird.FusionToolkit.NativeMethods.NMHDR)Marshal.PtrToStructure(m.LParam, typeof(Fusionbird.FusionToolkit.NativeMethods.NMHDR));
if (nmhdr.code == -12)
{
Marshal.StructureToPtr((object)nmhdr, m.LParam, false);
Fusionbird.FusionToolkit.NativeMethods.NMCUSTOMDRAW nmcustomdraw = (Fusionbird.FusionToolkit.NativeMethods.NMCUSTOMDRAW)Marshal.PtrToStructure(m.LParam, typeof(Fusionbird.FusionToolkit.NativeMethods.NMCUSTOMDRAW));
if (nmcustomdraw.dwDrawStage == Fusionbird.FusionToolkit.NativeMethods.CustomDrawDrawStage.CDDS_PREPAINT)
{
Graphics graphics = Graphics.FromHdc(nmcustomdraw.hdc);
PaintEventArgs e = new PaintEventArgs(graphics, this.Bounds);
e.Graphics.TranslateTransform((float)-this.Left, (float)-this.Top);
this.InvokePaintBackground(this.Parent, e);
this.InvokePaint(this.Parent, e);
SolidBrush solidBrush = new SolidBrush(this.BackColor);
e.Graphics.FillRectangle((Brush)solidBrush, this.Bounds);
solidBrush.Dispose();
e.Graphics.ResetTransform();
e.Dispose();
graphics.Dispose();
IntPtr num = new IntPtr(48);
m.Result = num;
}
else if (nmcustomdraw.dwDrawStage == Fusionbird.FusionToolkit.NativeMethods.CustomDrawDrawStage.CDDS_POSTPAINT)
{
this.OnDrawTicks(nmcustomdraw.hdc);
this.OnDrawChannel(nmcustomdraw.hdc);
this.OnDrawThumb(nmcustomdraw.hdc);
}
else if (nmcustomdraw.dwDrawStage == Fusionbird.FusionToolkit.NativeMethods.CustomDrawDrawStage.CDDS_ITEMPREPAINT)
{
if (nmcustomdraw.dwItemSpec.ToInt32() == 2)
{
this.ThumbBounds = nmcustomdraw.rc.ToRectangle();
this.ThumbState = !this.Enabled ? 5 : (nmcustomdraw.uItemState != Fusionbird.FusionToolkit.NativeMethods.CustomDrawItemState.CDIS_SELECTED ? 1 : 3);
this.OnDrawThumb(nmcustomdraw.hdc);
}
else if (nmcustomdraw.dwItemSpec.ToInt32() == 3)
{
this.ChannelBounds = nmcustomdraw.rc.ToRectangle();
this.OnDrawChannel(nmcustomdraw.hdc);
}
else if (nmcustomdraw.dwItemSpec.ToInt32() == 1)
this.OnDrawTicks(nmcustomdraw.hdc);
IntPtr num = new IntPtr(4);
m.Result = num;
}
}
}
}
}