我想用这种方法面板绘制: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