当前位置: 首页>>代码示例>>C++>>正文


C++ TRect函数代码示例

本文整理汇总了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);
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:29,代码来源:SelectGroup.cpp

示例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;
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:36,代码来源:celarray.cpp

示例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();
	}
开发者ID:Seikareikou,项目名称:symbian,代码行数:29,代码来源:Button.cpp

示例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);
		
		
	}
开发者ID:kolayuk,项目名称:TweakS,代码行数:34,代码来源:SliderDialog.cpp

示例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);
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:10,代码来源:celarray.cpp

示例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));
	}
开发者ID:kolayuk,项目名称:Tap2Close,代码行数:7,代码来源:Tap2CloseAppUi.cpp

示例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);
}
开发者ID:janisozaur,项目名称:opentoonz,代码行数:26,代码来源:imageviewer.cpp

示例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);
	}	
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:25,代码来源:edgedwin.cpp

示例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();
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:34,代码来源:edgedwin.cpp

示例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);
}
开发者ID:q2apro,项目名称:graph-padowan,代码行数:35,代码来源:IPrintDialog.cpp

示例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);
                }
            }
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:27,代码来源:EIKSBFRM.CPP

示例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();
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:31,代码来源:hlppict.cpp

示例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;
}


}
开发者ID:fkshom,项目名称:AttacheCase,代码行数:30,代码来源:Unit1.cpp

示例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);
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:30,代码来源:bitmap.cpp

示例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);
	}
}
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:30,代码来源:ShowString.cpp


注:本文中的TRect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。