本文整理汇总了C++中RectWidth函数的典型用法代码示例。如果您正苦于以下问题:C++ RectWidth函数的具体用法?C++ RectWidth怎么用?C++ RectWidth使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RectWidth函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComputeSourceX
void CObjectImageArray::PaintImageGrayed (CG16bitImage &Dest, int x, int y, int iTick, int iRotation) const
// PaintImageGrayed
//
// Paints the image on the destination
{
if (m_pImage)
{
CG16bitImage *pSource = m_pImage->GetImage();
if (pSource == NULL)
return;
int xSrc = ComputeSourceX(iTick);
if (m_pRotationOffset)
{
x += m_pRotationOffset[iRotation % m_iRotationCount].x;
y -= m_pRotationOffset[iRotation % m_iRotationCount].y;
}
Dest.BltGray(xSrc,
m_rcImage.top + (iRotation * RectHeight(m_rcImage)),
RectWidth(m_rcImage),
RectHeight(m_rcImage),
128,
*pSource,
x - (RectWidth(m_rcImage) / 2),
y - (RectHeight(m_rcImage) / 2));
}
}
示例2: RectWidth
void CObjectImageArray::CopyImage (CG16bitImage &Dest, int x, int y, int iFrame, int iRotation) const
// CopyImage
//
// Copies entire image to the destination
{
if (m_pImage)
{
CG16bitImage *pSource = m_pImage->GetImage();
if (pSource == NULL)
return;
int xSrc = m_rcImage.left + (iFrame * RectWidth(m_rcImage));
int ySrc = m_rcImage.top + (iRotation * RectHeight(m_rcImage));
Dest.Blt(xSrc,
ySrc,
RectWidth(m_rcImage),
RectHeight(m_rcImage),
*pSource,
x,
y);
Dest.CopyAlpha(xSrc,
ySrc,
RectWidth(m_rcImage),
RectHeight(m_rcImage),
*pSource,
x,
y);
}
}
示例3: CalcTextRect
void CGTextArea::Paint (CG32bitImage &Dest, const RECT &rcRect)
// Paint
//
// Handle paint
{
RECT rcText = CalcTextRect(rcRect);
// Paint the background
if (m_iBorderRadius > 0)
CGDraw::RoundedRect(Dest, rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), m_iBorderRadius, m_rgbBackColor);
else
Dest.Fill(rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), m_rgbBackColor);
// Paint the editable box
if (m_bEditable)
{
CG32bitPixel rgbBorderColor = CG32bitPixel::Blend(CG32bitPixel(0, 0, 0), m_rgbColor, (BYTE)128);
CGDraw::RectOutlineDotted(Dest, rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), rgbBorderColor);
}
// Paint the content
if (!m_sText.IsBlank())
PaintText(Dest, rcText);
else
PaintRTF(Dest, rcText);
}
示例4: ComputeSourceX
void CObjectImageArray::PaintSilhoutte (CG16bitImage &Dest,
int x,
int y,
int iTick,
int iRotation,
COLORREF wColor) const
// PaintSilhouette
//
// Paints a silhouette of the object
{
if (m_pImage)
{
CG16bitImage &Source(*m_pImage->GetImage());
int xSrc = ComputeSourceX(iTick);
if (m_pRotationOffset)
{
x += m_pRotationOffset[iRotation % m_iRotationCount].x;
y -= m_pRotationOffset[iRotation % m_iRotationCount].y;
}
Dest.FillMask(xSrc,
m_rcImage.top + (iRotation * RectHeight(m_rcImage)),
RectWidth(m_rcImage),
RectHeight(m_rcImage),
Source,
wColor,
x - (RectWidth(m_rcImage) / 2),
y - (RectHeight(m_rcImage) / 2));
}
}
示例5: DockPanel_GetMinMaxInfo
LRESULT DockPanel_GetMinMaxInfo(DOCKPANEL *dpp, MINMAXINFO *pmmi)
{
if(dpp && (dpp->dwStyle & DWS_FIXED_SIZE))
{
RECT rect;
GetClientRect(dpp->hwndContents, &rect);
AdjustRectBorders(dpp, &rect, 1);
CalcFloatingRect(dpp->hwndPanel, &rect);
if(dpp->dwStyle & DWS_FIXED_HORZ)
{
pmmi->ptMaxTrackSize.x = RectWidth(&rect);
pmmi->ptMinTrackSize.x = RectWidth(&rect);
}
if(dpp->dwStyle & DWS_FIXED_VERT)
{
pmmi->ptMaxTrackSize.y = RectHeight(&rect);
pmmi->ptMinTrackSize.y = RectHeight(&rect);
}
}
return 0;
}
示例6: CVector
void CAniTextInput::Create (const RECT &rcRect,
const CG16bitFont *pFont,
DWORD dwOptions,
IAnimatron **retpAni)
// Create
//
// Creates text with basic attributes
{
// Create
CAniTextInput *pText = new CAniTextInput;
pText->SetPropertyVector(PROP_POSITION, CVector(rcRect.left, rcRect.top));
pText->SetPropertyFont(PROP_FONT, pFont);
// Make sure size is big enough to fit font
if (pFont)
{
int cyMin = pFont->GetHeight() + PADDING_TOP + PADDING_BOTTOM;
if (cyMin > RectHeight(rcRect))
pText->SetPropertyVector(PROP_SCALE, CVector(RectWidth(rcRect), cyMin));
else
pText->SetPropertyVector(PROP_SCALE, CVector(RectWidth(rcRect), RectHeight(rcRect)));
}
// Options
if (dwOptions & OPTION_PASSWORD)
pText->m_bPassword = true;
*retpAni = pText;
}
示例7: CreateDialogParam
void OverlayElementEditor::CreateEditorWindow()
{
m_Self = CreateDialogParam(GetWindowInstance(m_Parent), MAKEINTRESOURCE(m_ResourceId), m_Parent,
s_DialogProc, (LPARAM)this);
if (m_Self)
{
RECT parentRc;
GetWindowRect(m_Parent, &parentRc);
RECT rc;
GetWindowRect(m_Self, &rc);
// Position the editor depending on owner window position.
RECT selfRect;
selfRect.right = parentRc.right;
selfRect.top = parentRc.top;
selfRect.left = selfRect.right - RectWidth(rc);
selfRect.bottom = selfRect.top + RectHeight(rc);
MoveWindow(m_Self, selfRect.left, selfRect.top, RectWidth(rc), RectHeight(rc), FALSE);
// Make window semi-transparent.
SetWindowLong(m_Self, GWL_EXSTYLE, GetWindowLong(m_Self, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(m_Self, RGB(0, 0, 0), 220, LWA_ALPHA);
}
}
示例8: CalcTextRect
int CGButtonArea::Justify (const RECT &rcRect)
// Justify
//
// Justify the text and return the height (in pixels)
{
RECT rcText = CalcTextRect(rcRect);
// For now, the label is always one line
int cyHeight = (m_pLabelFont ? m_pLabelFont->GetHeight() : 0);
// Add the height of the description, if we have one
if (!m_sDesc.IsBlank() && m_pDescFont)
{
if (m_cxJustifyWidth != RectWidth(rcText))
{
m_cxJustifyWidth = RectWidth(rcText);
m_Lines.DeleteAll();
m_pDescFont->BreakText(m_sDesc, m_cxJustifyWidth, &m_Lines, CG16bitFont::SmartQuotes);
}
cyHeight += (m_Lines.GetCount() * m_pDescFont->GetHeight());
}
// Add padding
cyHeight += m_rcPadding.top + m_rcPadding.bottom;
return cyHeight;
}
示例9: Layout
void COptionView::Layout(bool Redraw /* = true */)
{
CWSFrameView::Layout(FALSE);
::MoveWindow(m_OptionView.GetHwnd(),m_rcClient.left,m_rcClient.top,RectWidth(m_rcClient),RectHeight(m_rcClient)-24,TRUE);
::MoveWindow(m_FooterBar.GetHwnd(),m_rcClient.left,m_rcClient.bottom-24,RectWidth(m_rcClient),24,TRUE);
}
示例10: GetClientRect
LRESULT CAddressBar::OnPaint(){
RECT rcViewport;
GetClientRect(m_hWnd,&rcViewport);
PAINTSTRUCT ps;
HDC hdc = BeginPaint(m_hWnd, &ps);
if(rcViewport.right==rcViewport.left || rcViewport.top==rcViewport.bottom){
::EndPaint(m_hWnd, &ps);
return 0;
}
HDC DCMem = ::CreateCompatibleDC(hdc);
HBITMAP bmpCanvas=::CreateCompatibleBitmap(hdc, RectWidth(rcViewport),RectHeight(rcViewport));
assert(bmpCanvas);
HBITMAP OldBitmap = (HBITMAP)::SelectObject(DCMem, bmpCanvas );
if(m_State & SPACE_SHOWBKG){
FillRect(DCMem,rcViewport,m_crViewBkg);
}
UINT OldMode = ::SetBkMode(DCMem,TRANSPARENT );
HFONT pOldFont=NULL;
if (m_bConnected)
{
m_ConnectBnt.m_Name = _T("Break");
m_ConnectBnt.Draw(DCMem);
}else{
m_ConnectBnt.m_Name = _T("Connect");
m_ConnectBnt.Draw(DCMem);
}
COLORREF Oldcr = ::SetTextColor(DCMem,RGB(0,0,0));
RECT rc = rcViewport;
rc.left+=4;
rc.right -= 100;
if(rc.right<rc.left)rc.right=rc.left;
::DrawText(DCMem,m_CurAddress.c_str(),m_CurAddress.size(),&rc,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
if(pOldFont)::SelectObject(DCMem, pOldFont );
::SetBkMode(DCMem, OldMode );
if(m_State & SPACE_SHOWWINBORDER){
DrawEdge(DCMem,rcViewport,m_crWinBorder);// Border
}
::BitBlt(hdc, 0, 0, RectWidth(rcViewport), RectHeight(rcViewport), DCMem, 0, 0, SRCCOPY );
::SelectObject(DCMem, OldBitmap );
::DeleteObject(bmpCanvas);
::DeleteDC(DCMem);
::EndPaint(m_hWnd, &ps);
return 0;
}
示例11: CenterWindow
void CenterWindow(HWND wnd)
{
RECT parent, my;
GetWindowRect(GetParent(wnd), &parent);
GetWindowRect(wnd, &my);
MoveWindow(wnd, parent.left + (RectWidth(parent) - RectWidth(my)) / 2, parent.top + (RectHeight(parent) - RectHeight(my)) / 2,
RectWidth(my), RectHeight(my), TRUE);
}
示例12: CalculateNonClientArea
RECT CalculateNonClientArea(HWND hwnd)
{
RECT window, client, nonclient;
GetWindowRect(hwnd, &window), GetClientRect(hwnd, &client);
int nonClientWidth = RectWidth(window) - RectWidth(client),
nonClientHeight = RectHeight(window) - RectHeight(client);
nonclient.top = nonclient.left = 0;
nonclient.right = nonClientWidth; nonclient.bottom = nonClientHeight;
return nonclient;
}
示例13: StopPerformance
void CLoadGameSession::CmdReadComplete (CListSaveFilesTask *pTask)
// CmdReadComplete
//
// We've finished loading the list of games
{
const CVisualPalette &VI = m_HI.GetVisuals();
RECT rcRect;
VI.GetWidescreenRect(m_HI.GetScreen(), &rcRect);
// Done with wait animation
StopPerformance(ID_CTRL_WAIT);
// Check for error
CString sError;
if (pTask->GetResult(&sError) != NOERROR)
{
IAnimatron *pMsg;
VI.CreateMessagePane(NULL, ID_MESSAGE, ERR_TITLE, strPatternSubst(ERR_DESC, sError), rcRect, 0, &pMsg);
StartPerformance(pMsg, ID_MESSAGE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
return;
}
// If we have no entries, then show a message
IAnimatron *pList = pTask->GetListHandoff();
if (pList->GetPropertyInteger(PROP_COUNT) == 0)
{
delete pList;
IAnimatron *pMsg;
VI.CreateMessagePane(NULL, ID_MESSAGE, ERR_NO_ENTRIES, ERR_NO_ENTRIES_DESC, rcRect, 0, &pMsg);
StartPerformance(pMsg, ID_MESSAGE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
return;
}
// Show the profile
RECT rcList;
pList->GetSpacingRect(&rcList);
pList->SetPropertyVector(PROP_POSITION, CVector(rcRect.left + (RectWidth(rcRect) - RectWidth(rcList)) / 2, rcRect.top));
pList->SetPropertyVector(PROP_SCALE, CVector(SAVE_ENTRY_WIDTH, RectHeight(rcRect)));
pList->SetPropertyMetric(PROP_VIEWPORT_HEIGHT, (Metric)RectHeight(rcRect));
RegisterPerformanceEvent(pList, EVENT_ON_DOUBLE_CLICK, CMD_OK_SESSION);
StartPerformance(pList, ID_LIST, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
}
示例14: CVector
void CMessageSession::CreateDlgMessage (IAnimatron **retpDlg)
// CreateDlgMessage
//
// Creates the message dialog box
{
const CVisualPalette &VI = m_HI.GetVisuals();
const CG16bitFont &MediumFont = VI.GetFont(fontMedium);
// Figure out where the login dialog box will appear
RECT rcCenter;
VI.GetWidescreenRect(m_HI.GetScreen(), &rcCenter);
RECT rcDlg = rcCenter;
int cyDlg = 10 * VI.GetFont(fontLarge).GetHeight();
rcDlg.top = rcCenter.top + (RectHeight(rcCenter) - cyDlg) / 2;
rcDlg.left = rcCenter.left + (RectWidth(rcCenter) - DLG_WIDTH) / 2;
rcDlg.right = rcDlg.left + DLG_WIDTH;
rcDlg.bottom = rcDlg.top + cyDlg;
// Create the dialog box and a container for the controls
IAnimatron *pDlg;
CAniSequencer *pContainer;
VI.CreateStdDialog(rcDlg, m_sTitle, &pDlg, &pContainer);
int y = 0;
// Add the message
IAnimatron *pMessage = new CAniText;
pMessage->SetPropertyVector(PROP_POSITION, CVector(0, y));
pMessage->SetPropertyVector(PROP_SCALE, CVector(RectWidth(rcDlg), RectHeight(rcDlg)));
pMessage->SetPropertyColor(PROP_COLOR, VI.GetColor(colorTextDialogInput));
pMessage->SetPropertyFont(PROP_FONT, &MediumFont);
pMessage->SetPropertyString(PROP_TEXT, m_sMessage);
pContainer->AddTrack(pMessage, 0);
// Add close button at the bottom
IAnimatron *pButton;
int xButtons = (RectWidth(rcDlg) - DEFAULT_BUTTON_WIDTH) / 2;
int yButtons = RectHeight(rcDlg) - DEFAULT_BUTTON_HEIGHT;
VI.CreateButton(pContainer, CMD_CLOSE, xButtons, yButtons, DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT, CVisualPalette::OPTION_BUTTON_DEFAULT, CONSTLIT("OK"), &pButton);
RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_CLOSE);
// Done
*retpDlg = pDlg;
}
示例15: DockWnd_DeferPanelPos
HDWP DockWnd_DeferPanelPos(HDWP hdwp, HWND hwndMain, RECT *rect)
{
DOCKSERVER *dsp = GetDockServer(hwndMain);
DOCKPANEL *dpp;
if(dsp == 0)
return 0;
CopyRect(&dsp->DockRect, rect);
CopyRect(&dsp->ClientRect, rect);
for(dpp = dsp->PanelListHead; dpp; dpp = dpp->flink)
{
RECT rc = *rect;
RECT rc2;
if(dpp->fDocked == FALSE || dpp->fVisible == FALSE)
{
continue;
}
GetPanelClientSize(dpp, &rc2, TRUE);
if(dpp->dwStyle & DWS_DOCKED_LEFT)
{
rc.right = rc.left + RectWidth(&rc2);
}
else if(dpp->dwStyle & DWS_DOCKED_RIGHT)
{
rc.left = rc.right - RectWidth(&rc2);
}
else if(dpp->dwStyle & DWS_DOCKED_TOP)
{
rc.bottom = rc.top + RectHeight(&rc2);
}
else if(dpp->dwStyle & DWS_DOCKED_BOTTOM)
{
rc.top = rc.bottom - RectHeight(&rc2);
}
SubtractRect(rect, rect, &rc);
hdwp = DeferWindowPos(hdwp, dpp->hwndPanel, 0, rc.left, rc.top, rc.right-rc.left,rc.bottom-rc.top,
SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW);
}
CopyRect(&dsp->ClientRect, rect);
return hdwp;
}