摘要: private void Init() { BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (s, e) => { this.MainStackPanel.Dispatcher.BeginInvoke(System 阅读全文
posted @ 2018-03-06 18:35 程序猿kid 阅读(679) 评论(0) 推荐(0) 编辑
摘要: 在窗口界面的一个控件(TopGrid)设置如下MouseLeftButtonDown事件即可 private void TopGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { this.DragMove() 阅读全文
posted @ 2018-03-06 18:34 程序猿kid 阅读(852) 评论(0) 推荐(0) 编辑
摘要: //设置一个下载事件类,可传输一个字符串 public class DownloadEventArgs:EventArgs { public string id { get; set; } public DownloadEventArgs(string m) { id = m; } } //下载中事 阅读全文
posted @ 2018-03-06 18:32 程序猿kid 阅读(211) 评论(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 阅读(11602) 评论(0) 推荐(0) 编辑
摘要: Button Button = new Button();Button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));//在按钮生成时便会自动触发Click事件 阅读全文
posted @ 2018-03-06 18:29 程序猿kid 阅读(1601) 评论(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 阅读(748) 评论(1) 推荐(0) 编辑
摘要: WPF中UI上和后台代码中的换行符不同。 其中: XAML中为 
 C#代码中为 \r\n或者: Environment.NewLine 阅读全文
posted @ 2018-03-06 18:14 程序猿kid 阅读(980) 评论(0) 推荐(0) 编辑
摘要: <UserControl MouseRightButtonDown="UserControl_MouseRightButtonDown" > <UserControl.ContextMenu > <ContextMenu Name="menu"> <MenuItem Header="删除" Clic 阅读全文
posted @ 2018-03-06 18:11 程序猿kid 阅读(250) 评论(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 阅读(190) 评论(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 阅读(389) 评论(0) 推荐(0) 编辑