Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Shapes;
- namespace ClearspanSilverlight
- {
- public partial class MainPage : UserControl
- {
- public void CreateARectangle()
- {
- // Create a Rectangle
- Rectangle blueRectangle = new Rectangle();
- blueRectangle.Height = 100;
- blueRectangle.Width = 200;
- // Create a blue and a black Brush
- SolidColorBrush blueBrush = new SolidColorBrush();
- blueBrush.Color = Colors.Blue;
- SolidColorBrush blackBrush = new SolidColorBrush();
- blackBrush.Color = Colors.Black;
- // Set Rectangle's width and color
- blueRectangle.StrokeThickness = 4;
- blueRectangle.Stroke = blackBrush;
- // Fill rectangle with blue color
- blueRectangle.Fill = blueBrush;
- // Add Rectangle to the Grid.
- LayoutRoot.Children.Add(blueRectangle);
- }
- public MainPage()
- {
- CreateARectangle();
- InitializeComponent();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement