我已经画好了一个有刻度的线段,现在想重新画几根一摸一样的线条,组成一个米子图案,应该怎么处理啊 private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics; Pen pen = new Pen(Brushes.Blue);
//初始半径
float r0 = 20;
//圆心
float x0 = 140;
float y0 = 140; //圆的宽度和高度
float width = 0;
float height = 0;
float x = 100;
float y = 100;
//圆半径的递增数量
float d = 2 * r0;
//画圆
for (int i = 0; i < 3; i++)
{
//计算当前圆的宽度和高度
width = (r0 + d * i) * 2;
height = (r0 + d * i) * 2;
//计算当前圆的左上角顶点坐标
x = x0 - width / 2;
y = y0 - height / 2;
//画圆
g.SmoothingMode = SmoothingMode.AntiAlias;
g.DrawEllipse(pen, x, y, width, height);
}
//画刻度条
pen.Color = Color.Black;//黑笔画线
g.DrawLine(pen, x0 - 5 * r0 - 2 * r0 / 5, y0, x0 - 3 * r0 / 5, y0);//线条
//画刻度
for (int j = 0; j < 8; j++)
{
for (int i = 0; i < 13; i++)
{
if (i % 6 == 0)
{
g.DrawLine(pen, x0 - 5 * r0 - 2 * r0 / 5 + 2 * r0 * i / 5, (float)(y0 - 1.5 * r0 / 5), x0 - 5 * r0 - 2 * r0 / 5 + 2 * r0 * i / 5, (float)(y0 + 1.5 * r0 / 5));
}
else
{
g.DrawLine(pen, x0 - 5 * r0 - 2 * r0 / 5 + 2 * r0 * i / 5, y0 - r0 / 5, x0 - 5 * r0 - 2 * r0 / 5 + 2 * r0 * i / 5, y0 + r0 / 5);
}
}
}
}
{
Graphics g = e.Graphics; Pen pen = new Pen(Brushes.Blue);
//初始半径
float r0 = 20;
//圆心
float x0 = 140;
float y0 = 140; //圆的宽度和高度
float width = 0;
float height = 0;
float x = 100;
float y = 100;
//圆半径的递增数量
float d = 2 * r0;
//画圆
for (int i = 0; i < 3; i++)
{
//计算当前圆的宽度和高度
width = (r0 + d * i) * 2;
height = (r0 + d * i) * 2;
//计算当前圆的左上角顶点坐标
x = x0 - width / 2;
y = y0 - height / 2;
//画圆
g.SmoothingMode = SmoothingMode.AntiAlias;
g.DrawEllipse(pen, x, y, width, height);
}
//画刻度条
pen.Color = Color.Black;//黑笔画线
g.DrawLine(pen, x0 - 5 * r0 - 2 * r0 / 5, y0, x0 - 3 * r0 / 5, y0);//线条
//画刻度
for (int j = 0; j < 8; j++)
{
for (int i = 0; i < 13; i++)
{
if (i % 6 == 0)
{
g.DrawLine(pen, x0 - 5 * r0 - 2 * r0 / 5 + 2 * r0 * i / 5, (float)(y0 - 1.5 * r0 / 5), x0 - 5 * r0 - 2 * r0 / 5 + 2 * r0 * i / 5, (float)(y0 + 1.5 * r0 / 5));
}
else
{
g.DrawLine(pen, x0 - 5 * r0 - 2 * r0 / 5 + 2 * r0 * i / 5, y0 - r0 / 5, x0 - 5 * r0 - 2 * r0 / 5 + 2 * r0 * i / 5, y0 + r0 / 5);
}
}
}
}
解决方案 »
- 急急急!!C#调用C++的回调函数时,出现“0x0000”指令引用的"0x00000“内存。该内存不能为"read"
- 关于LDAP验证用户登录帐号的问题!
- 2003下写的程序,无法在win2000上运行
- 图象交换 怎么实现??
- 复制一段网页内容(包括图片,链接等),用什么方法可以在winform里面把复制的内容粘贴过来呢?(就像word一样)
- 如何在DataGride中帮定DropDown ?
- “无法从传输连接中读取数据。”请大家帮忙,谢谢。
- 不用key获得SortedDictionary中的value
- C# 粘包怎么解决
- 怎样将对象引用转化成对象实例?
- 做坦克游戏,用keydown不能同时相应2个按键怎么办?
- C/S 连接网络设置
起点,终点,旋转角度,顺时针或者逆时针方向旋转.
http://topic.csdn.net/u/20091104/09/30413a6a-cc19-42c5-a9e6-fc8bbc884469.html