public Form1()
{
InitializeComponent();
pictureBox1.Paint += new PaintEventHandler(pictureBox1_Click);
} void pictureBox1_Click(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen p = new Pen(Color.Black, 1);
g.DrawEllipse(p, 9, 11, 70, 72);
g.DrawLine(p, 45, 20, 45, 40);
} 这段VS08的代码里,怎样把直线抓图来制成图片,再旋转?
谢谢各位大虾!!
{
InitializeComponent();
pictureBox1.Paint += new PaintEventHandler(pictureBox1_Click);
} void pictureBox1_Click(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen p = new Pen(Color.Black, 1);
g.DrawEllipse(p, 9, 11, 70, 72);
g.DrawLine(p, 45, 20, 45, 40);
} 这段VS08的代码里,怎样把直线抓图来制成图片,再旋转?
谢谢各位大虾!!
{
Graphics gg = e.Graphics;
gg.TranslateTransform(center.X, center.Y);//重定义坐标原点,center.X,center.Y,旋转原点自己定 gg.RotateTransform(angle);//旋转坐标轴 Pen SecPen = new Pen(Color.Black, 2); gg.DrawLine(SecPen, 0, 0, 0, 100);//画直线
}在picturebox范围里面画直线,angle是角度,用计时器控制它,就能让直线转起来 /// <summary>
/// 旋转计时器
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timerrotate_Tick(object sender, EventArgs e)
{
angle+=10f; pictureBox1.Invalidate();
}
{
if (SaveDig.ShowDialog() == DialogResult.OK)
{
Image Img = new Bitmap(Rect.Width, Rect.Height);
Graphics g = Graphics.FromImage(Img);
g.DrawLine(参数);
Img.Save(SaveDig.FileName);
}
}
rect是你图形的区域,就这样,区域可以从各个点来判断