using System; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Reflection; namespace Cloud.RenderTheGraphic { public class RenderTheGraphic : Window { [STAThread] public static void Main() { Application app = new Application(); app.Run(new RenderTheGraphic()); } public RenderTheGraphic() { this.Title = "Cloud Orz"; SimpleEllipse elips = new SimpleEllipse(); elips.Width = 200; elips.Height = 200; elips.HorizontalAlignment = HorizontalAlignment.Right; elips.VerticalAlignment = VerticalAlignment.Top; Content = elips; } } class SimpleEllipse : FrameworkElement { protected override void OnRender(DrawingContext drawingContext) { drawingContext.DrawEllipse(Brushes.Blue, new Pen(Brushes.Red, 24), new Point(this.RenderSize.Width / 2, RenderSize.Height / 2), this.RenderSize.Width / 2, RenderSize.Height / 2); } } } 继续练习.....