用C#.net的GDI+画图,如何实现图像的旋转,比如直线,矩形,椭圆等等,用RotateTransform或者不用都可以
直线,矩形等等图形已经画出来了,现在是要实现旋转,90°就可以,不必太麻烦,最好能用RotateTransform实现,谢了...
直线,矩形等等图形已经画出来了,现在是要实现旋转,90°就可以,不必太麻烦,最好能用RotateTransform实现,谢了
展开
展开全部
using System.Drawing.Drawing2D;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 直线ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Refresh();
Graphics g = this.CreateGraphics();
Pen p = new Pen(Color.BlueViolet, 4);
p.DashStyle = DashStyle.DashDotDot;//虚线样式
p.StartCap = LineCap.RoundAnchor;
p.EndCap = LineCap.Round;//线帽样式
g.DrawLine(p, 50, 50, 200, 200);
}
private void 矩形ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Refresh();
Graphics g = this.CreateGraphics();
Pen p = new Pen(Color.BlueViolet, 4);
Rectangle rec = new Rectangle(50, 50, 200, 200);
g.DrawRectangle(p, rec);
}
private void 圆ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Refresh();
Graphics g = this.CreateGraphics();
Pen p = new Pen(Color.BlueViolet, 4);
Rectangle rec = new Rectangle(50, 50, 200, 200);
g.DrawEllipse(p, rec);
}
//里面的数适当改变一下就可以了! 需要用到MenuStrip控件!
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 直线ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Refresh();
Graphics g = this.CreateGraphics();
Pen p = new Pen(Color.BlueViolet, 4);
p.DashStyle = DashStyle.DashDotDot;//虚线样式
p.StartCap = LineCap.RoundAnchor;
p.EndCap = LineCap.Round;//线帽样式
g.DrawLine(p, 50, 50, 200, 200);
}
private void 矩形ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Refresh();
Graphics g = this.CreateGraphics();
Pen p = new Pen(Color.BlueViolet, 4);
Rectangle rec = new Rectangle(50, 50, 200, 200);
g.DrawRectangle(p, rec);
}
private void 圆ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Refresh();
Graphics g = this.CreateGraphics();
Pen p = new Pen(Color.BlueViolet, 4);
Rectangle rec = new Rectangle(50, 50, 200, 200);
g.DrawEllipse(p, rec);
}
//里面的数适当改变一下就可以了! 需要用到MenuStrip控件!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询