请问怎样在picureBox中绘制矩形呢? 试了一下,可以在form上画出来,可是在PictureBox里面的图像上就画不出来! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 protected override void OnPaint(PaintEventArgs e) { e.Graphics.DrawRectangle(Pens.Red, 500 / 2, 500 / 2, 100, 100); e.Dispose(); } 自定义控件 继承自PictureBox在控件内重写OnPaint方法 画出来的矩形会被picturebox里面的图像挡住是怎么回事呢? picturebox的Paint事件中private Rectangle m_Rect; m_Rect = new Rectangle(10, 10, 100, 80); private void panel1_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawRectangle(SystemPens.HotTrack, this.m_Rect); } 如1楼重写OnPaint方法,但是在绘制之前加上 base.OnPaint(); using G as graphics=graphics.fromimage(picturebox1.backgroundimage)...end using Graphics g = this.pictureBox1.CreateGraphics(); g.DrawRectangle(new Pen(new SolidBrush(Color.Red)), 10, 10, 60, 30); windows2003下无法直接打开JPEG压缩格式的TIF? 求助,用VS创建一个新的数据库的时候没有服务器可以选择 .Net程序第一次运行慢如何解决? C# 删除快捷方式的问题 c#中substring()函数的用法 请问如何把tabcontrol中某一个tabpage变灰 如何使用panel?--等待! .Net开发技术群,QQ群号码:5835595,欢迎加入! 如何实现netstat -an具体数据的保存??? 请问如何将配置保存到硬盘(文件的读,写?) c#怎么强力杀进程啊?(祝看到此贴的朋友们圣诞快乐) 计划C#一万行,不知道写什么好。
{
e.Graphics.DrawRectangle(Pens.Red, 500 / 2, 500 / 2, 100, 100);
e.Dispose();
}
private Rectangle m_Rect;
m_Rect = new Rectangle(10, 10, 100, 80);
private void panel1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawRectangle(SystemPens.HotTrack, this.m_Rect);
}
...
end using
Graphics g = this.pictureBox1.CreateGraphics();
g.DrawRectangle(new Pen(new SolidBrush(Color.Red)), 10, 10, 60, 30);