Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using System.Windows.Shapes;
- namespace SmileyFace
- {
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- Ellipse face = new Ellipse
- {
- Width = 100,
- Height = 100,
- Stroke = Brushes.Black,
- Fill = Brushes.Yellow,
- StrokeThickness = 2
- };
- Canvas.SetLeft(face, 100);
- Canvas.SetTop(face, 100);
- canvas.Children.Add(face);
- Ellipse leftEye = new Ellipse
- {
- Width = 20,
- Height = 20,
- Stroke = Brushes.Black,
- Fill = Brushes.Black
- };
- Canvas.SetLeft(leftEye, 120);
- Canvas.SetTop(leftEye, 120);
- canvas.Children.Add(leftEye);
- Ellipse rightEye = new Ellipse
- {
- Width = 20,
- Height = 20,
- Stroke = Brushes.Black,
- Fill = Brushes.Black
- };
- Canvas.SetLeft(rightEye, 160);
- Canvas.SetTop(rightEye, 120);
- canvas.Children.Add(rightEye);
- Path smile = new Path
- {
- Stroke = Brushes.Black,
- StrokeThickness = 2,
- Data = new PathGeometry(new PathFigure[]
- {
- new PathFigure(new Point(120, 160), new PathSegment[]
- {
- new ArcSegment(new Point(180, 160), new Size(40, 20), 0, false, SweepDirection.Clockwise, true)
- }, false)
- })
- };
- canvas.Children.Add(smile);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement