04/08/05 00:33
コントロールのクライアント領域について質問です。
以下のような Panel を継承したクラスをつくりました。
public class PanelEx : System.Windows.Forms.Panel
{
public PanelEx() { }
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
Pen p = new Pen(Color.Black, 1);
e.Graphics.DrawRectangle(p, this.ClientRectangle);
p.Dispose();
}
}
この PanelEX クラスのインスタンスを、普通に Form1 の
コンストラクタ内で生成したところ、画面には PanelEx の
左側と上側にしか線がひかれません。
なぜでしょうか?また、どうすればちゃんと矩形が描かれますか?