110,535
社区成员
发帖
与我相关
我的任务
分享
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
int i, j, k;
Graphics g = e.Graphics;
Pen mypen = new Pen(Color.Yellow);
g.DrawLine(mypen, tempx_pre, tempy_pre, tempx, tempy);
}
private void timer1_Tick(object sender, EventArgs e)
{
pictureBox1.Refresh();//刷新
//下面是模拟UART获得的数值tempx,tempy。
tempx_pre = tempx;
if (tempx < 440)
{
tempx += 1;
}
else
{
tempx = 0;
}
tempy_pre = tempy;
if (tempy < 270)
{
tempy += 1;
}
else
{
tempy = 0;
}
}
Bitmap dst =new Bitmap((int)rct.Width, (int)rct.Height, pf);
g = Graphics.FromImage(dst);
g.Clear(bkColor);
g.TranslateTransform(-rct.X, -rct.Y);
g.RotateTransform(angle);
g.InterpolationMode = InterpolationMode.HighQualityBilinear;
g.DrawLine(...);
g.Dispose();
pictureBox1.Images=dst;