怎么记录现在画板中窗口的位置 保存再打开文件 点击节点弹出相应的窗口 窗口也是显示在相同的位置(弹出的窗口是自定义控件)

winform记录窗口的位置和大小
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- threenewbee 2020-02-12 21:45关注
formclosing事件里面写 try { string s = string.Format("{0},{1},{2},{3}", Top, Left, Height, Width); System.IO.File.WriteAllText("pos.ini", s); } catch { } 在load事件里面写 try { string s = System.IO.File.ReadAllText("pos.ini"); int[] pos = s.Split(',').Select(x => int.Parse(x)).ToArray(); Top = pos[0]; Left = pos[1]; Height = pos[2]; Width = pos[3]; } catch {}
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报