国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 霍林郭勒市| 饶河县| 邵武市| 龙口市| 威信县| 靖安县| 汉源县| 建阳市| 涡阳县| 张家口市| 南阳市| 山阴县| 张家港市| 洛隆县| 正定县| 平乡县| 鄂温| 柯坪县| 尼勒克县| 格尔木市| 长白| 黄石市| 沽源县| 镇雄县| 德清县| 囊谦县| 隆尧县| 儋州市| 克什克腾旗| 繁峙县| 永仁县| 昌吉市| 兴隆县| 靖边县| 洱源县| 安徽省| 辛集市| 巨鹿县| 巴彦淖尔市| 沈阳市| 遂溪县|