?? 怎樣使窗口保持在屏幕的中央.txt
字號:
你 可 以 設 置 窗 體 的 StartUpPosition屬 性 為 2, 這 樣 窗 口 一 開 始 就 出 現 在 屏 幕 中 央 。 VB缺 乏 一 個 事 件 來 檢 測 用 戶 是 否 移 動 窗 口 , 你 可 以 參 考 “在msgblst中如何處理指向結構變量的地址”所 介 紹 的 方 法 來 禁 止 用 戶 移 動 窗 口 。
<END>
禁 止 窗 口 移 動 可 以 使 用 :
Form1.Moveable=false
<END>
VOID
CenterWindow(
HWND hwnd
)
{
RECT rect;
LONG dx, dy;
LONG dxParent, dyParent;
LONG Style;
// Get window rect
GetWindowRect(hwnd, &rect);
dx = rect.right - rect.left;
dy = rect.bottom - rect.top;
// Get parent rect
Style = GetWindowLong(hwnd, GWL_STYLE);
if ((Style & WS_CHILD) == 0) {
// Return the desktop windows size (size of main screen)
dxParent = GetSystemMetrics(SM_CXSCREEN);
dyParent = GetSystemMetrics(SM_CYSCREEN);
} else {
HWND hwndParent;
RECT rectParent;
hwndParent = GetParent(hwnd);
if (hwndParent == NULL) {
hwndParent = GetDesktopWindow();
}
GetWindowRect(hwndParent, &rectParent);
dxParent = rectParent.right - rectParent.left;
dyParent = rectParent.bottom - rectParent.top;
}
// Centre the child in the parent
rect.left = (dxParent - dx) / 2;
rect.top = (dyParent - dy) / 3;
// Move the child into position
SetWindowPos(hwnd, HWND_TOPMOST, rect.left, rect.top, 0, 0, SWP_NOSIZE);
SetForegroundWindow(hwnd);
<END>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -