本文整理汇总了C++中DisplayModel::CvtFromScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ DisplayModel::CvtFromScreen方法的具体用法?C++ DisplayModel::CvtFromScreen怎么用?C++ DisplayModel::CvtFromScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DisplayModel
的用法示例。
在下文中一共展示了DisplayModel::CvtFromScreen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSelectionStart
void OnSelectionStart(WindowInfo* win, int x, int y, WPARAM key) {
UNUSED(key);
CrashIf(!win->AsFixed());
DeleteOldSelectionInfo(win, true);
win->selectionRect = RectI(x, y, 0, 0);
win->showSelection = true;
win->mouseAction = MouseAction::Selecting;
bool isShift = IsShiftPressed();
bool isCtrl = IsCtrlPressed();
// Ctrl+drag forces a rectangular selection
if (!isCtrl || isShift) {
DisplayModel* dm = win->AsFixed();
int pageNo = dm->GetPageNoByPoint(PointI(x, y));
if (dm->ValidPageNo(pageNo)) {
PointD pt = dm->CvtFromScreen(PointI(x, y), pageNo);
dm->textSelection->StartAt(pageNo, pt.x, pt.y);
win->mouseAction = MouseAction::SelectingText;
}
}
SetCapture(win->hwndCanvas);
SetTimer(win->hwndCanvas, SMOOTHSCROLL_TIMER_ID, SMOOTHSCROLL_DELAY_IN_MS, nullptr);
win->RepaintAsync();
}
示例2: UpdateTextSelection
void UpdateTextSelection(WindowInfo* win, bool select) {
if (!win->AsFixed())
return;
DisplayModel* dm = win->AsFixed();
if (select) {
int pageNo = dm->GetPageNoByPoint(win->selectionRect.BR());
if (win->ctrl->ValidPageNo(pageNo)) {
PointD pt = dm->CvtFromScreen(win->selectionRect.BR(), pageNo);
dm->textSelection->SelectUpTo(pageNo, pt.x, pt.y);
}
}
DeleteOldSelectionInfo(win);
win->currentTab->selectionOnPage = SelectionOnPage::FromTextSelect(&dm->textSelection->result);
win->showSelection = win->currentTab->selectionOnPage != nullptr;
if (win->uia_provider)
win->uia_provider->OnSelectionChanged();
}