摘要: private void Init() { BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (s, e) => { this.MainStackPanel.Dispatcher.BeginInvoke(System 阅读全文
posted @ 2018-03-06 18:35 程序猿kid 阅读(731) 评论(0) 推荐(0)
摘要: 在窗口界面的一个控件(TopGrid)设置如下MouseLeftButtonDown事件即可 private void TopGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { this.DragMove() 阅读全文
posted @ 2018-03-06 18:34 程序猿kid 阅读(869) 评论(0) 推荐(0)
摘要: //设置一个下载事件类,可传输一个字符串 public class DownloadEventArgs:EventArgs { public string id { get; set; } public DownloadEventArgs(string m) { id = m; } } //下载中事 阅读全文
posted @ 2018-03-06 18:32 程序猿kid 阅读(222) 评论(0) 推荐(0)
摘要: Button TempButton = new Button(); TempButton.Tag = “按钮标记”; TempButton.Height = 30; TempButton.Width = 100; TempButton.Style = this.FindResource("Butto 阅读全文
posted @ 2018-03-06 18:30 程序猿kid 阅读(11719) 评论(0) 推荐(0)
摘要: Button Button = new Button();Button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));//在按钮生成时便会自动触发Click事件 阅读全文
posted @ 2018-03-06 18:29 程序猿kid 阅读(1654) 评论(0) 推荐(0)
摘要: 1、利用浏览器打开using System.Diagnostics; Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = "http://www.baidu.com"; proc.Start(); 2、 阅读全文
posted @ 2018-03-06 18:26 程序猿kid 阅读(822) 评论(1) 推荐(0)
摘要: WPF中UI上和后台代码中的换行符不同。 其中: XAML中为 
 C#代码中为 \r\n或者: Environment.NewLine 阅读全文
posted @ 2018-03-06 18:14 程序猿kid 阅读(1066) 评论(0) 推荐(0)
摘要: <UserControl MouseRightButtonDown="UserControl_MouseRightButtonDown" > <UserControl.ContextMenu > <ContextMenu Name="menu"> <MenuItem Header="删除" Clic 阅读全文
posted @ 2018-03-06 18:11 程序猿kid 阅读(256) 评论(0) 推荐(0)
摘要: 方法一: Window window = new Window();window.ShowDialog;方法二: 设置一个判断窗口打开状态的全局控制变量 private bool isOpened = false; private void Button_Click(object sender, R 阅读全文
posted @ 2018-03-06 18:07 程序猿kid 阅读(200) 评论(0) 推荐(0)
摘要: 在选择的控件中添加KeyDown event method private void OnKeyDown(object sender, KeyEventArgs e){if (e.Key == Key.Space) { e.Handled = true; return; }} 在选择的控件中添加Ke 阅读全文
posted @ 2018-03-06 18:06 程序猿kid 阅读(444) 评论(0) 推荐(0)