日期:2014-05-17 浏览次数:20821 次
messageGDI { PaintEventArgs p; Image Button_Default = Image.FromFile(Application.StartupPath + @"\skin_default\message\ico.png");; //一个button函数(主要是实现按钮绘制) public void button(string st,int x, int y) { Rectangle rect = new Rectangle(x,y,69,22); p.Graphics.DrawImage(Button_Default, rect); rect = new Rectangle(x + 20, y + 5, 69 , 22); p.Graphics.DrawString(st, new Font("宋体", 10), Brushes.Black, rect); } }
private void message_Paint(object sender, PaintEventArgs e) { messageGDI MessageForm = new messageGDI(); MessageForm._PainEventArgs = e;//我直接将paintEventArgs传进去。 MessageForm.button("确定",100,100);//重绘窗体,添加一个类似的按钮。 }