本文整理汇总了C++中Rect::CenterPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::CenterPos方法的具体用法?C++ Rect::CenterPos怎么用?C++ Rect::CenterPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::CenterPos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Paint
virtual void Paint(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword style) const
{
w.DrawRect(r, paper);
Image m = q;
if(!IsNull(m)) {
Size sz = GetFitSize(m.GetSize(), r.Size());
Point p = r.CenterPos(sz);
w.DrawImage(p.x, p.y, CachedRescale(m, sz));
}
}
示例2: Paint
virtual void Paint(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword style) const
{
w.DrawRect(r, paper);
Image m = q;
if(IsNull(m))
return;
Size isz = m.GetSize();
if(isz.cx > 200 || isz.cy > 200)
m = IconDesImg::LargeImage();
else
if(isz.cx > r.GetWidth() || isz.cy > r.GetHeight())
m = CachedRescale(m, GetFitSize(m.GetSize(), r.GetSize()));
Point p = r.CenterPos(m.GetSize());
w.DrawImage(p.x, p.y, m);
}
示例3: Proc
BOOL CALLBACK Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_INITDIALOG: {
Rect wr;
SystemParametersInfo(SPI_GETWORKAREA, 0, wr, 0);
Rect dr;
GetWindowRect(hwnd, dr);
Point p = wr.CenterPos(dr.Size());
SetWindowPos(hwnd, 0, p.x, p.y, dr.Width(), dr.Height(),
SWP_SHOWWINDOW|SWP_NOOWNERZORDER|SWP_NOZORDER);
SetWindowText(GetDlgItem(hwnd, 101), "C:\\upp");
SendDlgItemMessage(hwnd, 101, EM_SETSEL, (WPARAM) 0, (LPARAM) -1);
SetWindowText(hwnd, GetExeTitle());
break;
}
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK: {
char h[2048];
GetWindowText(GetDlgItem(hwnd, 101), h, 2048);
String exe = AppendFileName(h, "theide.exe");
if(FileExists(exe)) {
MessageBox(::GetActiveWindow(),
"Please uninstall previous version before installing the new one.",
"Ultimate++", MB_ICONSTOP | MB_OK | MB_APPLMODAL);
WinExec(exe + " -uninstall", SW_SHOWNORMAL);
break;
}
ProgressMeter pi;
pi.SetText("Installing files");
HRSRC hrsrc = FindResource(NULL, LPCTSTR(1112), RT_RCDATA);
if(!hrsrc) Error();
outdir = h;
LZMAExtract((const char *)LockResource(LoadResource(NULL, hrsrc)), SizeofResource(NULL, hrsrc),
h, pi);
if (BST_CHECKED == SendDlgItemMessage(hwnd, 10 /*IDC_ASSOC*/, BM_GETCHECK, 0, 0)) {
SetWinRegString(exe, "", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\theide.exe\\");
SetWinRegString(h, "Path", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\theide.exe\\");
SetWinRegString("TheIDE.upp", "", ".upp\\", HKEY_CLASSES_ROOT);
SetWinRegString("open", "", "TheIDE.upp\\shell\\", HKEY_CLASSES_ROOT);
SetWinRegString("\"" + exe + "\" \"%1\"", "", "TheIDE.upp\\shell\\open\\command\\", HKEY_CLASSES_ROOT);
}
pi.Destroy();
FileMove(AppendFileName(h, IsWow64() ? "theide64.exe" : "theide32.exe"), exe);
EndDialog(hwnd, 0);
WinExec(exe, SW_SHOWNORMAL);
break;
}
case 999: {
BOOL retVal;
char Folder[256] = "C:\\";
char FolderName[17] = "Select Directory";
if(BrowseFolder( 0, Folder, FolderName)) {
strcat(Folder, "\\upp");
SetWindowText(GetDlgItem(hwnd, 101), Folder);
}
break;
}
case IDCANCEL:
EndDialog(hwnd, 0);
break;
}
}
return 0;
}