04/03/20 20:38
>>910
じゃあ、漢直winのをパクっちゃいましょう。
//この辺の数字をいじる。
#define CHAR_SIZE (12) // 文字の大きさ
#define LARGE_CHAR_SIZE (16) // 大きい文字の大きさ
#define BLOCK_SIZE (18) // 仮想鍵盤のキーの大きさ
#define MARGIN_SIZE (4) // 仮想鍵盤の天地左右の余白
#define WIDTH (MARGIN_SIZE * 2 + BLOCK_SIZE * 11 + 1) // 仮想鍵盤の横幅
#define HEIGHT (MARGIN_SIZE * 2 + BLOCK_SIZE * 5 + 1) // 仮想鍵盤の縦幅
//これをWM_PAINTを処理している所にいれる。
// 外枠の大きさを取得
RECT winRect;
GetWindowRect(hwnd, &winRect);
// 中身の大きさを取得
RECT clientRect;
GetClientRect(hwnd, &clientRect);
// 外枠と中身の差を取得
int dX = (winRect.right - winRect.left)
- (clientRect.right - clientRect.left);
int dY = (winRect.bottom - winRect.top)
- (clientRect.bottom - clientRect.top);
int sX = ptCaret.x - (winRect.right - winRect.left) / 2;
int sY = ptCaret.y + (winRect.bottom - winRect.top) / 5;
MoveWindow(hwnd, sX, sY, WIDTH + dX, HEIGHT + dY, TRUE);