C 實現透明窗體

2021-06-01 01:38:20 字數 1046 閱讀 1323

這篇文章不是windows mobile的,而是win32的。這篇文章主要介紹一下c#下如何呼叫windows api函式,這裡也想說一下,windows mobile程式設計不能把眼光只侷限於手機,手機與pc端相結合的程式也是很有挑戰力、很有市場的。所以,這也是我寫這篇文章的原因之一。

做delphi的時候,實現窗體透明很簡單,因為delphi對windows api的封裝很好。不只對api函式封裝的到位,對api函式所用到的引數封裝的也很好。而.net沒有對api函式進行封裝,對api函式的引數就更沒有封裝了。呼叫api函式只能用invoke的方式,引數也需要我們自己進行相關定義。

desktopwinapi.cs類檔案,invoke了窗體透明所需要的api函式:

using system;

using system.collections.generic;

using system.text;

using system.runtime.interopservices;

namespace deviceanywheredesktop

public enum exwindowstyle : uint}}

deviceform.cs單元是api函式的呼叫方式:

using system;

using system.collections.generic;

using system.componentmodel;

using system.data;

using system.drawing;

using system.text;

using system.windows.forms;

namespace deviceanywheredesktop

protected override createparams createparams

}private void setwindowtransparent(byte balpha)

catch

}private void deviceform_load(object sender, eventargs e)}}

Qt 透明窗體實現

一.背景刷成黑色,前景色設為白色。方法一 paltette方式,經測試,該方法不會影響到其他控制項,推薦使用 qpalette bgpal palette bgpal.setcolor qpalette background,qcolor 0,0 0,255 bgpal.setcolor qpale...

MFC實現窗體透明

mfc建立透明窗體 1 設定窗體屬性為 layeredwindow,並設定窗體為無邊框窗體。設定窗體為layeredwindow long para getwindowlong this getsafehwnd gwl exstyle para ws ex layered setwindowlong...

C 完美實現透明窗體的繪製效果

為了實現透明窗體的繪製,最開始是採用了雙層窗體的模式。思路 將form1的屬性transparencykey設定為背景色,將form2的opicaty設定的很低,比如0.05,保證滑鼠不會穿透!讓後將 使用form1建立的繪製物件 form1.creategraphics 去繪製即可!後面方面使用單...