private void m_pnlOrigShapeDrawing_MouseClick(object sender, MouseEventArgs e) { Graphics g = m_pnlOrigShapeDrawing.CreateGraphics(); if (e.Button == System.Windows.Forms.MouseButtons.Left) { OriginalShapeDrawing.DrawRectangle(e.X, e.Y, 30, 45, g); } else { OriginalShapeDrawing.DrawCircle(e.X, e.Y, 30, g); } }
public override void DrawCircle(Pen p, int x, int y, int radius, Graphics g) { OriginalShapeDrawing.DrawCircle(x, y, radius, g); }
// The Class OriginalShapeDrawing is the adaptee class. Notice that the interface // accepts the same parameters as the NewShapeDrawing class but that the Pen argument // is ignored when calling the adaptee. This is typical of adapter patterns. public override void DrawRectangle(Pen p, int x, int y, int width, int height, Graphics g) { OriginalShapeDrawing.DrawRectangle(x, y, width, height, g); }