文档彩票走势图>>VectorDraw Developer Framework使用教程>>VDF常见问题整理(七):如何正确绘制具有PenWidth的圆?
VDF常见问题整理(七):如何正确绘制具有PenWidth的圆?
VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。
VectorDraw Developer Framework试用版下载
问:
在Shade / Render / Wire3D模式下,如何才能正确绘制具有PenWidth的圆?
答:
面对这个问题,我们需要先检查是否可以用OpenGL(这个圆圈的4个边缘)来解决这个圆的笔宽问题,如果发现由于OpenGL限制无法解决这个问题。那么,就建议避免使用带有penwidth的圆/椭圆/弧等对象,而是使用Hatch对象,例如:
vdCircle cir = new vdCircle(); // assume that this is the circle with penwidth inside your block. cir.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument); cir.setDocumentDefaults(); cir.Center = new gPoint(3,3); cir.Radius=2; cir.PenWidth = .5; cir.PenColor.SystemColor = Color.Green; vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.AddItem(cir); vdCircle cir1 = new vdCircle(); cir1=cir.Clone(vdFramedControl1.BaseControl.ActiveDocument) as vdCircle; cir1.Radius = cir.Radius - cir.PenWidth / 2.0; vdCircle cir2 = new vdCircle(); cir2 = cir.Clone(vdFramedControl1.BaseControl.ActiveDocument) as vdCircle; cir2.Radius = cir.Radius + cir.PenWidth / 2.0; vdPolyhatch hatch = new vdPolyhatch(); // replace the circle with this object hatch.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument); hatch.setDocumentDefaults(); VectorDraw.Professional.vdCollections.vdCurves curs = new VectorDraw.Professional.vdCollections.vdCurves(); curs.AddItem(cir1); curs.AddItem(cir2); hatch.HatchProperties = new vdHatchProperties(VdConstFill.VdFillModeSolid); hatch.HatchProperties.DrawBoundary = false; hatch.HatchProperties.FillColor = cir.PenColor; hatch.PolyCurves.AddItem(curs); vdFramedControl1.BaseControl.ActiveDocument.Model.Entities.AddItem(hatch);