我想用這種方法面板繪製:C#繪製面板中
protected override void InitOutput(object output)
{
if (output is Control)
{
Control c = (Control)output;
g.FillRectangle(hb, 7, 10, 30 - 19, 5);
...
}
用文本我可以這樣做:
protected override void InitOutput(object output)
{
if (output is Control)
{
Control c = (Control)output;
lbl.Name = "lbl";
lbl.Size = new System.Drawing.Size(10, 10);
lbl.TabIndex = 5;
lbl.Text = "test";
panel.Location = new System.Drawing.Point(1, 1);
panel.Name = "panelSys";
panel.Size = new System.Drawing.Size(20, 20);
panel.TabIndex = 5;
panel.Controls.Add(lbl);
c.Controls.Add(panelSys);
}
希望你能幫助我 感謝
g從哪裏來的InitOutput方法?在繪畫事件之外拿着一個圖形對象可能不是最好的格式。嘗試在控件的Paint事件中完成所有繪畫。 – LarsTech 2011-06-10 18:21:49