本文整理汇总了C++中FrameRect函数的典型用法代码示例。如果您正苦于以下问题:C++ FrameRect函数的具体用法?C++ FrameRect怎么用?C++ FrameRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FrameRect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEmoticonSize
void EmoticonsSelectionLayout::DrawEmoticon(HDC hdc, int index, RECT fullRc)
{
Emoticon *e = ssd->module->emoticons[index];
int width, height;
GetEmoticonSize(e, width, height);
RECT rc = fullRc;
rc.left += (rc.right - rc.left - width) / 2;
rc.top += (rc.bottom - rc.top - height) / 2;
rc.right = rc.left + width;
rc.bottom = rc.top + height;
if (e->img == NULL || e->img->img == NULL)
{
if (e->texts.getCount() > 0)
{
DrawEmoticonText(hdc, e->texts[0], rc);
}
else
{
DrawEmoticonText(hdc, e->description, rc);
}
}
else
{
HDC hdc_img = CreateCompatibleDC(hdc);
HBITMAP old_bmp = (HBITMAP) SelectObject(hdc_img, e->img->img);
if (e->img->transparent)
{
BLENDFUNCTION bf = {0};
bf.SourceConstantAlpha = 255;
bf.AlphaFormat = AC_SRC_ALPHA;
AlphaBlend(hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
hdc_img, 0, 0, rc.right - rc.left, rc.bottom - rc.top, bf);
}
else
{
BitBlt(hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
hdc_img, 0, 0, SRCCOPY);
}
SelectObject(hdc_img, old_bmp);
DeleteDC(hdc_img);
}
if (selection == index)
{
rc = fullRc;
rc.left -= 2;
rc.right += 2;
rc.top -= 2;
rc.bottom += 2;
FrameRect(hdc, &rc, (HBRUSH) GetStockObject(GRAY_BRUSH));
}
}
示例2: UpdateAdditionsWin
void
UpdateAdditionsWin(void)
{
Rect r;
Cell c;
int i;
GrafPtr oldPort;
GetPort(&oldPort);
SetPort(gWPtr);
MoveTo( gControls->aw->compListBox.left, gControls->aw->compListBox.top - kInterWidgetPad + 1);
HLock(gControls->cfg->selAddMsg);
DrawString( CToPascal(*gControls->cfg->selAddMsg));
HUnlock(gControls->cfg->selAddMsg);
#if 0
RGBColor backColorOld;
Rect adjustedRect, *clRect = &gControls->aw->compListBox;
SetRect(&adjustedRect, clRect->left, clRect->top+1, clRect->right, clRect->bottom-1);
GetBackColor(&backColorOld);
BackColor(whiteColor);
EraseRect(&adjustedRect);
RGBBackColor(&backColorOld);
#endif
LUpdate( (*gControls->aw->compList)->port->visRgn, gControls->aw->compList);
SetRect(&r, gControls->aw->compListBox.left, gControls->aw->compListBox.top,
gControls->aw->compListBox.right + 1, gControls->aw->compListBox.bottom);
FrameRect(&r);
SetPt(&c, 0, 0);
if (LGetSelect(true, &c, gControls->aw->compList))
{
HLock((Handle)gControls->aw->compDescTxt);
SetRect(&r, (*gControls->aw->compDescTxt)->viewRect.left,
(*gControls->aw->compDescTxt)->viewRect.top,
(*gControls->aw->compDescTxt)->viewRect.right,
(*gControls->aw->compDescTxt)->viewRect.bottom);
HUnlock((Handle)gControls->aw->compDescTxt);
TEUpdate(&r, gControls->aw->compDescTxt);
}
DrawDiskSpaceMsgs( gControls->opt->vRefNum );
for (i = 0; i < numRows; i++)
{
if (gControls->cfg->comp[rowToComp[i]].highlighted)
{
AddInitRowHighlight(i);
break;
}
}
SetPort(oldPort);
}
示例3: draw_device_area
static void draw_device_area(
GDSpecPtr device_spec,
GDHandle selected_device,
Rect *frame)
{
Point offset;
GDHandle device;
get_device_area_offset(frame, &offset);
EraseRect(frame);
FrameRect(frame);
for (device= GetDeviceList(); device; device= GetNextDevice(device))
{
if (TestDeviceAttribute(device, screenDevice) && TestDeviceAttribute(device, screenActive))
{
GDSpec spec;
Rect bounds;
BuildExplicitGDSpec(&spec, device, device_spec->flags, device_spec->bit_depth, 0, 0);
get_device_area_frame(device, &bounds, offset);
RGBForeColor(HasDepthGDSpec(&spec) ? &rgb_dark_gray : &rgb_white);
PaintRect(&bounds);
RGBForeColor(&rgb_black);
if (device==selected_device) PenSize(2, 2);
FrameRect(&bounds);
PenSize(1, 1);
if (device==GetMainDevice())
{
bounds.bottom= bounds.top + DEVICE_AREA_MENU_BAR_HEIGHT;
EraseRect(&bounds);
FrameRect(&bounds);
}
}
}
return;
}
示例4: DrawPreview
static void DrawPreview(HWND hwnd, HDC hdc)
{
BITMAPINFO bi;
bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
bi.bmiHeader.biWidth = 8;
bi.bmiHeader.biHeight = -8;
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 32;
bi.bmiHeader.biCompression = BI_RGB;
HBITMAP hBmpBrush = CreateDIBSection(0, &bi, DIB_RGB_COLORS, 0, 0, 0);
HDC dcBmp = CreateCompatibleDC(0);
HBITMAP hBmpSave = (HBITMAP)SelectObject(dcBmp, hBmpBrush);
HBRUSH hbr = CreateSolidBrush(RGB(0xcc, 0xcc, 0xcc));
RECT rc;
SetRect(&rc, 0, 0, 8, 8);
FillRect(dcBmp, &rc, hbr);
DeleteObject(hbr);
hbr = CreateSolidBrush(RGB(0xff, 0xff, 0xff));
SetRect(&rc, 4, 0, 8, 4);
FillRect(dcBmp, &rc, hbr);
SetRect(&rc, 0, 4, 4, 8);
FillRect(dcBmp, &rc, hbr);
DeleteObject(hbr);
SelectObject(dcBmp, hBmpSave);
DeleteDC(dcBmp);
GetClientRect(hwnd, &rc);
hbr = CreatePatternBrush(hBmpBrush);
SetBrushOrgEx(hdc, 1, 1, 0);
FillRect(hdc, &rc, hbr);
DeleteObject(hbr);
DeleteObject(hBmpBrush);
if (gPreviewOk)
{
int width = min(rc.right, wndPreview->getContent()->getWidth());
int height = min(rc.bottom, wndPreview->getContent()->getHeight());
int left = (rc.right - width) / 2;
int top = (rc.bottom - height) / 2;
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 255;
bf.AlphaFormat = AC_SRC_ALPHA;
AlphaBlend(hdc, left, top, width, height,
wndPreview->getContent()->getDC(),
0, 0, width, height, bf);
}
FrameRect(hdc, &rc, GetStockBrush(LTGRAY_BRUSH));
}
示例5: GetClientRect
HBRUSH CFocusCheckbox::CtlColor(CDC* pDC, UINT nCtlColor)
{
CRect r;
GetClientRect(r);
r.InflateRect(3, 1, 1, 1);
FrameRect(pDC->m_hDC, r, GetSysColorBrush(COLOR_3DFACE));
if (GetFocus() == this)
pDC->DrawFocusRect(r);
// TODO: Return a non-NULL brush if the parent's handler should not be called
return NULL;
}
示例6: GetWidth
void CLCDMyProgressBar::OnDraw(CLCDGfxBase& rGfx)
{
// draw the border
RECT r = { 0, 0, GetWidth(), GetHeight() };
FrameRect(rGfx.GetHDC(), &r, m_hBrush);
// draw the progress
switch (m_eMyStyle) {
case STYLE_CURSOR: {
int nCursorPos = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
(float)1, (float)(GetWidth() - m_nCursorWidth - 1),
m_fPos);
r.left = nCursorPos;
r.right = r.left + m_nCursorWidth;
FillRect(rGfx.GetHDC(), &r, m_hBrush);
}
break;
case STYLE_FILLED_H:
case STYLE_FILLED_V: {
int nBar = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
0.0f, (m_eMyStyle == STYLE_FILLED_H ? (float)GetWidth() : (float)GetHeight()) - 4,
m_fPos);
r.left = r.left + 2;
r.bottom = r.bottom - 2;
if (m_eMyStyle == STYLE_FILLED_H) {
r.right = nBar + 2;
r.top = r.top + 2;
} else {
r.right = r.right - 2;
r.top = r.bottom - nBar;
}
FillRect(rGfx.GetHDC(), &r, m_hBrush);
}
break;
case STYLE_DASHED_CURSOR: {
int nCursorPos = (int)Scalef((float)m_Range.nMin, (float)m_Range.nMax,
(float)1, (float)(GetWidth() - m_nCursorWidth - 1),
m_fPos);
r.left = nCursorPos;
r.right = r.left + m_nCursorWidth;
FillRect(rGfx.GetHDC(), &r, m_hBrush);
HPEN hOldPen = (HPEN)::SelectObject(rGfx.GetHDC(), m_hPen);
::MoveToEx(rGfx.GetHDC(), 0, (r.bottom - r.top) / 2, NULL);
::LineTo(rGfx.GetHDC(), nCursorPos, (r.bottom - r.top) / 2);
::SelectObject(rGfx.GetHDC(), hOldPen);
}
break;
default:
break;
}
}
示例7: FindPos
void CPlayerPlaylistBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (nIDCtl != IDC_PLAYLIST) {
return;
}
int nItem = lpDrawItemStruct->itemID;
CRect rcItem = lpDrawItemStruct->rcItem;
POSITION pos = FindPos(nItem);
bool fSelected = pos == m_pl.GetPos();
CPlaylistItem& pli = m_pl.GetAt(pos);
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
if (!!m_list.GetItemState(nItem, LVIS_SELECTED)) {
FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
} else {
FillRect(pDC->m_hDC, rcItem, CBrush(GetSysColor(COLOR_WINDOW)));
}
COLORREF textcolor = fSelected ? 0xff : 0;
if (pli.m_fInvalid) {
textcolor |= 0xA0A0A0;
}
CString time = !pli.m_fInvalid ? m_list.GetItemText(nItem, COL_TIME) : _T("Invalid");
CSize timesize(0, 0);
CPoint timept(rcItem.right, 0);
if (time.GetLength() > 0) {
timesize = pDC->GetTextExtent(time);
if ((3 + timesize.cx + 3) < rcItem.Width() / 2) {
timept = CPoint(rcItem.right - (3 + timesize.cx + 3), (rcItem.top + rcItem.bottom - timesize.cy) / 2);
pDC->SetTextColor(textcolor);
pDC->TextOut(timept.x, timept.y, time);
}
}
CString fmt, file;
fmt.Format(_T("%%0%dd. %%s"), (int)log10(0.1 + m_pl.GetCount()) + 1);
file.Format(fmt, nItem + 1, m_list.GetItemText(nItem, COL_NAME));
CSize filesize = pDC->GetTextExtent(file);
while (3 + filesize.cx + 6 > timept.x && file.GetLength() > 3) {
file = file.Left(file.GetLength() - 4) + _T("...");
filesize = pDC->GetTextExtent(file);
}
if (file.GetLength() > 3) {
pDC->SetTextColor(textcolor);
pDC->TextOut(rcItem.left + 3, (rcItem.top + rcItem.bottom - filesize.cy) / 2, file);
}
}
示例8: switch
INT_PTR CWipeProp::OnReceiveMsg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static COLORREF acrCustomClr[16];
switch (msg)
{
case WM_DRAWITEM:
// Paint the color swatch
if (wParam == IDC_SMPTE_COLOR)
{
HBRUSH solidBrush = CreateSolidBrush(m_dwBorderColor);
DRAWITEMSTRUCT *pDraw = (DRAWITEMSTRUCT*)lParam;
FillRect(pDraw->hDC, &pDraw->rcItem, solidBrush);
FrameRect(pDraw->hDC, &pDraw->rcItem, (HBRUSH)GetStockObject(BLACK_BRUSH));
DeleteObject(solidBrush);
return TRUE;
}
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_SMPTE_PICK_COLOR:
{
// Show the Choose Color dialog to pick a new color swatch
CHOOSECOLOR cc;
ZeroMemory(&cc, sizeof(CHOOSECOLOR));
cc.lStructSize = sizeof(CHOOSECOLOR);
cc.hwndOwner = m_hDlg;
cc.lpCustColors = (LPDWORD)acrCustomClr;
cc.Flags = CC_RGBINIT;
cc.rgbResult = m_dwBorderColor;
if (ChooseColor(&cc))
{
m_dwBorderColor = cc.rgbResult;
InvalidateRect(GetDlgItem(hDlg, IDC_SMPTE_COLOR), 0, FALSE);
}
}
return TRUE;
} // inner switch
break;
}
// default
return FALSE;
}
示例9: SelectObject
int TLDisplay::DrawTitle(int x, int y, const char *title, RECT *rc, int pass, COLORREF *bgnd, COLORREF *txtcolor)
{
RECT r = {0,0,1,1};
RECT r2;
int oy = yoffs + bmpH/2;
SelectObject(bmpDC, hfont);
//
// if rc exists : only compute the rectangle & display the link
//
if((pass == 0) || (!rc))
{
DrawText(bmpDC,title, strlen(title),&r,DT_CALCRECT);
y = FindFreeYLevel(x, r.right + 2, y)*(LevelHeigth+Margin);
y += oy;
if(oy > y)
{
y -= TlineHalfH + TlineDecoH + Margin;
}
else
{
y += TlineHalfH + TlineDecoH + Margin;
}
r.left += x;
r.top += y;
r.right += x;
r.bottom += y;
if(rc)
*rc = r;
if(oy > r.bottom)
DrawVArrow(r.left, r.bottom+1, oy);
else
DrawVArrow(r.left, r.top-1, oy);
}
if((pass > 0) || (!rc)) // display the stuff
{
if(rc)
r = *rc;
r2.left = r.left-1;
r2.top = r.top-1;
r2.right = r.right+1;
r2.bottom = r.bottom+1;
FrameRect(bmpDC, &r2, hbrush_frametxt);
SetTextColor(bmpDC, txtcolor ? *txtcolor : TextColor);
SetBkMode(bmpDC, OPAQUE);
SetBkColor(bmpDC, bgnd ? *bgnd : TextBgndColor);
DrawText(bmpDC,title, strlen(title),&r,DT_LEFT);//DT_CALCRECT);
}
return 0;
}
示例10: FillRect
// 画验证码
void CLoginDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (nIDCtl == m_verifyCodePicture.GetDlgCtrlID())
{
FillRect(lpDrawItemStruct->hDC, &lpDrawItemStruct->rcItem, (HBRUSH)GetStockObject(WHITE_BRUSH));
if (!m_verifyImage.IsNull())
m_verifyImage.Draw(lpDrawItemStruct->hDC, lpDrawItemStruct->rcItem);
FrameRect(lpDrawItemStruct->hDC, &lpDrawItemStruct->rcItem, (HBRUSH)GetStockObject(BLACK_BRUSH));
return;
}
CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
}
示例11: PaintFrameRect
//
// Draw a colour rectangle with border
//
void PaintFrameRect(HDC hdc, RECT *rect, COLORREF border, COLORREF fill)
{
HBRUSH hbrFill = CreateSolidBrush(fill);
HBRUSH hbrBorder = CreateSolidBrush(border);
FrameRect(hdc, rect, hbrBorder);
InflateRect(rect, -1, -1);
FillRect(hdc, rect, hbrFill);
InflateRect(rect, 1, 1);
DeleteObject(hbrFill);
DeleteObject(hbrBorder);
}
示例12: draw_main_screen
void draw_main_screen()
{
RECT draw_rect,big_rect = {-1,-1,582,414};
HBRUSH new_brush;
COLORREF y = RGB(128,128,128);//y = RGB(119,119,119);
// draw left buttons (always active)
draw_lb();
// draw right buttons (only when not editing terrain)
if (overall_mode >= 60) {
draw_rect.left = RIGHT_AREA_UL_X;
draw_rect.top = RIGHT_AREA_UL_Y;
draw_rect.right = RIGHT_AREA_UL_X + RIGHT_AREA_WIDTH - 16;
draw_rect.bottom = RIGHT_AREA_UL_Y + RIGHT_AREA_HEIGHT;
//c = GetNearestPaletteIndex(hpal,y);
new_brush = CreateSolidBrush(y);
OffsetRect(&draw_rect,ulx,uly);
FrameRect(main_dc,&draw_rect,new_brush);
OffsetRect(&big_rect,ulx,uly);
if (ulx > 40)
FrameRect(main_dc,&big_rect,new_brush);
DeleteObject(new_brush);
InsetRect(&draw_rect,1,1);
OffsetRect(&draw_rect,-1 * ulx,-1 * uly);
paint_pattern(NULL,1,draw_rect,3);
draw_rb();
}
// draw terrain palette
if ((overall_mode < 60) || (overall_mode == 62)) {
place_location();
}
}
示例13: GetSplineRect
void CBaseEventPropertiesDialog::DrawSpline( HDC hdc, HWND placeholder, CChoreoEvent *e )
{
RECT rcOut;
GetSplineRect( placeholder, rcOut );
HBRUSH bg = CreateSolidBrush( GetSysColor( COLOR_BTNFACE ) );
FillRect( hdc, &rcOut, bg );
DeleteObject( bg );
if ( !e )
return;
// Draw spline
float range = ( float )( rcOut.right - rcOut.left );
if ( range <= 1.0f )
return;
float height = ( float )( rcOut.bottom - rcOut.top );
HPEN pen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNTEXT ) );
HPEN oldPen = (HPEN)SelectObject( hdc, pen );
float duration = e->GetDuration();
float starttime = e->GetStartTime();
for ( int i = 0; i < (int)range; i++ )
{
float frac = ( float )i / ( range - 1 );
float scale = 1.0f - e->GetIntensity( starttime + frac * duration );
int h = ( int ) ( scale * ( height - 1 ) );
if ( i == 0 )
{
MoveToEx( hdc, rcOut.left + i, rcOut.top + h, NULL );
}
else
{
LineTo( hdc, rcOut.left + i, rcOut.top + h );
}
}
SelectObject( hdc, oldPen );
HBRUSH frame = CreateSolidBrush( GetSysColor( COLOR_BTNSHADOW ) );
InflateRect( &rcOut, 1, 1 );
FrameRect( hdc, &rcOut, frame );
DeleteObject( frame );
}
示例14: UNREFERENCED_PARAMETER
void CEditListEditor::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (nIDCtl != IDC_EDITLIST) {
return;
}
int nItem = lpDrawItemStruct->itemID;
CRect rcItem = lpDrawItemStruct->rcItem;
POSITION pos = m_editList.FindIndex(nItem);
if (pos) {
bool fSelected = (pos == m_curPos);
UNREFERENCED_PARAMETER(fSelected);
CClip& curClip = m_editList.GetAt(pos);
CString strTemp;
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
if (!!m_list.GetItemState(nItem, LVIS_SELECTED)) {
FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
} else {
FillRect(pDC->m_hDC, rcItem, CBrush(GetSysColor(COLOR_WINDOW)));
}
COLORREF textcolor = RGB(0, 0, 0);
if (!curClip.HaveIn() || !curClip.HaveOut()) {
textcolor = RGB(255, 0, 0);
}
for (int i = 0; i < COL_MAX; i++) {
m_list.GetSubItemRect(nItem, i, LVIR_LABEL, rcItem);
pDC->SetTextColor(textcolor);
switch (i) {
case COL_INDEX:
strTemp.Format(_T("%d"), nItem + 1);
pDC->DrawText(strTemp, rcItem, DT_CENTER | DT_VCENTER);
break;
case COL_IN:
pDC->DrawText(curClip.GetIn(), rcItem, DT_CENTER | DT_VCENTER);
break;
case COL_OUT:
pDC->DrawText(curClip.GetOut(), rcItem, DT_CENTER | DT_VCENTER);
break;
case COL_NAME:
pDC->DrawText(curClip.GetName(), rcItem, DT_LEFT | DT_VCENTER);
break;
}
}
}
}
示例15: slide_stamps
void slide_stamps(void)
{
int i;
bitmap *b = thePort->portBMap;
if (stamp_err)
{
stamp_err = 0;
return;
}
HideCursor();
for (i = 2; i > 0; i--)
{
CopyBits(b, b, &stampingR[i - 1], &stampingR[i], &stampingR[i], zREPz);
PenColor(WHITE);
FrameRect(&stampingR[i]);
}
CopyBits(b, b, &stampR, &stampingR[0], &stampingR[0], zREPz);
FrameRect(&stampingR[0]);
ShowCursor();
}