C# 绘图
g.DrawArc(p, 10.5f, 10.4f, 100.5f, 200.3f, 0, 90);g.DrawArc(p, (float)p0.X ,(float)p0.Y ,(float)(p1.X-p0.X ) ,(float) (p1.Y-p0.Y ) ,0f,45f);
上面的代码有区别吗 p0和p1是决定矩形的
第一行代码可执行 而第二行代码会出现异常 --------------------编程问答-------------------- 异常为:
未处理 System.ArgumentException
Message="参数无效。"
Source="System.Drawing"
StackTrace:
在 System.Drawing.Graphics.CheckErrorStatus(Int32 status)
在 System.Drawing.Graphics.DrawArc(Pen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
在 Draw.Form1.tabPage2_MouseMove(Object sender, MouseEventArgs e) 位置 D:\C#程序设计\图形\基本图形类\Draw\Draw\Form1.cs:行号 76
在 System.Windows.Forms.Control.WmMouseMove(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
在 Draw.Program.Main() 位置 D:\C#程序设计\图形\基本图形类\Draw\Draw\Program.cs:行号 18
在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException: --------------------编程问答-------------------- 是不是p1.X-p0.X=0或p1.Y-p0.Y=0了? --------------------编程问答-------------------- 不要手动来弄了,建议你直接用 VS2010 及以上的 Chart 控件,这样方便! --------------------编程问答-------------------- 会不会是p0.X p0.Y p1.X p1.Y 定义时候有初始值么? 如果没有你后面操作的时候赋值失败的话,那就没值了、
希望对你有帮助.
补充:.NET技术 , C#