با عرض سلام و خسته نباشید خدمت کاربران وب سایت پروگرم 98 😉 در این مطلب از وب سایت پروگرم 98 کد ساخت StackPanel به عنوان محتوا (content) یک دکمه با wpf و #C را آماده کردم. انشاالله که این آموزش برای شما مفید باشد.
کد ساخت StackPanel به عنوان محتوا (content) یک دکمه با wpf و #C :
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
public class MainClass : Window
{
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run(new MainClass());
}
public MainClass()
{
Button btn = new Button();
btn.HorizontalAlignment = HorizontalAlignment.Center;
btn.VerticalAlignment = VerticalAlignment.Center;
btn.Click += ButtonOnClick;
Content = btn;
StackPanel stack = new StackPanel();
btn.Content = stack;
Polyline poly = new Polyline();
poly.Stroke = SystemColors.ControlTextBrush;
poly.Points = new PointCollection();
for (int x = 0; x <= 100; x += 10)
poly.Points.Add(new Point(x, (x + 10) % 20));
stack.Children.Add(poly);
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
public class MainClass : Window
{
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run(new MainClass());
}
public MainClass()
{
Button btn = new Button();
btn.HorizontalAlignment = HorizontalAlignment.Center;
btn.VerticalAlignment = VerticalAlignment.Center;
btn.Click += ButtonOnClick;
Content = btn;
StackPanel stack = new StackPanel();
btn.Content = stack;
Polyline poly = new Polyline();
poly.Stroke = SystemColors.ControlTextBrush;
poly.Points = new PointCollection();
for (int x = 0; x <= 100; x += 10)
poly.Points.Add(new Point(x, (x + 10) % 20));
stack.Children.Add(poly);