C# c wpf 2d图形-查找教程/示例

C# c wpf 2d图形-查找教程/示例,c#,wpf,graphics,2d,C#,Wpf,Graphics,2d,你能给我指一个很好的C教程吗?它可以用来绘制二维图形,比如椭圆和矩形,这些图形是使用WPF从画布上的形状继承而来的? 稍后我还对单击形状和识别单击的形状感兴趣,并在画布上拖放形状。 谢谢大家! 谢谢你的链接。 您能告诉我,为了编译和运行此程序,我应该在Visual Studio中启动什么样的项目吗 MSDN有一个非常好的概述 有关处理单击形状的信息,请参见 using System; using System.Windows; using System.Windows.Controls; usi

你能给我指一个很好的C教程吗?它可以用来绘制二维图形,比如椭圆和矩形,这些图形是使用WPF从画布上的形状继承而来的? 稍后我还对单击形状和识别单击的形状感兴趣,并在画布上拖放形状。 谢谢大家!

谢谢你的链接。 您能告诉我,为了编译和运行此程序,我应该在Visual Studio中启动什么样的项目吗


MSDN有一个非常好的概述

有关处理单击形状的信息,请参见

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;
        }

    }
}