学海无涯

导航

随笔分类 -  WinForms

在 WinForms 应用程序中处理未经处理的异常
摘要:internal static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { // 添加事件处理程序以捕获主UI线程中发生的所有异常 Application.T 阅读全文

posted @ 2024-05-11 14:02 宁静致远. 阅读(31) 评论(0) 推荐(0)

WinForm 程序中控件坐标之间的转换
摘要:控件坐标系和屏幕坐标系之间的转换: 如果要将一个控件上的点(例如Label或Button)的坐标(x, y)转换为屏幕上的点(x1, y1),可以使用Control.PointToScreen方法。例如: Point controlPoint = new Point(x, y); Point scr 阅读全文

posted @ 2024-03-31 12:13 宁静致远. 阅读(309) 评论(0) 推荐(0)

打开文件,保存文件
摘要:private void ShowNewForm(object sender, EventArgs e) { Form childForm = new Form(); childForm.MdiParent = this; childForm.Text = "窗口 " + childFormNumb 阅读全文

posted @ 2023-09-02 11:34 宁静致远. 阅读(25) 评论(0) 推荐(0)

HttpClient
摘要:var httpClient = new HttpClient(); var url = new Uri("http://localhost:57679/api/Technology/All"); var response = httpClient.GetAsync(url).Result; if( 阅读全文

posted @ 2023-09-01 09:03 宁静致远. 阅读(42) 评论(0) 推荐(0)