日期:2014-05-18  浏览次数:20792 次

GDI+ 绘制时钟问题
GDI+绘制时钟

for (int x = 0; x < 60; x++) //小刻度
{
  g.RotateTransform(6);//这里什么意思

  g.FillRectangle(Brushes.Black, new Rectangle(-2, h / (-2), 4, 10));//讲解一下这里的参数
}

------解决方案--------------------
時鐘是一個圓,所以你的刻度及顯示的字串需要用.RotateTransform()調整。
Rectangle有兩種建構方法,你所使用的表Rectangle(x, y, width, height)
------解决方案--------------------
参考
http://msdn.microsoft.com/zh-cn/library/system.drawing.graphics.rotatetransform(v=VS.80).aspx

http://msdn.microsoft.com/zh-cn/library/yysstebh(VS.80).aspx