using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
class MainClass : Window
{
RadialGradientBrush brush;
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run(new MainClass());
}
public MainClass()
{
Title = "title";
brush = new RadialGradientBrush(Colors.White, Colors.Red);
brush.RadiusX = brush.RadiusY = 0.10;
brush.SpreadMethod = GradientSpreadMethod.Repeat;
Background = brush;
}
protected override void OnMouseDown(MouseButtonEventArgs args)
{
double width = 300;
double height = 300;
Point ptMouse = args.GetPosition(this);
ptMouse.X /= width;
ptMouse.Y /= height;
brush.Center = ptMouse;
brush.GradientOrigin = ptMouse;
}
}
|