控制項自適應放大

2021-09-22 08:02:53 字數 1772 閱讀 3515

using system;

using system.collections.generic;

using system.componentmodel;

using system.data;

using system.drawing;

using system.linq;

using system.text;

using system.threading.tasks;

using system.windows.forms;

using system.data.sqlclient;

using system.drawing.printing;

using system.collections;

using system.io;

using system.configuration;

using system.data.oledb;

using system.runtime.interopservices;

using system.diagnostics;

/// /// 

///

///

///

///

///

public inputinfo()

#region 控制項大小隨窗體大小等比例縮放

private float x;//定義當前窗體的寬度

private float y;//定義當前窗體的高度

private void settag(control cons)}}

private void setcontrols(float newx, float newy, control cons)

);//根據窗體縮放的比例確定控制項的值

con.width = convert.toint32(system.convert.tosingle(mytag[0]) * newx);//寬度

con.height = convert.toint32(system.convert.tosingle(mytag[1]) * newy);//高度

con.left = convert.toint32(system.convert.tosingle(mytag[2]) * newx);//左邊距

con.top = convert.toint32(system.convert.tosingle(mytag[3]) * newy);//頂邊距

single currentsize = system.convert.tosingle(mytag[4]) * newy;//字型大小

con.font = new font(con.font.name, currentsize, con.font.style, con.font.unit);

if (con.controls.count > 0)}}

}private void inputinfo_load(object sender, eventargs e)

[dllimport("user32")]

private static extern int sendmessage(intptr hwnd, int wmsg, int wparam, intptr lparam);

private const int wm_setredraw = 0xb;

private void inputinfo_resize(object sender, eventargs e)

#endregion

}

Qt 控制項自適應字型大小

當你的字型太大的時候需要qlable自適應調整qlable的高度,adjustsize就可以滿足此要求,其他的控制項也一樣,比如qcheckbox,qlineedit等控制自適應字型大小都可以使用adjustsize lable adjustsize 自動調整label的高度,需要注意的是這個不是一...

silverlight 控制項自適應宿主

1,只適用已經會自定義控制項的人看.2,如果你正為了乙個外部控制項在主頁面中的自適應而苦惱那麼正適合.大多時候我把很多可以自適應的東西加上滾動條,額外費事,而且顯的很累贅,後來真的找到了好的辦法.很簡單的辦法.就算給自己做個筆記吧.說明 最外部是我的宿主頁面.白色部分是宿主頁面內部控制項做到自適應沒...

Qt 實現窗體控制項自適應

開啟.ui檔案 最外面grid layout grid layout裡面放hlayout 放兩個textedit和乙個vlayout發在hlayout中 在vlayout中放兩個vspace和乙個pushbutton 效果如下 將兩個textedit物件到sizepolicy屬性到水平和垂直測率設定...