掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
カラーダイアログで48色選択のみのダイアログを表示するには (ID:66103)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
適当にやってみた。 MyColorDialog.cpp(抜粋) CMyColorDialog::CMyColorDialog(COLORREF clrInit, DWORD dwFlags, CWnd* pParentWnd) : CColorDialog(clrInit, dwFlags, pParentWnd) { this->m_cc.Flags |= CC_PREVENTFULLOPEN; } BOOL CMyColorDialog::OnInitDialog() { CColorDialog::OnInitDialog(); // TODO: この位置に初期化の補足処理を追加してください HWND hStatic; CRect rctStatic, rctDialog, rctButton; // 基本色のStaticコントロール hStatic = ::FindWindowEx(this->GetSafeHwnd(), NULL, _T("Static"), NULL); // 基本色選択領域のStaticコントロール hStatic = ::FindWindowEx(this->GetSafeHwnd(), hStatic, _T("Static"), NULL); // 作成した色のStaticコントロール hStatic = ::FindWindowEx(this->GetSafeHwnd(), hStatic, _T("Static"), NULL); // 非表示にする ::ShowWindow(hStatic, SW_HIDE); // 作成した色選択領域のStaticコントロール hStatic = ::FindWindowEx(this->GetSafeHwnd(), hStatic, _T("Static"), NULL); // クライアント座標を取得 ::GetWindowRect(hStatic, rctStatic); this->ScreenToClient(rctStatic); // (Tabキーで)フォーカスがいかないように ::EnableWindow(hStatic, FALSE); // 以下 「作成した色選択領域のStatic」 を基点にサイズ/位置を変更 // ダイアログのサイズを変更 this->GetClientRect(rctDialog); const int diff = rctDialog.bottom - rctStatic.top; this->CalcWindowRect(rctDialog, CWnd::adjustOutside); this->SetWindowPos(NULL, 0, 0, rctDialog.Width(), rctDialog.Height() - diff, SWP_NOMOVE | SWP_NOZORDER); // OKボタンの位置を変更 CWnd* pButton; pButton = this->GetDlgItem(IDOK); pButton->GetWindowRect(rctButton); this->ScreenToClient(rctButton); rctButton.OffsetRect(0, -diff); pButton->MoveWindow(rctButton); // キャンセルボタンの位置を変更 pButton = this->GetDlgItem(IDCANCEL); pButton->GetWindowRect(rctButton); this->ScreenToClient(rctButton); rctButton.OffsetRect(0, -diff); pButton->MoveWindow(rctButton); return TRUE; // コントロールにフォーカスを設定しないとき、戻り値は TRUE となります // 例外: OCX プロパティ ページの戻り値は FALSE となります }
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.