[PR]
×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
プログラミング、3DCGとその他いろいろについて
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
using System.Windows;
using System.Windows.Media;
class Program
{
[System.STAThread]
public static void Main()
{
Window window = new Window
{
Title = "WPF Window",
Width = 300,
Height = 300,
Background = new DrawingBrush
{
Drawing = new GeometryDrawing
{
Brush = new RadialGradientBrush(Colors.LightGray, Colors.SlateGray),
Pen = new Pen(Brushes.Black, 0.1),
Geometry = new GeometryGroup
{
Children = {
new RectangleGeometry(new Rect(0, 0, 1, 1), 0, 0)
}
}
}
}
};
Application app = new Application();
app.Run(window);
}
}
using System.Windows;
using System.Windows.Media;
class Program
{
[System.STAThread]
public static void Main()
{
Window window = new Window();
window.Title = "WPF Window";
window.Width = 300;
window.Height = 300;
DrawingBrush brush = new DrawingBrush();
GeometryDrawing drawing = new GeometryDrawing();
GeometryGroup geometry = new GeometryGroup();
geometry.Children.Add(
new RectangleGeometry(new Rect(0, 0, 1, 1), 0, 0)
);
drawing.Geometry = geometry;
drawing.Brush = new RadialGradientBrush(Colors.LightGray, Colors.SlateGray);
drawing.Pen = new Pen(Brushes.Black, 0.1);
brush.Drawing = drawing;
window.Background = brush;
Application app = new Application();
app.Run(window);
}
}
ここで一番最初のサンプルの方を見ると美しさに息を呑みます!
すばらしい!!
WPFを使うときにはObject Initializerを積極的に使っていくべきでしょうね。