PDA

View Full Version : کشیدن مثلث و نیم دایره در wpf



hhojjatt
دوشنبه 11 آبان 1388, 15:45 عصر
با کدام دستورات می توان مثلث و نیم دایره در canvas رسم کرد و شکل کلی انها چطور است لطفا کمی راهنمایی کنید ممنون

رضا عربلو
دوشنبه 11 آبان 1388, 20:27 عصر
فضای نام system.windows.shapes امکانات خوبی در اختیار شما قرار می دهید.
Shapes and Basic Drawing in WPF Overview (http://msdn.microsoft.com/en-us/library/ms747393.aspx)

hhojjatt
سه شنبه 12 آبان 1388, 06:53 صبح
دوست عزیز لطفا نام دستورات را بنویسید مثلا برای دایره ellips

رضا عربلو
سه شنبه 12 آبان 1388, 10:58 صبح
لینکی را که گذاشته ام حتماً مطالعه فرمایید. در همان لینک ellips همراه با مثال آورده شده است.



Another common shape is the Ellipse. Create an Ellipse by defining the shape's Width and Height properties. To draw a circle, specify an Ellipse whose Width and Height values are equal.
XAML Copy Code
<Ellipse
Fill="Yellow"
Height="100"
Width="200"
StrokeThickness="2"
Stroke="Black"/>

C# Copy Code
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
namespace SDKSample
{
public partial class SetBackgroundColorOfShapeExample : Page
{
public SetBackgroundColorOfShapeExample()
{
// Create a StackPanel to contain the shape.
StackPanel myStackPanel = new StackPanel();
// Create a red Ellipse.
Ellipse myEllipse = new Ellipse();
// Create a SolidColorBrush with a red color to fill the
// Ellipse with.
SolidColorBrush mySolidColorBrush = new SolidColorBrush();
// Describes the brush's color using RGB values.
// Each value has a range of 0-255.
mySolidColorBrush.Color = Color.FromArgb(255, 255, 255, 0);
myEllipse.Fill = mySolidColorBrush;
myEllipse.StrokeThickness = 2;
myEllipse.Stroke = Brushes.Black;
// Set the width and height of the Ellipse.
myEllipse.Width = 200;
myEllipse.Height = 100;
// Add the Ellipse to the StackPanel.
myStackPanel.Children.Add(myEllipse);
this.Content = myStackPanel;
}
}
}
The following image

hhojjatt
سه شنبه 12 آبان 1388, 11:09 صبح
دوست عزیز متشکرم استفاده کردم دستور ellips برای کشیدن دایره بود برای کشیدن نیم دایره و مثلث از چه دستوری استفاده کنم ممنون

رضا عربلو
سه شنبه 12 آبان 1388, 11:46 صبح
با path نیم دایره ات را بکش و با polygon مثلثت را.