国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

WinForm特效:桌面上的遮罩層

2019-11-17 02:52:48
字體:
來源:轉載
供稿:網(wǎng)友
WinForm特效:桌面上的遮罩層

一個窗體特效,幫你了解幾個windows api函數(shù).效果:windows桌面上增加一個簡單的遮罩層,其中WS_EX_TRANSPARENT 比較重要,它實現(xiàn)了鼠標穿透的功能。

[csharp]view plaincopy
  1. usingSystem;
  2. usingSystem.Drawing;
  3. usingSystem.Windows.Forms;
  4. usingSystem.Runtime.InteropServices;
  5. namespaceWindowsapplication40
  6. {
  7. publicpartialclassForm1:Form
  8. {
  9. publicForm1()
  10. {
  11. InitializeComponent();
  12. }
  13. [DllImport("user32.dll",EntryPoint="GetWindowLong")]
  14. publicstaticexternlongGetWindowLong(IntPtrhwnd,intnIndex);
  15. [DllImport("user32.dll",EntryPoint="SetWindowLong")]
  16. publicstaticexternlongSetWindowLong(IntPtrhwnd,intnIndex,longdwNewLong);
  17. [DllImport("user32",EntryPoint="SetLayeredWindowAttributes")]
  18. PRivatestaticexternintSetLayeredWindowAttributes(IntPtrHandle,intcrKey,bytebAlpha,intdwFlags);
  19. constintGWL_EXSTYLE=-20;
  20. constintWS_EX_TRANSPARENT=0x20;
  21. constintWS_EX_LAYERED=0x80000;
  22. constintLWA_ALPHA=2;
  23. privatevoidForm1_Load(objectsender,EventArgse)
  24. {
  25. this.BackColor=Color.Silver;
  26. this.TopMost=true;
  27. this.FormBorderStyle=FormBorderStyle.None;
  28. this.WindowState=FormWindowState.Maximized;
  29. SetWindowLong(Handle,GWL_EXSTYLE,GetWindowLong(Handle,GWL_EXSTYLE)|WS_EX_TRANSPARENT|WS_EX_LAYERED);
  30. SetLayeredWindowAttributes(Handle,0,128,LWA_ALPHA);
  31. }
  32. }
  33. }

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 巴彦县| 平阳县| 泌阳县| 贡山| 黄冈市| 德令哈市| 定襄县| 明星| 清丰县| 巫溪县| 清徐县| 江安县| 镇巴县| 大厂| 博客| 梧州市| 赣州市| 河南省| 蛟河市| 伊宁县| 吉隆县| 成武县| 富宁县| 桃园县| 玉山县| 宜良县| 吕梁市| 邢台市| 思南县| 隆德县| 宜君县| 佛冈县| 扶沟县| 广丰县| 互助| 锡林浩特市| 汨罗市| 温宿县| 西青区| 南涧| 河东区|