桌面应用程序中的OOP

3 本我 16小时前 50次点击

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;

namespace 录音1

{

///

/// MainWindow.xaml 的交互逻辑

///

public partial class MainWindow : Window

{

public MainWindow()

{

InitializeComponent();

}

private void button_Click(object sender, RoutedEventArgs e)

{

((Button)sender).Content = "点击";

Button 新按钮 = new Button();

新按钮.Content = "新按钮";

新按钮.Margin = new Thickness(10,10,200,200);

新按钮.Click += 新按钮点击;

((Grid)((Button)sender).Parent).Children.Add(新按钮);

}

private void 新按钮点击(object sender, RoutedEventArgs e)

{

((Button)sender).Content = "新新按钮";

}

}

}


共 1 条评论
汪汪 16小时前
0 

然后可以弄好多个按钮哈哈


本楼来自:论坛助手
添加一条新评论

登录后可以发表评论 去登录