本文整理汇总了C++中IsWindowEnabled函数的典型用法代码示例。如果您正苦于以下问题:C++ IsWindowEnabled函数的具体用法?C++ IsWindowEnabled怎么用?C++ IsWindowEnabled使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsWindowEnabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wpbtnKarta
LRESULT CALLBACK wpbtnKarta(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_CREATE: {
SetWindowLongPtr(hwnd, 0, (LONG)false);
break;
}
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
//Tlo
FillRect(hdc, &ps.rcPaint, Okno->brSzary);
//Ikona
HDC hdcIkona = CreateCompatibleDC(hdc);
HGDIOBJ hdcStary;
LONG_PTR a = GetWindowLongPtr(hwnd, 0);
if (GetWindowLongPtr(hwnd, 0) == (LONG)TRUE) { //Minus
hdcStary = SelectObject(hdcIkona, Okno->imgMinus);
}
else { //Plus
hdcStary = SelectObject(hdcIkona, Okno->imgPlus);
}
BitBlt(hdc, 7, 7, 9, 9, hdcIkona, 0, 0, SRCCOPY);
SelectObject(hdcIkona, hdcStary);
DeleteDC(hdcIkona);
//Tekst
RECT p2;
ZeroMemory(&p2, sizeof(p2));
p2.left = 22;
p2.right = 190;
p2.top = 5;
p2.bottom = 20;
HFONT domyslna;
domyslna = (HFONT)SelectObject(hdc, Okno->fntCzcionka);
SetBkColor(hdc, (COLORREF)0xE3E3E3);
char *t1 = new char[30];
GetWindowText(hwnd, t1, 30);
if (IsWindowEnabled(hwnd)) {
SetTextColor(hdc, 0);
} else {
SetTextColor(hdc, (COLORREF)0x999999);
}
DrawText(hdc, t1, -1, &p2, NULL);
delete[] t1;
SelectObject(hdc, domyslna);
EndPaint(hwnd, &ps);
return 0;
}
case WM_LBUTTONDOWN: {
SendMessage(GetParent(hwnd), WM_COMMAND, (WPARAM)MAKELONG((WORD)GetWindowLong(hwnd, GWL_ID), BN_CLICKED), (LPARAM)hwnd);
break;
}
case WM_ENABLE: {
InvalidateRect(hwnd, NULL, true);
break;
}
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
示例2: PaintThemeButton
/**
* name: PaintThemeButton
* desc: Draws the themed button
* param: ctl - BTNCTRL structure for the button
* hdcMem - device context to draw to
* rcClient - rectangle of the whole button
* return: nothing
**/
static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient)
{
RECT rcText = { 0, 0, 0, 0 };
WCHAR wszText[MAX_PATH] = { 0 };
WORD ccText;
// Draw the flat button
if ((ctl->dwStyle & MBS_FLAT) && ctl->hThemeToolbar) {
int state = IsWindowEnabled(ctl->hwnd)
? (ctl->stateId == PBS_NORMAL && ctl->defbutton
? PBS_DEFAULTED
: ctl->stateId)
: PBS_DISABLED;
if (IsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) {
if (SUCCEEDED(DrawThemeParentBackground(ctl->hwnd, hdcMem, rcClient)))
DrawThemeParentBackground(GetParent(ctl->hwnd), hdcMem, rcClient);
}
DrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), rcClient, rcClient);
}
else {
// draw themed button background
if (ctl->hThemeButton) {
int state = IsWindowEnabled(ctl->hwnd)
? (ctl->stateId == PBS_NORMAL && ctl->defbutton
? PBS_DEFAULTED
: ctl->stateId)
: PBS_DISABLED;
if (IsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) {
if (SUCCEEDED(DrawThemeParentBackground(ctl->hwnd, hdcMem, rcClient)))
DrawThemeParentBackground(GetParent(ctl->hwnd), hdcMem, rcClient);
}
DrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, rcClient, rcClient);
}
}
// calculate text rect
{
RECT sizeText;
HFONT hOldFont;
ccText = GetWindowTextW(ctl->hwnd, wszText, sizeof(wszText) / sizeof(WCHAR));
if (ccText > 0) {
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
GetThemeTextExtent(
ctl->hThemeButton,
hdcMem,
BP_PUSHBUTTON,
IsWindowEnabled(ctl->hwnd) ? ctl->stateId : PBS_DISABLED,
wszText,
ccText,
DST_PREFIXTEXT,
NULL,
&sizeText);
if (ctl->cHot) {
RECT rcHot;
GetThemeTextExtent(ctl->hThemeButton,
hdcMem,
BP_PUSHBUTTON,
IsWindowEnabled(ctl->hwnd) ? ctl->stateId : PBS_DISABLED,
L"&",
1,
DST_PREFIXTEXT,
NULL,
&rcHot);
sizeText.right -= (rcHot.right - rcHot.left);
}
SelectObject(hdcMem, hOldFont);
rcText.left = (ctl->hIcon) ? 0 : (rcClient->right - rcClient->left - (sizeText.right - sizeText.left)) / 2;
rcText.top = (rcClient->bottom - rcClient->top - (sizeText.bottom - sizeText.top)) / 2;
rcText.right = rcText.left + (sizeText.right - sizeText.left);
rcText.bottom = rcText.top + (sizeText.bottom - sizeText.top);
if (ctl->stateId == PBS_PRESSED) {
OffsetRect(&rcText, 1, 1);
}
}
}
PaintIcon(ctl, hdcMem, &ccText, rcClient, &rcText);
// draw text
if (ccText > 0 && ctl->hThemeButton) {
HFONT hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
DrawThemeText(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, IsWindowEnabled(ctl->hwnd) ? ctl->stateId : PBS_DISABLED, wszText, ccText, DST_PREFIXTEXT, 0, &rcText);
SelectObject(hdcMem, hOldFont);
}
}
示例3: UIEmulateBtnClick
static int UIEmulateBtnClick(HWND hwndDlg, UINT idcButton)
{
if (IsWindowEnabled(GetDlgItem(hwndDlg, idcButton)))
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(idcButton, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, idcButton));
return 0;
}
示例4: ExecuteEntry
//.........这里部分代码省略.........
}
return ret;
}
if (ret == -3 || ret == -6)
{
log_printf2("File: INSTALLER CORRUPTED (gcdfdb:%d)\n",ret);
goto installer_corrupted;
}
else
{
DeleteFile(buf);
log_printf("File: error writing. deleted.\n");
return -2;
}
}
log_printf("File: INSTALLER CORRUPTED\n");
}
break;
case 2: // execute program
{
PROCESS_INFORMATION ProcInfo={0,};
STARTUPINFO StartUp={sizeof(STARTUPINFO),};
int disabled = 0;
if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf2,sizeof(buf2)))
{
log_printf2("Exec: command=\"%s\"\n",buf2);
if (process_string(buf,buf2,state_install_directory)) _tcscpy(buf,buf2);
{
INT32 args[] = { (INT32)buf };
GETRESOURCE2(tmpbuf, JAVAWS_STATUS_EXECUTE, args);
update_status_text(tmpbuf);
}
if (IsWindowEnabled(GetDlgItem(g_hwnd,IDOK))!=0) {
/* if Next button is already disabled, don't disable */
/* and re-enable it. (bug 4624948) */
EnableWindow(GetDlgItem(g_hwnd,IDOK), 0);
disabled = 1;
}
if (CreateProcess( NULL, buf, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, state_output_directory, &StartUp, &ProcInfo) )
{
log_printf2("Exec: success (\"%s\")\n",buf);
if (NULL != ProcInfo.hThread) CloseHandle( ProcInfo.hThread );
if (NULL != ProcInfo.hProcess)
{
if (thisentry->offsets[1]==1)
{
WaitForSingleObject(ProcInfo.hProcess,INFINITE);
ShowWindow(g_hwnd,SW_HIDE);
ShowWindow(g_hwnd,SW_SHOW);
InvalidateRect(g_hwnd,NULL,TRUE);
UpdateWindow(g_hwnd);
while (1)
{
MSG msg;
if (!PeekMessage(&msg,g_hwnd,WM_PAINT,WM_PAINT,PM_REMOVE)) break;
DispatchMessage(&msg);
}
}
{
DWORD exitcode;
if (!GetExitCodeProcess(ProcInfo.hProcess, (LPDWORD)&exitcode)) {
log_printf("Exec: failed getting exit code\n");
state_return_value = STATE_RETURN_INVALID;
} else {
state_return_value = exitcode;
示例5: IsOverURL
bool CIVStatusBar::IsOverURL(CPoint pt, CString & rstr )
{
if ( ! IsWindowEnabled() || !GetTopLevelParent()->IsWindowEnabled() )
return false;
CStatusBarCtrl & sb = GetStatusBarCtrl();
int iPart = -1;
CRect rc;
for (int i=0; i < sb.GetParts(0, NULL); i++ )
{
sb.GetRect (i, rc);
if (rc.PtInRect(pt) && ( GetPaneStyle(i) & SBT_OWNERDRAW ) )
{
iPart = i;
break;
}
}
if (iPart == -1)
return false;
if ( ! (GetPaneStyle(iPart) & SBPS_NOBORDERS) )
rc.InflateRect(-GetSystemMetrics(SM_CYBORDER), -GetSystemMetrics(SM_CXBORDER));
if (!rc.PtInRect(pt))
return false;
CString strText = GetPaneText(iPart);
CDC * pDC = GetDC();
CFont * pFont = GetFont();
CFont fntURL;
GetLinkFont(fntURL);
CFont * pOldFont = pDC->SelectObject (pFont);
int x = CalcX (pDC, rc, strText);
bool bFound = false;
for (int i = 0; i < strText.GetLength();)
{
CSize szPos = FindURL (strText, i );
if (szPos.cx != -1)
{
CString strStart = strText.Mid (i, szPos.cx-i);
CRect rcURL;
x += pDC->GetTextExtent (strStart).cx;
rcURL.left = x;
pFont = pDC->SelectObject (&fntURL);
CString strURL = strText.Mid(szPos.cx, szPos.cy);
CSize szURL = pDC->GetTextExtent (strURL);
x += szURL.cx;
rcURL.right = x;
rcURL.top = rc.top;
rcURL.bottom = rc.top + szURL.cy;
pDC->SelectObject (pFont);
if (rcURL.PtInRect(pt))
{
rstr = strURL;
bFound = true;
break;
}
i = szPos.cx + szPos.cy;
}
else
break;
}
pDC->SelectObject (pOldFont);
return bFound;
}
示例6: SendMessage
void CMlsBitmapButton::DrawButton(CDC* pDC)
{
// Upack the state of the button.
DWORD dwState = SendMessage(BM_GETSTATE, 0, 0);
DWORD dwCode = SendMessage(WM_GETDLGCODE, 0, 0);
BOOL fSelected = (dwState & 4) != 0;
BOOL fFocused = (dwState & 8) != 0;
BOOL fDisabled = !IsWindowEnabled();
BOOL fDefault = (dwCode & DLGC_DEFPUSHBUTTON) != 0;
// Create a bitmap which will be used to draw the button image.
// When the bitmap is complete, it will be drawn onto the button.
CRect crButton;
GetClientRect(crButton);
CBitmap bmButton;
bmButton.CreateCompatibleBitmap(pDC, crButton.Width(), crButton.Height());
CDC dcButton;
dcButton.CreateCompatibleDC(pDC);
CPalette* pOldPalette = NULL;
CPalette* pOldButtonPalette = NULL;
if (m_pPalette != NULL)
{
pDC->SelectPalette(m_pPalette, FALSE);
pDC->RealizePalette();
pOldButtonPalette = dcButton.SelectPalette(m_pPalette, FALSE);
}
dcButton.SelectObject(&bmButton);
// Initialize the button bitmap to the button face color.
Util::FillRectangleWithColor(dcButton, crButton, m_clFace);
// Compute the area available for content.
CRect crContent(crButton);
crContent.InflateRect(-MinimumMargin, -MinimumMargin);
CRect crTextContent(crContent);
// Compute the bitmap dimensions and its nominal position. Adjust crTextContent to the
// area which is available next to the bitmap.
CRect crBitmap;
crBitmap.SetRectEmpty();
if (!crContent.IsRectEmpty())
{
if (m_fHaveBitmap)
{
crBitmap.SetRect(0, 0, m_nBitmapWidth, m_nBitmapHeight);
// Set first bitmap position base on major alignment type.
switch (m_Alignment)
{
case Left:
{
crBitmap.OffsetRect(crContent.left, crContent.top+(crContent.Height()-crBitmap.Height())/2);
crTextContent.left += crBitmap.Width()+Separator;
break;
}
case Right:
{
crBitmap.OffsetRect(crContent.right-crBitmap.Width(), crContent.top+(crContent.Height()-crBitmap.Height())/2);
crTextContent.right -= crBitmap.Width()+Separator;
break;
}
case Top:
{
crBitmap.OffsetRect(crContent.left+(crContent.Width()-crBitmap.Width())/2, crContent.top);
crTextContent.top += crBitmap.Height()+Separator;
break;
}
case Bottom:
{
crBitmap.OffsetRect(crContent.left+(crContent.Width()-crBitmap.Width())/2, crContent.bottom-crBitmap.Height());
crTextContent.bottom -= crBitmap.Height()+Separator;
break;
}
default:
{
ASSERT(FALSE);
}
}
}
else
{
crBitmap.SetRectEmpty();
}
}
// Compute the text dimensions and its nominal position.
CRect crText;
crText.SetRectEmpty();
CString csText;
if (!crTextContent.IsRectEmpty())
{
GetWindowText(csText);
if (!csText.IsEmpty())
//.........这里部分代码省略.........
示例7: switch
LRESULT TStemDialog::DefStemDialogProc(HWND Win,UINT Mess,WPARAM wPar,LPARAM lPar)
{
StemDialog_RetDefVal=0;
TStemDialog *This;
switch (Mess){
case WM_SYSCOMMAND:
switch (wPar){
case SC_MONITORPOWER:
if (runstate == RUNSTATE_RUNNING) return 0;
break;
case SC_SCREENSAVE:
if (runstate == RUNSTATE_RUNNING || FullScreen) return 0;
break;
}
break;
case WM_MOVING:case WM_SIZING:
if (FullScreen){
RECT *rc=(RECT*)lPar;
if (rc->top<MENUHEIGHT){
if (Mess==WM_MOVING) rc->bottom+=MENUHEIGHT-rc->top;
rc->top=MENUHEIGHT;
StemDialog_RetDefVal=true;
return true;
}
RECT LimRC={0,MENUHEIGHT+GetSystemMetrics(SM_CYFRAME),
GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN)};
ClipCursor(&LimRC);
}
break;
case WM_MOVE:
{
GET_THIS;
RECT rc;
GetWindowRect(Win,&rc);
if (FullScreen){
if (IsIconic(StemWin)==0 && IsZoomed(StemWin)==0){
This->FSLeft=rc.left;This->FSTop=rc.top;
}
}else{
if (IsIconic(Win)==0 && IsZoomed(Win)==0){
This->Left=rc.left;This->Top=rc.top;
}
}
break;
}
case WM_CAPTURECHANGED: //Finished
if (FullScreen) ClipCursor(NULL);
break;
case WM_ACTIVATE:
if (wPar==WA_INACTIVE){
GET_THIS;
This->Focus=GetFocus();
}else{
if (IsWindowEnabled(Win)==0){
PostMessage(StemWin,WM_USER,12345,(LPARAM)Win);
}
}
break;
case WM_SETFOCUS:
GET_THIS;
SetFocus(This->Focus);
break;
}
return 0;
}
示例8: Select_CDROM_Window_WndProc
LRESULT CALLBACK Select_CDROM_Window_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
Select_CDROM_Window_CreateChildWindows(hWnd);
break;
case WM_CLOSE:
DestroyWindow(select_cdrom_window);
return 0;
case WM_MENUSELECT:
case WM_ENTERSIZEMOVE:
case WM_NCLBUTTONDOWN:
case WM_NCRBUTTONDOWN:
// Prevent audio stuttering when one of the following events occurs:
// - Menu is opened.
// - Window is resized.
// - Left/Right mouse button down on title bar.
Win32_ClearSoundBuffer();
break;
case WM_COMMAND:
// Button press, or Enter pressed in textbox
switch (LOWORD(wParam))
{
case IDOK: // Standard dialog button ID
case IDC_BTN_OK:
case IDC_BTN_SAVE:
if (!IsWindowEnabled(SelCD_btnOK))
break;
SelCD_Save();
DestroyWindow(hWnd);
break;
case IDC_BTN_APPLY:
if (!IsWindowEnabled(SelCD_btnApply))
break;
SelCD_Save();
break;
case IDCANCEL: // Standard dialog button ID
case IDC_BTN_CANCEL:
DestroyWindow(hWnd);
break;
}
break;
case WM_DESTROY:
if (hWnd != select_cdrom_window)
break;
select_cdrom_window = NULL;
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
示例9: NYX_ASSERT
//----------------------------------------------------------------
bool check_box::is_activate() const {
NYX_ASSERT(hwnd_ != NULL);
return IsWindowEnabled(hwnd_) != 0;
}
示例10: DlgProcDisplayAttr
//.........这里部分代码省略.........
case IDC_RADIO_UL_SEL_ANNOT:
PropSheet_Changed(GetParent(hDlg), hDlg);
return TRUE;
case IDC_COMBO_UL_ATTR_MARK:
case IDC_COMBO_UL_ATTR_TEXT:
case IDC_COMBO_UL_ATTR_OKURI:
case IDC_COMBO_UL_ATTR_ANNOT:
case IDC_COMBO_ATTR_MARK:
case IDC_COMBO_ATTR_TEXT:
case IDC_COMBO_ATTR_OKURI:
case IDC_COMBO_ATTR_ANNOT:
switch(HIWORD(wParam))
{
case CBN_SELCHANGE:
PropSheet_Changed(GetParent(hDlg), hDlg);
return TRUE;
default:
break;
}
break;
default:
break;
}
break;
case WM_LBUTTONDOWN:
for(int i = 0; i < _countof(displayAttrColor[no]); i++)
{
for(int j = 0; j < _countof(displayAttrColor[no][i]); j++)
{
hwnd = GetDlgItem(hDlg, displayAttrColor[no][i][j].id);
if(!IsWindowEnabled(hwnd))
{
continue;
}
GetWindowRect(hwnd, &rect);
pt.x = x = GET_X_LPARAM(lParam);
pt.y = y = GET_Y_LPARAM(lParam);
ClientToScreen(hDlg, &pt);
if(rect.left <= pt.x && pt.x <= rect.right &&
rect.top <= pt.y && pt.y <= rect.bottom)
{
cc.lStructSize = sizeof(cc);
cc.hwndOwner = hDlg;
cc.hInstance = NULL;
cc.rgbResult = *displayAttrColor[no][i][j].color;
cc.lpCustColors = colCust;
cc.Flags = CC_FULLOPEN | CC_RGBINIT;
cc.lCustData = NULL;
cc.lpfnHook = NULL;
cc.lpTemplateName = NULL;
if(ChooseColorW(&cc))
{
DrawSelectColor(hDlg, displayAttrColor[no][i][j].id, cc.rgbResult);
*displayAttrColor[no][i][j].color = cc.rgbResult;
PropSheet_Changed(GetParent(hDlg), hDlg);
return TRUE;
}
break;
}
}
}
break;
示例11: return
bool
mxWidget::isEnabled () const
{
return (IsWindowEnabled (d_this->d_hwnd) == TRUE);
}
示例12: write_entries_to_window
static void write_entries_to_window(HWND window, char *filename){
int num_of_entries, entry, row_num = 0;
char numstr[6];
filetype type;
LVITEMA row;
FILE *fd;
struct program_block program;
HWND preview = GetDlgItem(window, IDC_PREVIEW);
HWND text = GetDlgItem(window, IDC_FILE_TYPE);
HWND c64name = GetDlgItem(window, IDC_C64_NAME);
fd = fopen(filename, "rb");
if (fd == NULL)
return;
switch (type = detect_type(fd)) {
case not_a_valid_file:
EnableWindow(preview, FALSE);
EnableWindow(c64name, FALSE);
SetWindowTextA(text, "");
SetWindowTextA(c64name, "");
fclose(fd);
return;
case t64:
{
char message[1000];
char tape_name[25];
int num_of_used_entries;
num_of_entries = get_total_entries(fd);
num_of_used_entries = get_used_entries(fd);
get_tape_name(tape_name, fd);
_snprintf(message, 1000,
"T64 file with %u total entr%s, %u used entr%s, name %s",
num_of_entries, num_of_entries == 1 ? "y" : "ies",
num_of_used_entries, num_of_used_entries == 1 ? "y" : "ies",
tape_name);
SetWindowTextA(text, message);
EnableWindow(preview, num_of_used_entries > 1);
}
EnableWindow(c64name, FALSE);
break;
case p00:
EnableWindow(preview, FALSE);
num_of_entries = 1;
SetWindowTextA(text, "P00 file");
EnableWindow(c64name, TRUE);
break;
case prg:
EnableWindow(preview, FALSE);
num_of_entries = 1;
SetWindowTextA(text, "PRG file");
EnableWindow(c64name, TRUE);
break;
}
for (entry = 1; entry <= num_of_entries; entry++) {
if (get_entry(entry, fd, &program)) {
row.mask = LVIF_TEXT;
row.iItem = row_num++;
row.iSubItem = 0;
row.pszText = numstr;
sprintf(numstr, "%u", entry);
ListView_InsertItem(preview, &row);
row.iSubItem = 1;
row.pszText = program.info.name;
ListView_SetItem(preview, &row);
row.iSubItem = 2;
row.pszText = numstr;
sprintf(numstr, "%u", program.info.start);
ListView_SetItem(preview, &row);
row.iSubItem = 3;
sprintf(numstr, "%u", program.info.end);
ListView_SetItem(preview, &row);
}
}
if (row_num == 1) {
ListView_SetItemState(preview, 0, LVIS_SELECTED, LVIS_SELECTED);
SetWindowTextA(c64name, program.info.name);
}
else {
SetWindowTextA(c64name, "");
if (IsWindowEnabled(preview))
ListView_SetItemState(preview, 0, LVIS_FOCUSED, LVIS_FOCUSED);
}
fclose(fd);
}
示例13: GetClientRect
void CCJFlatComboBox::DrawCombo(DRAWSTATE eStyle, COLORREF clrTopLeft, COLORREF clrBottomRight)
{
CRect rcItem;
GetClientRect(&rcItem);
CDC* pDC = GetDC();
// Cover up dark 3D shadow.
pDC->Draw3dRect(rcItem, clrTopLeft, clrBottomRight);
rcItem.DeflateRect(1,1);
if (!IsWindowEnabled()) {
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNHIGHLIGHT));
}
else {
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNFACE),
::GetSysColor(COLOR_BTNFACE));
}
// Cover up dark 3D shadow on drop arrow.
rcItem.DeflateRect(1,1);
rcItem.left = rcItem.right-::GetSystemMetrics(SM_CXHTHUMB);;
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNFACE),
::GetSysColor(COLOR_BTNFACE));
// Cover up normal 3D shadow on drop arrow.
rcItem.DeflateRect(1,1);
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNFACE),
::GetSysColor(COLOR_BTNFACE));
if (!IsWindowEnabled()) {
return;
}
switch (eStyle)
{
case FC_DRAWNORMAL:
rcItem.top -= 1;
rcItem.bottom += 1;
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNHIGHLIGHT));
rcItem.left -= 1;
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNHIGHLIGHT));
break;
case FC_DRAWRAISED:
rcItem.top -= 1;
rcItem.bottom += 1;
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNSHADOW));
break;
case FC_DRAWPRESSD:
rcItem.top -= 1;
rcItem.bottom += 1;
rcItem.OffsetRect(1,1);
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNSHADOW),
::GetSysColor(COLOR_BTNHIGHLIGHT));
break;
}
ReleaseDC(pDC);
}
示例14: BackgroundDlgProc
//.........这里部分代码省略.........
DBVARIANT dbv, dbvText;
HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
char *szProto = GetContactProto(hContact);
if (szProto == NULL) break;
bool proto_service = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC;
SetValue(hwndDlg, IDC_WEBPAGE, hContact, szProto, "Homepage", SVS_ZEROISUNSPEC);
//past
ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_PAST));
lvi.mask = LVIF_TEXT;
lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Past%d", i);
if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Past%dText", i);
if (db_get_ts(hContact, szProto, idstr, &dbvText))
{if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;}
lvi.pszText = dbv.ptszVal;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PAST), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PAST), lvi.iItem, 1, dbvText.ptszVal);
db_free(&dbvText);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
db_free(&dbv);
lvi.iItem++;
}
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%d", i);
if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%dText", i);
if (db_get_ts(hContact, szProto, idstr, &dbvText))
{if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;}
lvi.pszText = dbv.ptszVal;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PAST), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PAST), lvi.iItem, 1, dbvText.ptszVal);
db_free(&dbvText);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
db_free(&dbv);
lvi.iItem++;
}
ResizeColumns(GetDlgItem(hwndDlg, IDC_PAST));
//interests
ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_INTERESTS));
lvi.mask = LVIF_TEXT;
lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dCat", i);
if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dText", i);
if (db_get_ts(hContact, szProto, idstr, &dbvText))
{if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;}
lvi.pszText = dbv.ptszVal;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_INTERESTS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_INTERESTS), lvi.iItem, 1, dbvText.ptszVal);
db_free(&dbvText);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
db_free(&dbv);
lvi.iItem++;
}
ResizeColumns(GetDlgItem(hwndDlg, IDC_INTERESTS));
} }
break;
}
break;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDCANCEL:
SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
break;
case IDC_WEBPAGE:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) {
char szPage[256];
GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, SIZEOF(szPage));
CallService(MS_UTILS_OPENURL, 1, (LPARAM)szPage);
}
break;
}
break;
}
return FALSE;
}
示例15: RGB
void CBtnRoundImg::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC dc;
dc.Attach(lpDrawItemStruct->hDC); //°´Å¥¿Ø¼þDC
COLORREF clrBK = RGB(255,255,255);
switch(m_nCtrlState)
{
case CTRL_NOFOCUS:
clrBK = m_clrBKUnfocus;
break;
case CTRL_FOCUS:
clrBK = m_clrBKFocus;
break;
case CTRL_SELECTED:
clrBK = m_clrBKSelected;
break;
default:
break;
}
if (IsWindowEnabled()==FALSE)
{
clrBK = m_clrBKDisable;
}
//draw background
CRect rect(lpDrawItemStruct->rcItem);
//dc.FillSolidRect(&rect,clrBK);
DrawRoundRect(dc, 5,rect,clrBK);
//draw image
if (m_strPngPath != _T(""))
{
Gdiplus::Image imageBtn(m_strPngPath);
if (imageBtn.GetLastStatus() != Ok)
{
ASSERT(FALSE);
}
;
HRGN hRgnOld = (HRGN)::SelectObject(lpDrawItemStruct->hDC, m_hRgnBtn);
Gdiplus::Graphics * pGrp = Graphics::FromHDC(lpDrawItemStruct->hDC);
pGrp->Clear(Color::White);
CRect rectBtn;
GetClientRect(&rectBtn);
int startX = (rectBtn.Width() - imageBtn.GetWidth())/2;
int startY = (rectBtn.Height() - imageBtn.GetHeight())/2;
startX = 0;
startY = 0;
if (lpDrawItemStruct->itemState & ODS_SELECTED) //Ñ¡ÖÐ״̬£¬Í¼Æ¬Æ«ÒÆÒ»¸öÏñËØ
{
pGrp->DrawImage(&imageBtn, startX+1, startY+1, startX+imageBtn.GetWidth(), startY+imageBtn.GetHeight());
}
else //ĬÈÏ״̬
{
pGrp->DrawImage(&imageBtn, startX, startY, startX+imageBtn.GetWidth(), startY+imageBtn.GetHeight());
}
delete pGrp;
pGrp = NULL;
::SelectObject(lpDrawItemStruct->hDC, hRgnOld);
}
CFont* pOldFont;
if (m_pFont)
{
pOldFont = dc.SelectObject(m_pFont);
}
COLORREF clrOld = dc.SetTextColor(m_clrFont);
CString strText;
GetWindowText(strText);
if (strText != _T(""))
{
int test = 1;
}
int oldMode = dc.SetBkMode(TRANSPARENT);
dc.DrawText(strText, -1, &lpDrawItemStruct->rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
dc.SetBkMode(oldMode);
dc.SetTextColor(clrOld);
if (m_pFont)
{
dc.SelectObject(pOldFont);
}
dc.Detach();
}