c# 无边框窗体开发窗体伸缩功能1 protected override void WndProc(ref Message m)2 {3 switch (m.Msg)4 {5 case 0x84:6 base.WndPro...
c# 无边框窗体开发窗体伸缩功能
1 protected override void WndProc(ref Message m) 2 { 3 switch (m.Msg) 4 { 5 case 0x84: 6 base.WndProc(ref m); 7 Point lpint = new Point((int)m.LParam); 8 lpint.Offset(-Left, -Top); 9 Rectangle tBoder = new Rectangle(3, 0, Width-6, 3); 10 Rectangle lBorder = new Rectangle(0, 3, 3, Height-6); 11 Rectangle rBorder = new Rectangle(Width-3, 3, 3, Height-6); 12 Rectangle bBorder = new Rectangle(3, Height-3, Width-6, 3); 13 Rectangle tlBorder = new Rectangle(0, 0, 3, 3); 14 Rectangle tbBorder = new Rectangle(0, Height-3, 3, 3); 15 Rectangle trBorder = new Rectangle(Width-3, 0, 3, 3); 16 Rectangle brBorder = new Rectangle(Width - 3, Height-3, 3, 3); 17 if (tBoder.Contains(lpint))//上-缩放 18 { 19 m.Result = (IntPtr)0xC; 20 return; 21 } 22 if (lBorder.Contains(lpint))//左-缩放 23 { 24 m.Result = (IntPtr)0xA; 25 return; 26 } 27 if (rBorder.Contains(lpint))//右-缩放 28 { 29 m.Result = (IntPtr)0xB; 30 return; 31 } 32 if (bBorder.Contains(lpint))//下-缩放 33 { 34 m.Result = (IntPtr)0xF; 35 return; 36 } 37 if (tlBorder.Contains(lpint))//左上-缩放 38 { 39 m.Result = (IntPtr)0xD; 40 return; 41 } 42 if (tbBorder.Contains(lpint))//左下-缩放 43 { 44 m.Result = (IntPtr)0x10; 45 return; 46 } 47 if (trBorder.Contains(lpint))//右上-缩放 48 { 49 m.Result = (IntPtr)0xE; 50 return; 51 } 52 if (brBorder.Contains(lpint))//右下-缩放 53 { 54 m.Result = (IntPtr)0x11; 55 return; 56 } 57 return; 58 } 59 base.WndProc(ref m); 60 }View Code
沃梦达教程
本文标题为:C# 无边框窗体开发窗体伸缩功能(windows消息)
基础教程推荐
猜你喜欢
- C#提取PPT文本和图片的实现方法 2022-11-19
- VsCode使用EmmyLua插件调试Unity工程Lua代码的详细步骤 2023-06-28
- C# 7.0 使用下划线忽略使用的变量的原因分析 2023-01-06
- c#-在Windows Store应用中使用MIDI(Win 8.1) 2023-11-27
- C#把DataTable导出为Excel文件 2023-05-30
- C#泛型集合类System.Collections.Generic 2023-06-05
- c# Newtonsoft 六个值得使用的特性(上) 2023-03-03
- Unity3D使用UGUI开发原生虚拟摇杆 2023-02-16
- Unity实现切割图集工具 2023-04-21
- LINQ操作符SelectMany的用法 2023-05-23