解决方案 »
- 这里是不是比vb那面人多些——如何实现两个动态库中的类互相引用
- 打印报表时,checkbox勾选的问题
- 大家多线程同步都是怎么做的
- 用循环给combobox添加DisplayMember属性?
- 没有为任何调用堆栈框架加载任何符号。无法显示源代码
- C#如何读取ind文件数据
- 如何在c#中捕获从dll文件中调用监视函数发送来的消息,分不够可再加
- 请问 List类怎么用?
- Silverlight Tools 4安装时的错误提示
- 课程设计结束,总结一下!遇到几个问题,大家帮忙!! (gbl777 )
- VS2008读取Excel文本信息不全的问题
- Cookie字符串怎么转为Cookie对象附加给Response.Cookies上
调用pictureBox1.Refresh()是强行刷新
{
pictureBox.Refresh();
}
{
Graphics g = e.Graphics ;Pen pen=new Pen (Color .Blue,3);Point p=new Point (3,3);
Point q = new Point(5, 5);
ge.graphics.DrawLine(pen, p, q);} private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1.Invalidate();
this.pictureBox1 .Update();}}
先画到图上是什么意思呀?其实我也不一定要画到picturebox上,panel什么的都可以,只要不画到form上就好了
再借地问一下,刚才用
protected override void Onpaint(PaintEventArgs e)
{
...
}
就能在窗体上画出来,这是为什么呢
~~~~(>_<)~~~~ 还是不行,为什么要删掉Graphics g = e.Graphics 呢
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen pen = new Pen(Color.Blue, 3);
Point p = new Point(3, 3);
Point q = new Point(i, j);
g.DrawLine(pen, p, q);
} private void button1_Click(object sender, EventArgs e)
{
i = 20;
j = 30;
pictureBox1.Refresh();
}可以变化
Using G as graphics=graphics.fromimage(B)
dim P as point= new point(3,3)
dim q as point=new point(5,5)
dim pen as pen=new pen(color.blue,3)
G.DrawLinde(pen,p,q)
end using
picturebox1.Image=B
end using
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1.Refresh(); }
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics ;
Pen pen=new Pen (Color .Blue,3);
Point p=new Point (3,3);
Point q = new Point(5, 5);
g .DrawLine(pen, p, q);
}
}
}这是我完整的程序了,大家能帮我看看么,点button什么也没有
这个不通,后面的程序我都写不下去啊
谢谢大家了
using (bitmap B = new bitmap(picturebox1.width, picturebox1.height)) {
using (graphics G = graphics.fromimage(B)) {
point P = new point(3, 3);
point q = new point(5, 5);
pen pen = new pen(color.blue, 3);
G.DrawLinde(pen, P, q);
}
picturebox1.Image = B;
}
{
Graphics g = e.Graphics ;
Pen pen=new Pen (Color .Blue,3);
Point p=new Point (3,3);
Point q = new Point(5, 5);
g.DrawLine(pen, p, q);
} private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1.Refresh();
}这个不应该有问题。