本文整理汇总了C++中TRect函数的典型用法代码示例。如果您正苦于以下问题:C++ TRect函数的具体用法?C++ TRect怎么用?C++ TRect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rect
//////////////////////////////////////////////////////////////////////////
//From CControl
//////////////////////////////////////////////////////////////////////////
void CSelectGroup::Draw(CGraphic& gc)const
{
TInt index=0;
for(TInt i=0; i<iMaxLinePerPage; i++)
{
index=i+iFirstIndex;
if(index>=iSelectArray.Count())
break;
if(index==iSelectedIndex)
{
TRect rect(iStartPoint+TPoint(0,i*iLineHeight),iItemSize);
gc.SetPenColor(KPopMenuRectColor);
gc.SetPenStyle(CGraphicsContext::ESolidPen);
gc.SetBrushColor(KNaviPaneSelectedItemColor);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(rect);
gc.SetBrushStyle(CGraphicsContext::ENullBrush);
gc.SetPenColor(KRgbWhite);
}
iSelectArray[index]->DrawItem(gc,TRect(iStartPoint+TPoint(0,i*iLineHeight),iItemSize));
}
if(iScrollbar)
iScrollbar->Draw(gc);
}
示例2: TBitmap
//
/// Resize the CelArray by re-allocating the bitmap(s) to the new size and copying
/// over.
//
bool
TCelArray::Resize(int newCount)
{
// Can't resize--the bitmap is not ours
//
if (!ShouldDelete)
return false;
TBitmap* bitmap = new TBitmap(TScreenDC(), CSize.cx*newCount, CSize.cy*NRows);
// Copy old bitmap if there is one
//
if (Bitmap) {
TMemoryDC srcDC(*Bitmap);
TMemoryDC dstDC(*bitmap);
dstDC.BitBlt(TRect(0, 0, CSize.cx*NCels, CSize.cy*NRows), srcDC, TPoint(0));
// Cleanup old bitmap
//
srcDC.RestoreBitmap();
delete Bitmap;
}
// Update bitmap data member
//
Bitmap = bitmap;
// Update total number of Cels
//
NCels = newCount;
return true;
}
示例3: __LOGSTR1
void CButton::Draw()
{
iWindow.SetPosition(TPoint(0,iScreenSize.iY-60));
iWindow.SetSize(TSize(iScreenSize.iX,60));
iWindow.SetVisible(ETrue);
TInt i = iScreenSize.iY-60;
__LOGSTR1("i: %d",i);
iGc->Activate(iWindow);
iRectButton = TRect(TPoint(0,0),TSize(iScreenSize.iX,60));
iWindow.Invalidate();
iWindow.BeginRedraw();
iGc->Clear();
iGc->SetPenColor(iColor);
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
iGc->UseFont(iFont);
iGc->SetPenColor(KRgbBlue);
iGc->SetBrushColor(KRgbGray);
iGc->Clear(iRectButton);
iGc->DrawText(_L("Демо(Пропустить)"),iRectButton/*TRect(0,0, iRectButton.Width(),iRectButton.Height())*/,60-iFont->FontMaxAscent(), CGraphicsContext::ECenter, 0);
/*iGc->SetPenColor(KRgbSilver);
iGc->DrawLine(TPoint(iScreenSize.iX/2,0),TPoint(iScreenSize.iX-1,0));//горизонтальная сверху
iGc->DrawLine(TPoint(iScreenSize.iX-1,0),TPoint(iScreenSize.iX-1,60));//Вертикальная справа
iGc->DrawLine(TPoint(iScreenSize.iX/2,59),TPoint(iScreenSize.iX,59));//Горизонтальная снизу
iGc->DrawLine(TPoint(iScreenSize.iX/2,0),TPoint(iScreenSize.iX/2,60));//Вертикальная справа
*/
iWindow.EndRedraw();
iGc->Deactivate();
iWs.Flush();
}
示例4: CreateWindowL
void CSliderControl::ConstructFromResourceL(TResourceReader& reader)
{
iVal=0;
CreateWindowL();
InitComponentArrayL();
iLabel = new (ELeave) CEikLabel;
iLabel->SetContainerWindowL(*this);
TRgb lbc;
MAknsSkinInstance* skin=AknsUtils::SkinInstance();
AknsUtils::GetCachedColor(skin,lbc,KAknsIIDQsnTextColors,EAknsCIQsnTextColorsCG6 );
iLabel->OverrideColorL(EColorLabelText,lbc);
iLabel->SetAlignment(EHCenterVCenter);
iLabel->SetBrushStyle(CGraphicsContext::ENullBrush);
iLabel->MakeVisible(ETrue);
iLabel->SetTextL(reader.ReadTPtrC16());
Components().AppendLC(iLabel);
CleanupStack::Pop(iLabel);
_LIT(KDesCEmpty,"");
iSlider = new (ELeave) CSliderForDialog(KDesCEmpty,0,255);
iSlider->ConstructL(this);
iSlider->SetContainerWindowL(*this);
iSlider->MakeVisible(ETrue);
Components().AppendLC(iSlider);
CleanupStack::Pop(iSlider);
//SetExtentToWholeScreen();
iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,TRect(TPoint(0,0),CEikonEnv::Static()->ScreenDevice()->SizeInPixels()),ETrue);
ActivateL();
_LOGDATA2(_L("Window pos: %d,%d"),Window().Position().iX,Window().Position().iY);
_LOGDATA2(_L("Window size: %d,%d"),Window().Size().iWidth,Window().Size().iHeight);
}
示例5: OwlCopyBmp
//
/// Copy specified bitmap to the destination DC
//
bool
OwlCopyBmp(TBitmap& dstBM, const TBitmap& srcBM, const TPoint& pt, const TSize& size, const TPoint offset)
{
TMemoryDC srcDC(CONST_CAST(TBitmap&, srcBM));
TMemoryDC dstDC(dstBM);
return dstDC.BitBlt(TRect(pt, size), srcDC, offset);
}
示例6: TPoint
void CTap2CloseAppUi::ScreenChanged()
{
TInt scrX=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth;
//iButton->SetIconSize(KSize);
iButton->SetRect(TRect ( TPoint(scrX-KSize.iWidth,0),KSize));
iButton->SetPosition( TPoint(scrX-KSize.iWidth,0));
}
示例7: getDragType
int ImageViewer::getDragType(const TPoint &pos, const TRect &loadbox) {
if (loadbox == TRect()) return eDrawRect;
int ret = 0, dx = std::min(abs(loadbox.x0 - pos.x), abs(loadbox.x1 - pos.x)),
dy = std::min(abs(loadbox.y0 - pos.y), abs(loadbox.y1 - pos.y));
if (dx > 10 && dy > 10)
return (loadbox.contains(pos)) ? eMoveRect : eDrawRect;
if (dx <= 10 && pos.y >= loadbox.y0 - 10 && pos.y <= loadbox.y1 + 10) {
if (dx == abs(loadbox.x0 - pos.x))
ret = eMoveLeft;
else if (dx == abs(loadbox.x1 - pos.x))
ret = eMoveRight;
} else if (dy <= 10 && pos.x >= loadbox.x0 - 10 && pos.x <= loadbox.x1 + 10) {
if (dy == abs(loadbox.y0 - pos.y))
return eMoveDown;
else
return eMoveUp;
} else
return eDrawRect;
if (dy > 10) return ret;
return ret | (dy == (abs(loadbox.y0 - pos.y)) ? eMoveDown : eMoveUp);
}
示例8: clip
void CEdgedWin::DrawBitmap(CFbsBitGc* aGc, TRect& aClip, TPoint& aOrigin)
{
aGc->Reset();
TPoint origin = iPos + aOrigin;
aGc->SetOrigin(origin);
TRect clip(origin, iSize);
clip.Intersection(aClip);
clip.Move(-origin);
aGc->SetClippingRect(clip);
aGc->SetPenStyle(iPenStyle);
aGc->SetBrushStyle(iBrushStyle);
//draw outer rectangle
aGc->SetPenColor(iTransFgColor);
aGc->SetBrushColor(iTransBgColor);
aGc->DrawRect(TRect(TPoint(0,0), iSize));
//draw inner rectangle
aGc->SetPenColor(iFgColor);
aGc->SetBrushColor(iBgColor);
aGc->DrawRect(iOpaqueRect);
CCompWin::DrawBitmap(aGc, aClip, aOrigin);
}
示例9: Redraw
void CEdgedWin::Redraw(const TRect& aRect)
{
iWsGc.Activate(*iWindow);
iWsGc.Reset();
iWsGc.SetPenStyle(iPenStyle);
iWsGc.SetBrushStyle(iBrushStyle);
TBool redraw = EFalse;
//redraw outer rectangle if in rect
if (aRect.iTl.iX < iOpaqueRect.iTl.iX ||
aRect.iTl.iY < iOpaqueRect.iTl.iY ||
aRect.iBr.iX > iOpaqueRect.iBr.iX ||
aRect.iBr.iY > iOpaqueRect.iBr.iY)
{
redraw = ETrue;
iRedrawWindow->BeginRedraw();
iWsGc.SetPenColor(iTransFgColor);
iWsGc.SetBrushColor(iTransBgColor);
iWsGc.DrawRect(TRect(TPoint(0,0), iSize));
// iRedrawWindow->EndRedraw() will be taken care of below
}
//redraw inner rectangle
if (redraw || aRect.Intersects(iOpaqueRect))
{
if (!redraw)
{
iRedrawWindow->BeginRedraw(iOpaqueRect);//iOpaqueRect);
}
iWsGc.SetPenColor(iFgColor);
iWsGc.SetBrushColor(iBgColor);
iWsGc.DrawRect(iOpaqueRect);
iRedrawWindow->EndRedraw();
}
iWsGc.Deactivate();
}
示例10: Printer
//---------------------------------------------------------------------------
TRect TIPrintDialog::GetDrawingArea()
{
//Calculate margins in inches;
double LeftMargin = FLeftMargin /100.0;
double TopMargin = FTopMargin / 100.0;
HDC hPrnDC = Printer()->Handle;
//Get x-resolution and y-resolution
double PrnLogPixelsX = GetDeviceCaps(hPrnDC, LOGPIXELSX) / InchToMillimeter;
double PrnLogPixelsY = GetDeviceCaps(hPrnDC, LOGPIXELSY) / InchToMillimeter;
//LOGPIXELSX doesn't work. Always returns 96 for screen
HDC ScreenDC = GetDC(NULL);
double ScreenLogPixelsX = (double)GetDeviceCaps(ScreenDC, HORZRES) / GetDeviceCaps(ScreenDC, HORZSIZE);
double ScreenLogPixelsY = (double)GetDeviceCaps(ScreenDC, VERTRES) / GetDeviceCaps(ScreenDC, VERTSIZE);
ReleaseDC(NULL, ScreenDC);
double xScale = PrnLogPixelsX / ScreenLogPixelsX;
double yScale = PrnLogPixelsY / ScreenLogPixelsY;
// Locate the upper left corner of the printable area
TPoint pt(0,0);
pt.x = GetDeviceCaps(hPrnDC, PHYSICALOFFSETX);
pt.y = GetDeviceCaps(hPrnDC, PHYSICALOFFSETY);
double Left = PrnLogPixelsX * LeftMargin - pt.x;
double Top = PrnLogPixelsY * TopMargin - pt.y;
double Right = Left + xScale * FImageWidth * Scale / 100.0;
double Bottom = Top + yScale * FImageHeight * Scale / 100.0;
//Return drawing area
//(0,0) is the top left corner of the printable area
return TRect(Left, Top, Right, Bottom);
}
示例11: Tile
EXPORT_C void CEikScrollBarFrame::Tile(TEikScrollBarModel* aVModel, TRect& aVScrollBarRect)
{
Tile(aVModel);
TRect tempRect(aVScrollBarRect);
if(aVScrollBarRect.Height() < 0 )
{
aVScrollBarRect.iTl.iY = aVScrollBarRect.iBr.iY;
aVScrollBarRect.iBr.iY = tempRect.iTl.iY;
}
if(aVScrollBarRect.Width() < 0 )
{
aVScrollBarRect.iTl.iX = aVScrollBarRect.iBr.iX;
aVScrollBarRect.iBr.iX = tempRect.iTl.iX;
}
if (iV.iBar && TypeOfVScrollBar() == EDoubleSpan && iV.iExternalScrollBarAttached==EFalse )
{
CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*> (iV.iBar);
// check if fixed layout has been set
if (scrollbar->FixedLayoutRect().Size() == TSize(0,0))
{
if (aVScrollBarRect != TRect(iV.iBar->Position(), iV.iBar->Size()))
{
iV.iBar->SetRect(aVScrollBarRect);
}
}
}
}
示例12: __ASSERT_ALWAYS
/** Converts a bitmap size to twips before any scaling is applied.
@param aSize The size of the bitmap rectangle in pixels.
@pre None.
@post The bitmap rectangle size is expressed in twips. */
void CHlpPicture::GetOriginalSizeInTwips(TSize& aSize) const
{
__ASSERT_ALWAYS(iHlpModel, Panic(EHlpNoHelpModelPointer));
aSize = iImage->SizeInPixels();
if (iImageCountForPicture != KHlpModelMaximumNumberOfImagesForV6Point2Files)
{
// ER6 and 6.1 scale-based code
TRect rect(aSize);
rect = CCoeEnv::Static()->ScreenDevice()->PixelsToTwips(rect);
aSize = rect.Size();
}
else
{
// Fetch the zoom
const TReal zoomValue = static_cast<TReal>(iHlpModel->CurrentZoomFactor());
const TReal scaleFactor = static_cast<TReal>(KHlpModelDefaultZoomFactorAsRealNumber / zoomValue);
// Scale up or down (in pixels) accordingly
aSize.iWidth = static_cast<TInt>(aSize.iWidth * scaleFactor);
aSize.iHeight = static_cast<TInt>(aSize.iHeight * scaleFactor);
// Now scale into twips
aSize = CCoeEnv::Static()->ScreenDevice()->PixelsToTwips(TRect(TPoint(0,0), aSize)).Size();
}
}
示例13: TRect
//---------------------------------------------------------------------------
// DragOver イベントのコールバック関数
//---------------------------------------------------------------------------
void __fastcall TForm1::FilesDragOver(POINTL ptl)
{
int px, py, pr, pb;
TRect rcResult;
TRect rcMouse = TRect(ptl.x-1, ptl.y-1, ptl.x+1, ptl.y+1); //マウス位置
TRect rcTarget;
DragAndDropTarget->fMultipleFilesOk = false;
DragAndDropTarget->DropImageType = DROPIMAGE_COPY;
//パスワード入力ボックス
px = txtInputPassword->Left;
py = txtInputPassword->Top;
pr = txtInputPassword->BoundsRect.Right;
pb = txtInputPassword->BoundsRect.Bottom;
rcTarget = Rect(ClientToScreen(TPoint(px, py)), ClientToScreen(TPoint(pr, pb)));
if (IntersectRect(rcResult, rcMouse, rcTarget) == true ) {
txtInputPassword->Color = TColor(0xDBEBF7); //オレンジ色
}
else{
txtInputPassword->Color = clWindow;
}
}
示例14: CheckValid
//
/// Create a bitmap & get its handle, given an other bitmap
/// Used by ctors here and in derived classes. Assumes Handle can be
/// written over, & adds handle to reference container.
//
void
TBitmap::Create(const TBitmap& src)
{
TMemoryDC memDC1;
TMemoryDC memDC2;
BITMAP bm;
src.GetObject(bm);
if (bm.bmPlanes != 1 || bm.bmBitsPixel != 1) {
// create a color bitmap (Assume screen compatible)
TScreenDC dc;
Handle = ::CreateCompatibleBitmap(dc, bm.bmWidth, bm.bmHeight);
}
else
// create a mono bitmap
Handle = ::CreateBitmap(bm.bmWidth, bm.bmHeight, 1, 1, 0);
CheckValid();
RefAdd(Handle, Bitmap);
memDC1.SelectObject(src);
memDC2.SelectObject(*this);
memDC2.BitBlt(TRect(TPoint(0, 0), TSize(bm.bmWidth, bm.bmHeight)),
memDC1, TPoint(0, 0), SRCCOPY);
}
示例15: SystemGc
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CShowString::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.Clear(aRect);
gc.DrawRect(aRect);
if(iString && iMyFont)
{
TInt fontHeight = iMyFont->HeightInPixels();
gc.UseFont(iMyFont);
TInt TextToDraw = iString->Des().Length() - iCurrentCut;
if(TextToDraw < 1)
{
TextToDraw = 1;
}
if(TextToDraw > iString->Des().Length())
{
TextToDraw = iString->Des().Length();
}
gc.DrawText(iString->Des().Right(TextToDraw),TRect(5,(fontHeight / 2),aRect.Width() - 5,((fontHeight / 2) + fontHeight)),iMyFont->AscentInPixels(), CGraphicsContext::ELeft, 0);
}
}