VC通用控制項自適應螢幕類

2021-09-05 20:49:59 字數 1606 閱讀 1305

此為我程式中的乙個類,本用於wince,但在桌面系統上也同樣適用!

使用方法(在wm_initdialog或wm_create訊息中加入):

cwindowanchor::begincontrolbound(hwnd)

手動調整控制項位置:

cwindowanchor::addcontrol(hwnd,idc_static1,

&windowanchorinfo(wat_left

|wat_top,2,

8,4,

10));

cwindowanchor::addcontrol(hwnd,idc_static1,

&windowanchorinfo(wat_left

|wat_top

|wat_right,2,

20,4,

10));

cwindowanchor::addcontrol(hwnd,idc_static1,

&windowanchorinfo(wat_left

|wat_top,2,

8,40,

10));

自動調整控制項位置(跟據設計時資源檔案中控制項的大小及位置):

cwindowanchor::addcontrol(hwnd,idc_static1,

&windowanchorinfo(wat_left

|wat_top));

cwindowanchor::addcontrol(hwnd,idc_static1,

&windowanchorinfo(wat_left

|wat_top

|wat_right));

響應wm_size訊息:

case

wm_size:

return

handle_wm_size(hwnddlg,wparam,lparam,cwindowanchor::onsize);

響應wm_destroy訊息:

cwindowanchor::endcontrolbound(hwnd);

**:#pragma

once

#include 

<

map>

#ifdefined (_msc_ver)

#pragma

warning(disable: 4786)

#endif

/*用於windowanchorinfo結構的停靠型別

*/typedef 

enum

windowanchortype;/*

控制項定位描述資訊

*/typedef 

struct

windowanchorinfo;

};typedef std::map

<

hwnd,windowanchorinfo

>

controlhashtable;

typedef 

struct

windowanchordialog;

/** 對話方塊子控制項定位

* 2009.03.29 by frank

*/static

class

cwindowanchor;

VC通用控制項自適應螢幕類

此為我程式中的乙個類,本用於wince,但在桌面系統上也同樣適用!使用方法 在wm initdialog或wm create訊息中加入 cwindowanchor begincontrolbound hwnd 手動調整控制項位置 cwindowanchor addcontrol hwnd,idc s...

螢幕自適應

1 media screen and max width 240px 寬度小於240px執行 media screen and min width 240px 寬度大於240px執行 2 flexible.js 在所有資源載入之前先放入 3 使用數值單位時可以嘗試使用rem作為單位替代px。rem一...

vue專案螢幕自適應 Vue專案螢幕自適應

一 安裝lib flexible npm i lib flexible d 二 在main.js中引入 import lib flexible flexible 三 在index.html檔案中設定meta標籤 四 然後在專案中寫css時會自動將rem轉化為px,需要安裝px2rem這個工具 npm...