/// <summary> /// 重绘事件 /// </summary> private void NewPictureBox_Paint(object sender, PaintEventArgs e) { CustomDrawEventHandler eventHandle = Events[_customDraw] as CustomDrawEventHandler; if (eventHandle != null) { eventHandle(e.Graphics, 0, 0, sender, null); } }
protected internal virtual void RaiseCustomDraw(MyCustomDrawArgs args) { CustomDrawEventHandler handler = (CustomDrawEventHandler)this.Events[customDraw]; if (handler != null) { handler(this, args); } }
internal void RaiseCustomDrawItem(CustomDrawEventArgs e) { CustomDrawEventHandler handler = (CustomDrawEventHandler)Events[customDraw]; if (handler != null) { handler(GetEventSender(), e); } }
public void Draw(Graphics g, float x, float y) { if (Image != null) { g.DrawImage(Image, x, y, Width, Height); } else { CustomDrawEventHandler eventHandle = Events[_customDraw] as CustomDrawEventHandler; if (eventHandle != null) { eventHandle(g, x, y, this, null); } } }
/// <summary> /// IPrintable 接口方法的实现绘制 /// </summary> public void Draw(Graphics g, float x, float y) { if (pictureBox1.Image != null) { using (Bitmap pic = new Bitmap(pictureBox1.Image)) { g.DrawImage(pic, x, y, panelMain.Width, panelMain.Height); } } else { CustomDrawEventHandler eventHandle = Events[_customDraw] as CustomDrawEventHandler; if (eventHandle != null) { eventHandle(g, x, y, this, null); } } }