November 2, 2007
鼓勵此網誌:1
繼承自 Simple Paint Object 測試
:
public class TestSimplePaintObject : SimplePaintObject
{
public TestSimplePaintObject()
{
}
// 繼承時,使用 override 以取代父類別的 MyPaint
protected override void MyPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
// Obtain the Graphics object
Graphics g = e.Graphics;
// Set the smoothing mode of the surface
g.SmoothingMode = SmoothingMode.AntiAlias;
// Paint it
Rectangle r = this.ClientRectangle;
r.Height--;
r.Width--;
g.DrawEllipse(Pens.Red, r); // 改成畫紅色橢圓測試繼承
}
}
效果如預期
:








