在GDI+ 绘图中,如何将画面上的东西的问题。 我现在要绘制一附图片,上面有一条线,一个点,其中线的位置在没有人工干预时是不动的,而点的坐标随时间的变化而变化,我怎样才能够将绘点与绘线的频次分开?即在绘图平面上只绘制坐标(或位置)变化的部分? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 调用Control的Invalidate(Rectangle)方法,其中Rectangle属性输入包含这个点,或线的一个矩形 首先感谢LorenLiu 帮忙,但上面的描述能否再详细些?我没有明白您的意思望能再指导一下!谢谢。 你看看下面的代码是否你所需求的?public partial class Form1 : Form { public Form1() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); mTimer = new Timer(); mTimer.Interval = 500; mTimer.Tick += new EventHandler(mTimer_Tick); mTimer.Start(); } protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); mTimer.Stop(); mTimer.Dispose(); } void mTimer_Tick(object sender, EventArgs e) { mPointLocation = new Point(mPointLocation.X + 1, mPointLocation.Y + 1); // 刷新点周围的矩形 this.Invalidate(new Rectangle(mPointLocation.X - 1, mPointLocation.Y - 1, 2, 2)); } Timer mTimer; Point mPointLocation = new Point(0, 0); protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.DrawLine(Pens.Black, new Point(10, 10), new Point(15, 100)); e.Graphics.DrawRectangle(Pens.Red, mPointLocation.X, mPointLocation.Y, 1, 1); } } 帮我找茬,谢谢~~~急!! GridView控件显示问题 新年小声的问一句:怎么NumericUpDown hide 掉UpDown 显示正常 怎样选中CheckBox同时全部选中CheckedListBox? 如何确定dv.RowFilter的返回结果是否有值? 问:显示登陆框后,点击登陆,登陆框消失,主窗体显示一刷.主窗体就不见了.但在任务管理器那里还有那个进程的?主窗体跑哪去了? DataGridView显示问题 程序应该怎么写 系统关不了的程序!! 无法找到脚本库的问题 关于数据库的配置文件 请问.NET 里有没有一个快捷键能找出一个{所对应的},谢谢。
但上面的描述能否再详细些?我没有明白您的意思望能再指导一下!
谢谢。
{
public Form1()
{
InitializeComponent();
} protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
mTimer = new Timer();
mTimer.Interval = 500;
mTimer.Tick += new EventHandler(mTimer_Tick);
mTimer.Start();
} protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
mTimer.Stop();
mTimer.Dispose();
} void mTimer_Tick(object sender, EventArgs e)
{
mPointLocation = new Point(mPointLocation.X + 1, mPointLocation.Y + 1);
// 刷新点周围的矩形
this.Invalidate(new Rectangle(mPointLocation.X - 1, mPointLocation.Y - 1, 2, 2));
} Timer mTimer;
Point mPointLocation = new Point(0, 0); protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawLine(Pens.Black, new Point(10, 10), new Point(15, 100));
e.Graphics.DrawRectangle(Pens.Red, mPointLocation.X, mPointLocation.Y, 1, 1);
}
}