摘要: 界面1内设定点击事件,生成Path用事件传出public partial class TemplateWindow : Window { internal delegate void ConfirmButtonClick(string Path); /// <summary> /// 点击确定按钮事 阅读全文
posted @ 2018-03-06 18:36 程序猿kid 阅读(335) 评论(0) 推荐(0) 编辑
摘要: 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中为 &#13; 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) 编辑
摘要: //截图 RenderTargetBitmap RenderVisaulToBitmap(Visual vsual, int width, int height) { var rtb = new RenderTargetBitmap(width, height, 96, 96, PixelForma 阅读全文
posted @ 2018-03-06 18:05 程序猿kid 阅读(303) 评论(0) 推荐(0) 编辑
摘要: XAML代码 < TextBox Height="23" HorizontalAlignment="Left" Margin="100,5,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" DataObject.Pasting="tex 阅读全文
posted @ 2018-03-06 18:04 程序猿kid 阅读(500) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/WangJinYang/p/3553792.html写的很好转了 阅读全文
posted @ 2018-03-06 17:25 程序猿kid 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Regex r = new Regex("abc"); // 定义一个Regex对象实例(Regex r = new Regex("abc", RegexOptions.IgnoreCase);//不区分大小写的正则) Match m = r.Match("123abc456"); // 在字符串中 阅读全文
posted @ 2018-03-06 17:24 程序猿kid 阅读(345) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 二分法查找 /// </summary> /// <param name="arr"></param> /// <param name="key">要查找的对象</param> public static int BinarySearch(int[] arr,in 阅读全文
posted @ 2018-03-06 17:24 程序猿kid 阅读(3214) 评论(0) 推荐(0) 编辑
摘要: string 转换成 Char[] string ss = "abcdefg"; char[] cc = ss.ToCharArray(); Char[] 转换成string string s = new string(cc); 此外,byte[] 与 string 之间的装换 byte[] bb 阅读全文
posted @ 2018-03-06 17:23 程序猿kid 阅读(2246) 评论(0) 推荐(0) 编辑
摘要: 字符串:string s = "1,2,3,4,5," 目标:删除最后一个 "," 方法:1、用的最多的是Substring,这个也是我一直用的s = s.Substring(0,s.Length - 1)2、用TrimEnd,这个东西传递的是一个字符数组 s=s.TrimEnd(',')//如果要 阅读全文
posted @ 2018-03-06 17:22 程序猿kid 阅读(31994) 评论(1) 推荐(1) 编辑
摘要: stream byte 等各类转换 http://www.cnblogs.com/warioland/archive/2012/03/06/2381355.html using (System.Net.WebClient wc = new System.Net.WebClient()) { wc.D 阅读全文
posted @ 2018-03-06 17:21 程序猿kid 阅读(490) 评论(0) 推荐(0) 编辑
摘要: private bool DownloadPicture(string picUrl, string savePath, int timeOut) { bool value = false; WebResponse response = null; Stream stream = null; try 阅读全文
posted @ 2018-03-06 17:19 程序猿kid 阅读(160) 评论(0) 推荐(0) 编辑