سلام بر تمامی برنامه نویسان #C 😉 در این مطلب از وب سایت پروگرم 98 کد قراردادن brush برای Window background با wpf و سی شارپ را آماده کردم. امیدوارم که این کد برای شما مفید باشد.
کد قراردادن brush برای Window background با wpf و سی شارپ :
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
class MainClass: Window
{
LinearGradientBrush brush;
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run(new MainClass());
}
public MainClass()
{
Title = "title";
SizeChanged += WindowOnSizeChanged;
brush = new LinearGradientBrush(Colors.Red, Colors.Blue, 0);
brush.MappingMode = BrushMappingMode.Absolute;
Background = brush;
}
void WindowOnSizeChanged(object sender, SizeChangedEventArgs args)
{
double width = 200;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
class MainClass: Window
{
LinearGradientBrush brush;
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run(new MainClass());
}
public MainClass()
{
Title = "title";
SizeChanged += WindowOnSizeChanged;
brush = new LinearGradientBrush(Colors.Red, Colors.Blue, 0);
brush.MappingMode = BrushMappingMode.Absolute;
Background = brush;
}
void WindowOnSizeChanged(object sender, SizeChangedEventArgs args)
{
double width = 200;