c 介面視窗與按鈕設定

2021-08-14 14:19:30 字數 1302 閱讀 5008

1.獲取螢幕寬度:

hdc hdc = ::getdc(hwnd(null));

int x = ::getdevicecaps(hdc, horzres);//獲得螢幕寬度

2.隱藏工作列:

3.視窗大小和位置:

cdialogex::setwindowpos(&wndtopmost, wndx, 0, 205, 61, swp_showwindow);//視窗大小:205*61,位置:x,wndx;y,0
4.系統托盤設定:

notifyicon.cbsize = sizeof(notifyicondata);

notifyicon.hwnd = m_hwnd;

notifyicon.uid = idi_icontp;

lstrcpy(notifyicon.sztip, _t("某某軟體"));//文字提示

notifyicon.ucallbackmessage = wm_systemtray;

notifyicon.uflags = nif_icon | nif_message | nif_tip;

shell_notifyicon(nim_add, ¬ifyicon);

5.按鈕大小和位置

cwnd *pwndl;

pwndl = getdlgitem(idc_vm1); //獲取控制項指標

pwndl->movewindow(crect(0, 0, 102, 60)); //左按鈕的大小:102*60,位置:x,0;y,0

6.按鈕設定

hbitmap hbmp_btn = ::loadbitmap(afxgetinstancehandle(), makeintresource(idb_bitmap12));

this->setbitmap(hbmp_btn);

deleteobject(hbmp_btn);

7.在onpaint中繪製視窗背景:

cpaintdc dc(this); // device context for painting

cimage img;

if (!img.isnull()) img.destroy();

hresult result = img.load(_t("./image/bc.bmp"));

if (!img.isnull()) img.draw(dc.m_hdc, 0, 0);

img.destroy();

Qt 設定和建立按鈕,視窗

main.cpp int main int argc,char ar widget.cpp widget widget qwidget parent qwidget parent ui new ui widget 影響的是widget視窗的大小 此時視窗無法再進行拖拽大小了 qpushbutton ...

Qt設定視窗 按鈕背景色

1 設定視窗背景色時使用如下樣式表 background image url img png bj png 使用後如果背景大小不夠會被平鋪。qpushbutton qpushbutton hover 如果視窗已設定背景,則會出現類似父視窗設定時,如果子視窗未設定相應的屬性覆蓋,則子視窗會使用父視窗對...

WPF介面(C ) 視窗跳轉

視窗跳轉時位置不變 login login1 new login login為視窗名,把要跳轉的新視窗例項化 login1.windowstartuplocation windowstartuplocation.manual 使新視窗位置在原來的位置上 login1.left this.left 使...