ورود

View Full Version : رسم اشکال با DrawingVisual



cpppro
پنج شنبه 15 خرداد 1393, 08:21 صبح
با سلام
آیا کسی تا حالا از DrawingVisual برای رسم اشکال استفاده کرده ؟
من فعلا تو شروع کار باهاش تونستم اشکالی رو رسم کنم ولی تو تغییر مکان جسم یا تغییر اندازه ی اون بعد از ایجاد و ... موندم.
اگه کسی کمک کنه بسیار لطف کرده.


public void Draw(Point firstPoint,Point endPoint)
{
children_vc = new VisualCollection(this);
visual = new DrawingVisual();
children_vc.Add(visual);

using (var dc = visual.RenderOpen())
{
dc.DrawRectangle(drawingBrush, drawingPen, new Rect(firstPoint, endPoint));
}
}

PouriaParhami
یک شنبه 12 مرداد 1393, 08:48 صبح
سلام برای رسم شکل در WPF من به این شکل عمل می کنم
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera Position="-40,40,40" LookDirection="40,-40,-40 "
UpDirection="0,0,1" />
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<Model3DGroup>
<DirectionalLight Color="White" Direction="-1,-1,-3" />
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D Positions="0,0,0 10,0,0 10,10,0 0,10,0 0,0,10
10,0,10 10,10,10 0,10,10"
TriangleIndices="0 1 3 1 2 3 0 4 3 4 7 3 4 6 7 4 5 6
0 4 1 1 4 5 1 2 6 6 5 1 2 3 7 7 6 2"/>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial Brush="Red"/>
</GeometryModel3D.Material>
</GeometryModel3D>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
</Viewport3D>
سایت منبع http://www.wpftutorial.net/IntroductionTo3D.html