这篇教程C++ ClientToScreen函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ClientToScreen函数的典型用法代码示例。如果您正苦于以下问题:C++ ClientToScreen函数的具体用法?C++ ClientToScreen怎么用?C++ ClientToScreen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ClientToScreen函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ptvoid CAnimationEditorDlg::OnMouseMove(UINT nFlags, CPoint point) { //While the mouse is moving, this routine is called. //This routine will redraw the drag image at the present // mouse location to display the dragging. //Also, while over a CListCtrl, this routine will highlight // the item we are hovering over. //// If we are in a drag/drop procedure (m_bDragging is true) if (m_bDragging) { //// Move the drag image CPoint pt(point); //get our current mouse coordinates ClientToScreen(&pt); //convert to screen coordinates m_pDragImage->DragMove(pt); //move the drag image to those coordinates // Unlock window updates (this allows the dragging image to be shown smoothly) m_pDragImage->DragShowNolock(false); //// Get the CWnd pointer of the window that is under the mouse cursor CWnd* pDropWnd = WindowFromPoint (pt); ASSERT(pDropWnd); //make sure we have a window //// If we drag outside current window we need to adjust the highlights displayed if (pDropWnd != m_pDropWnd) { if (m_nDropIndex != -1) //If we drag over the CListCtrl header, turn off the hover highlight { TRACE("m_nDropIndex is -1/n"); CListCtrl* pList = (CListCtrl*)m_pDropWnd; VERIFY (pList->SetItemState (m_nDropIndex, 0, LVIS_DROPHILITED)); // redraw item VERIFY (pList->RedrawItems (m_nDropIndex, m_nDropIndex)); pList->UpdateWindow (); m_nDropIndex = -1; } else //If we drag out of the CListCtrl altogether { TRACE("m_nDropIndex is not -1/n"); CListCtrl* pList = (CListCtrl*)m_pDropWnd; int i = 0; int nCount = pList->GetItemCount(); for(i = 0; i < nCount; i++) { pList->SetItemState(i, 0, LVIS_DROPHILITED); } pList->RedrawItems(0, nCount); pList->UpdateWindow(); } } // Save current window pointer as the CListCtrl we are dropping onto m_pDropWnd = pDropWnd; // Convert from screen coordinates to drop target client coordinates pDropWnd->ScreenToClient(&pt); //If we are hovering over a CListCtrl we need to adjust the highlights if(pDropWnd->IsKindOf(RUNTIME_CLASS (CListCtrl))) { //Note that we can drop here SetCursor(LoadCursor(NULL, IDC_ARROW)); UINT uFlags; CListCtrl* pList = (CListCtrl*)pDropWnd; // Turn off hilight for previous drop target pList->SetItemState (m_nDropIndex, 0, LVIS_DROPHILITED); // Redraw previous item pList->RedrawItems (m_nDropIndex, m_nDropIndex); // Get the item that is below cursor m_nDropIndex = ((CListCtrl*)pDropWnd)->HitTest(pt, &uFlags); // Highlight it if(m_nDropIndex >= 0) pList->SetItemState(m_nDropIndex, LVIS_DROPHILITED, LVIS_DROPHILITED); // Redraw item pList->RedrawItems(m_nDropIndex, m_nDropIndex); pList->UpdateWindow(); } else { //If we are not hovering over a CListCtrl, change the cursor // to note that we cannot drop here SetCursor(LoadCursor(NULL, IDC_NO)); } // Lock window updates m_pDragImage->DragShowNolock(true); } CDialog::OnMouseMove(nFlags, point);}
开发者ID:DavidPulido,项目名称:Contruct,代码行数:90,
示例2: PaintDefaultIMEWnd/***** * Internal functions to help with IME window management */static void PaintDefaultIMEWnd(HIMC hIMC, HWND hwnd){ PAINTSTRUCT ps; RECT rect; HDC hdc; LPCOMPOSITIONSTRING compstr; LPBYTE compdata = NULL; HMONITOR monitor; MONITORINFO mon_info; INT offX=0, offY=0; LPINPUTCONTEXT lpIMC; lpIMC = LockRealIMC(hIMC); if (lpIMC == NULL) return; hdc = BeginPaint(hwnd,&ps); GetClientRect(hwnd,&rect); FillRect(hdc, &rect, (HBRUSH)(COLOR_WINDOW + 1)); compdata = ImmLockIMCC(lpIMC->hCompStr); compstr = (LPCOMPOSITIONSTRING)compdata; if (compstr->dwCompStrLen && compstr->dwCompStrOffset) { SIZE size; POINT pt; HFONT oldfont = NULL; LPWSTR CompString; LPIMEPRIVATE myPrivate; CompString = (LPWSTR)(compdata + compstr->dwCompStrOffset); myPrivate = ImmLockIMCC(lpIMC->hPrivate); if (myPrivate->textfont) oldfont = SelectObject(hdc,myPrivate->textfont); ImmUnlockIMCC(lpIMC->hPrivate); GetTextExtentPoint32W(hdc, CompString, compstr->dwCompStrLen, &size); pt.x = size.cx; pt.y = size.cy; LPtoDP(hdc,&pt,1); /* * How this works based on tests on windows: * CFS_POINT: then we start our window at the point and grow it as large * as it needs to be for the string. * CFS_RECT: we still use the ptCurrentPos as a starting point and our * window is only as large as we need for the string, but we do not * grow such that our window exceeds the given rect. Wrapping if * needed and possible. If our ptCurrentPos is outside of our rect * then no window is displayed. * CFS_FORCE_POSITION: appears to behave just like CFS_POINT * maybe because the default MSIME does not do any IME adjusting. */ if (lpIMC->cfCompForm.dwStyle != CFS_DEFAULT) { POINT cpt = lpIMC->cfCompForm.ptCurrentPos; ClientToScreen(lpIMC->hWnd,&cpt); rect.left = cpt.x; rect.top = cpt.y; rect.right = rect.left + pt.x; rect.bottom = rect.top + pt.y; monitor = MonitorFromPoint(cpt, MONITOR_DEFAULTTOPRIMARY); } else /* CFS_DEFAULT */ { /* Windows places the default IME window in the bottom left */ HWND target = lpIMC->hWnd; if (!target) target = GetFocus(); GetWindowRect(target,&rect); rect.top = rect.bottom; rect.right = rect.left + pt.x + 20; rect.bottom = rect.top + pt.y + 20; offX=offY=10; monitor = MonitorFromWindow(target, MONITOR_DEFAULTTOPRIMARY); } if (lpIMC->cfCompForm.dwStyle == CFS_RECT) { RECT client; client =lpIMC->cfCompForm.rcArea; MapWindowPoints( lpIMC->hWnd, 0, (POINT *)&client, 2 ); IntersectRect(&rect,&rect,&client); /* TODO: Wrap the input if needed */ } if (lpIMC->cfCompForm.dwStyle == CFS_DEFAULT) { /* make sure we are on the desktop */ mon_info.cbSize = sizeof(mon_info); GetMonitorInfoW(monitor, &mon_info); if (rect.bottom > mon_info.rcWork.bottom)//.........这里部分代码省略.........
开发者ID:AndreRH,项目名称:wine,代码行数:101,
示例3: MsgBoxProc//.........这里部分代码省略......... } // increase width if info text requires more if ((pMsgBox->uType&MB_INFOBAR) && pMsgBox->ptszInfoText && *pMsgBox->ptszInfoText) { int multiline = 0; RECT rcico; GetClientRect(GetDlgItem(hDlg, ICO_DLGLOGO), &rcico); rcico.right = rcico.right * 100 / 66; // padding for (rs = h = pMsgBox->ptszInfoText;; ++h) { if (*h == '/n' || !*h) { GetTextExtentPoint32(hDC, rs, h - rs, &ts); ts.cx += rcico.right; if (ts.cx > txtWidth) txtWidth = ts.cx; if (!*h) break; rs = h + 1; ++multiline; } } if (!multiline) SetWindowLongPtr(GetDlgItem(hDlg, TXT_NAME), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, TXT_NAME), GWL_STYLE) | SS_CENTERIMAGE); } ReleaseDC(hDlg, hDC); // calc new dialog size GetWindowRect(hDlg, &rcDlg); GetWindowRect(GetDlgItem(hDlg, TXT_MESSAGE), &ws); needX = txtWidth - (ws.right - ws.left) - icoWidth; needY = max(0, txtHeight - (ws.bottom - ws.top) + 5); rcDlg.left -= needX / 2; rcDlg.right += needX / 2; rcDlg.top -= (needY - InfoBarHeight) / 2; rcDlg.bottom += (needY - InfoBarHeight) / 2; // resize dialog window MoveWindow(hDlg, rcDlg.left, rcDlg.top, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top, FALSE); ClientToScreen(hDlg, &mpt); MoveCtrl(hDlg, STATIC_WHITERECT, -mpt.x, -mpt.y, needX, needY - InfoBarHeight); MoveCtrl(hDlg, TXT_NAME, -mpt.x, -mpt.y, needX, 0); MoveCtrl(hDlg, ICO_DLGLOGO, -mpt.x + needX, -mpt.y, 0, 0); MoveCtrl(hDlg, ICO_MSGDLG, -mpt.x, -mpt.y - InfoBarHeight, 0, 0); MoveCtrl(hDlg, TXT_MESSAGE, -mpt.x - icoWidth, -mpt.y - InfoBarHeight, needX, needY); MoveCtrl(hDlg, STATIC_LINE2, -mpt.x, -mpt.y + needY - InfoBarHeight, needX, 0); // // Do pushbutton positioning // RECT rcOk, rcAll, rcNone, rcCancel; // get button rectangles GetWindowRect(GetDlgItem(hDlg, IDOK), &rcOk); OffsetRect(&rcOk, -mpt.x, -mpt.y + needY - InfoBarHeight); GetWindowRect(GetDlgItem(hDlg, IDALL), &rcAll); OffsetRect(&rcAll, -mpt.x, -mpt.y + needY - InfoBarHeight); GetWindowRect(GetDlgItem(hDlg, IDNONE), &rcNone); OffsetRect(&rcNone, -mpt.x, -mpt.y + needY - InfoBarHeight); GetWindowRect(GetDlgItem(hDlg, IDCANCEL), &rcCancel); OffsetRect(&rcCancel, -mpt.x, -mpt.y + needY - InfoBarHeight); LONG okWidth = rcOk.right - rcOk.left; LONG allWidth = rcAll.right - rcAll.left; LONG noneWidth = rcNone.right - rcNone.left; LONG caWidth = rcCancel.right - rcCancel.left; LONG dlgMid = (rcDlg.right - rcDlg.left) / 2;
开发者ID:kxepal,项目名称:miranda-ng,代码行数:66,
示例4: OptionsProcINT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam){ switch(msg){ case WM_INITDIALOG:{ DWORD style; g_opHdlg=hdlg; bOptionsInit=TRUE; TranslateDialogDefault(hdlg); if(g_iButtonsCount!=db_get_b(NULL, PLGNAME,"ButtonsCount", 0)) { LOGFONT logFont; HFONT hFont; bNeedRestart=TRUE; EnableWindow(GetDlgItem(hdlg,IDC_BUTTONSLIST),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_BLISTADD),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_BLISTREMOVE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MENUTREE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MTREEADD),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MTREEREMOVE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_BUTTONNAME),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MENUNAME),FALSE); ShowWindow(GetDlgItem(hdlg,IDC_WARNING),SW_SHOW); hFont = (HFONT)SendDlgItemMessage(hdlg, IDC_WARNING, WM_GETFONT, 0, 0); GetObject(hFont, sizeof(logFont), &logFont); logFont.lfWeight = FW_BOLD; hFont = CreateFontIndirect(&logFont); SendDlgItemMessage(hdlg, IDC_WARNING, WM_SETFONT, (WPARAM)hFont, 0); break; } g_iOPButtonsCount=g_iButtonsCount; hButtonsList=GetDlgItem(hdlg,IDC_BUTTONSLIST); hMenuTree=GetDlgItem(hdlg,IDC_MENUTREE); style = GetWindowLongPtr(hButtonsList,GWL_STYLE); style |=TVS_NOHSCROLL; SetWindowLongPtr(hButtonsList,GWL_STYLE, style); style = GetWindowLongPtr(hMenuTree,GWL_STYLE); style |=TVS_NOHSCROLL; SetWindowLongPtr(hMenuTree,GWL_STYLE, style); BuildButtonsList(hButtonsList); if (!TreeView_GetCount(hButtonsList)) EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE); mir_subclassWindow( GetDlgItem(hdlg,IDC_BUTTONNAME), EditSubclassProc); mir_subclassWindow( GetDlgItem(hdlg,IDC_MENUNAME), EditSubclassProc); EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE); CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=db_get_b(NULL,PLGNAME,"RClickAuto",0)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=db_get_b(NULL,PLGNAME,"LClickAuto",0)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=db_get_b(NULL, PLGNAME,"QuickMenu", 1)) ? BST_CHECKED : BST_UNCHECKED); bOptionsInit=FALSE; }break; case WM_LBUTTONUP: if(drag) { TVHITTESTINFO hti; HTREEITEM htiAfter=NULL; ButtonData* bd=NULL; TVITEM tvi; RECT rc; BYTE height; BOOLEAN bAsChild = FALSE; TreeView_SetInsertMark(hMenuTree, NULL, 0 ); ReleaseCapture(); SetCursor( LoadCursor( NULL, IDC_ARROW )); hti.pt.x = ( SHORT )LOWORD( lparam ); hti.pt.y = ( SHORT )HIWORD( lparam ); ClientToScreen(hdlg,&hti.pt); ScreenToClient(hMenuTree,&hti.pt); TreeView_HitTest( hMenuTree, &hti ); if(TreeView_GetParent(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem)) break; if(TreeView_GetChild(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem)) break; if ( hti.flags & TVHT_ABOVE ) { htiAfter = TVI_FIRST; } else if ( hti.flags & ( TVHT_NOWHERE|TVHT_BELOW )) { htiAfter = TVI_LAST; } else//.........这里部分代码省略.........
开发者ID:martok,项目名称:miranda-ng,代码行数:101,
示例5: CalendarProc//.........这里部分代码省略......... break; case WM_RBUTTONDOWN: case WM_LBUTTONDOWN: { POINT pt; GetCursorPos(&pt); m_iDay = (WORD)SelectDay(hDlg, &pt); if (m_iDay == 0) { return TRUE; } PaintCalc(hDlg); if (uMsg == WM_RBUTTONDOWN) { CString menu1, menu2, menu3, menu4; if (fMealMap[m_iDay-1] == M000) { menu1.Format(_T("+ C++ ClientUserinfoChanged函数代码示例 C++ ClientRect函数代码示例
|