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


C++ TRect::Offset方法代码示例

本文整理汇总了C++中TRect::Offset方法的典型用法代码示例。如果您正苦于以下问题:C++ TRect::Offset方法的具体用法?C++ TRect::Offset怎么用?C++ TRect::Offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TRect的用法示例。


在下文中一共展示了TRect::Offset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetTrackingRect

void TSplitter::GetTrackingRect(const TPoint& point, TRect& rect)
{
	GetLocalBounds(rect);

	if (fVertical)
	{
		rect.left = point.h - kSplitterWidth/2;
		rect.right = rect.left + kSplitterWidth;

		if (rect.left < 0)
			rect.Offset(-rect.left, 0);
		else if (rect.right > fBounds.GetWidth())
			rect.Offset(fBounds.GetWidth() - rect.right, 0);
	}
	else
	{
		rect.top = point.v - kSplitterWidth/2;
		rect.bottom = rect.top + kSplitterWidth;

		if (rect.top < 0)
			rect.Offset(0, -rect.top);
		else if (rect.bottom > fBounds.GetHeight())
			rect.Offset(0, fBounds.GetHeight() - rect.bottom);
	}
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:25,代码来源:TSplitter.cpp

示例2: GetTrackingRect

void TColumnResizer::GetTrackingRect(const TPoint& point, TRect& rect)
{
	TGridView* gridView = GetGridView();
	gridView->GetLocalBounds(rect);

	rect.left = point.h;
	rect.right = rect.left + 1;

	if (rect.left < 0)
		rect.Offset(-rect.left, 0);
	else if (rect.right > gridView->GetWidth())
		rect.Offset(gridView->GetWidth() - rect.right, 0);
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:13,代码来源:TColumnResizer.cpp

示例3: LocalToTopLevel

void TWindow::LocalToTopLevel(TRect& rect) const
{
	const TWindow* window = this;
	
	const TPoint& scroll = GetScroll();
	rect.Offset(-scroll.h, -scroll.v);

	while (window->fParent)
	{
		rect.Offset(window->fBounds.left, window->fBounds.top);
		window = window->fParent;
	}
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:13,代码来源:TWindow.cpp

示例4: glyphRect

//
/// Paints a close box on the tiny caption bar. You can override the default box if
/// you want to design your own close box.
//
void
TTinyCaption::PaintCloseBox(TDC& dc, TRect& boxRect, bool pressed)
{
    // Fill the box with light gray & draw bevel if possible
    //
    PaintButton(dc, boxRect, pressed);

    if (pressed)
        boxRect.Offset(1,1);

    // Do something different to differentiate from standard system menu--
    // draw a recessed black box glyph about half the button size, centered
    //
    int glyphWidth  = boxRect.Width() > 7 ?
                      boxRect.Width()-boxRect.Width()/2-1 : boxRect.Width()-3;
    int glyphHeight = boxRect.Height() > 7 ?
                      boxRect.Height()-boxRect.Height()/2-1 : boxRect.Height()-3;
    if (glyphWidth > 1 && glyphHeight > 1) {
        TRect glyphRect(0, 0, glyphWidth, glyphHeight);
        glyphRect.Offset(boxRect.left + (boxRect.Width()-glyphWidth-1)/2,
                         boxRect.top + (boxRect.Height()-glyphHeight-1)/2);

        dc.TextRect(glyphRect, TColor::Sys3dShadow);
        glyphRect.Offset(1,1);
        dc.TextRect(glyphRect, TColor::Sys3dHilight);
        glyphRect.BottomRight().Offset(-1,-1);
        dc.TextRect(glyphRect, TColor::SysBtnText);
    }
}
开发者ID:bowlofstew,项目名称:Meridian59,代码行数:33,代码来源:tinycapt.cpp

示例5: LocalToRoot

void TWindow::LocalToRoot(TRect& rect) const
{
	int x, y;
	Window childWindow;
	XTranslateCoordinates(sDisplay, fWindow, gApplication->GetRootWindow(),
										   0, 0, &x, &y, &childWindow);

	const TPoint& scroll = GetScroll();
	rect.Offset(x - scroll.h, y - scroll.v);
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:10,代码来源:TWindow.cpp

示例6: PaintButton

//
/// Paints a maximize box on the tiny caption bar.
//
void
TTinyCaption::PaintMaxBox(TDC& dc, TRect& boxRect, bool pressed)
{
    // Fill the box with light gray & draw bevel if possible
    //
    PaintButton(dc, boxRect, pressed);

    if (pressed)
        boxRect.Offset(1,1);

    // Down triangle
    //
    int bh = boxRect.Height();
    int bw = boxRect.Width();

    if (IsZoomed()) {
        TPoint begPt = boxRect.BottomLeft().OffsetBy((bw+1)/4, -bh*3/8);
        TPoint endPt = begPt.OffsetBy((bw+1)/2, 0);
        while (begPt.x < endPt.x) {
            dc.MoveTo(begPt);
            dc.LineTo(endPt);
            begPt.Offset(1,1);
            endPt.Offset(-1,1);
        }
    }

    // Up triangle
    //
    {
        TPoint begPt = boxRect.TopLeft().OffsetBy((bw+1)/4, IsZoomed() ? bh*3/8 : bh*2/3);
        TPoint endPt = begPt.OffsetBy((bw+1)/2, 0);
        while (begPt.x < endPt.x) {
            dc.MoveTo(begPt);
            dc.LineTo(endPt);
            begPt.Offset(1, -1);
            endPt.Offset(-1, -1);
        }
    }
}
开发者ID:bowlofstew,项目名称:Meridian59,代码行数:42,代码来源:tinycapt.cpp

示例7: dc

//
// Intercept WM_PAINT to redirect from TWindow to the underlying control iff
// this Owl object is just a wrapper for a predefined class.
//
void
TFlatListBox::EvPaint()
{
  TListBox::EvPaint();

  if (IsFlat()){

    TWindowDC dc(GetHandle());

    TRect rect  = GetClientRect();
    TRect wrect = GetWindowRect();
    ::MapWindowPoints(HWND_DESKTOP, *this, LPPOINT(&wrect), 2);

    rect.bottom += 6;
    rect.right  += 6;
    wrect.Offset(3,3);

    bool haveScroll = wrect != rect;
    if(haveScroll){
       wrect.bottom -= 1;
       wrect.right  -= 1;
    }

    TFlatPainter::Paint(dc, wrect);

    if((!IsSet(fpMouseIn) || !IsWindowEnabled()) && haveScroll){
      // We draw the "untracked" situation
      wrect.left = wrect.right - TUIMetric::CxHThumb;

#ifdef TEST
       dc.FrameRect(wrect, TBrush(TColor::LtGreen));
#else
       dc.FrameRect(wrect, TBrush(TColor::SysWindow));
#endif
    }
  }
}
开发者ID:Meridian59,项目名称:Meridian59,代码行数:41,代码来源:flatctrl.cpp

示例8: if

//
/// Paint Text
//
void
TButtonTextGadget::PaintText(TDC& dc, TRect& rect, const tstring& text)
{
  dc.SelectObject(GetFont());

  TColor textColor = TColor::SysBtnText;
  if(!GetEnabled())
    textColor = TColor::Sys3dHilight;
  else if((GetGadgetWindow()->GetFlatStyle()&TGadgetWindow::FlatHotText) && IsHaveMouse())
     textColor = TColor::LtBlue;

   TColor oldTxColor  = dc.SetTextColor(textColor);

  uint format =  DT_SINGLELINE|DT_NOCLIP|DT_END_ELLIPSIS;
  switch(Align){
    case aLeft:
      format |= DT_LEFT;
      break;
    case aRight:
      format |= DT_RIGHT;
      break;
    case aCenter:
      format |= DT_CENTER;
      break;
  }
  switch(LayoutStyle){
    case lTextLeft:
    case lTextRight:
      format |= DT_VCENTER;
      break;
    case lTextTop:
      format |= DT_VCENTER;//DT_BOTTOM;
      break;
    case lTextBottom:
      format |= DT_VCENTER;//DT_TOP;
      break;
  }

  // Create a UI Face object for this button & let it paint the button face
  //
  TPoint  dstPt(rect.TopLeft());

  if (GetButtonState() == Down && GetEnabled() &&
      GetGadgetWindow()->GetFlatStyle()&TGadgetWindow::FlatStandard)
  {
    if(IsHaveMouse())
    {
      if(IsPressed())
      {
        const int dx = (format & DT_CENTER) ? 2 : 1;
        const int dy = (format & DT_VCENTER) ? 2 : 1;
        rect.Offset(dx, dy);
      }
      TUIFace(rect, text, TColor::Sys3dFace,format).Paint(dc, dstPt,
                TUIFace::Normal, true, true);
    }
    else
    {
      TUIFace face(rect, text, TColor::Sys3dFace,format);
      if(GetGadgetWindow()->GadgetGetCaptured()==this)
        face.Paint(dc, dstPt, TUIFace::Normal, true);
      else
        face.Paint(dc, dstPt, TUIFace::Down, IsPressed(), false);
    }
  }
  else
  {
    TUIFace face(rect, text, TColor::Sys3dFace,format);
    if (!GetEnabled())
      face.Paint(dc, dstPt, TUIFace::Disabled, false, false);
    else if (GetButtonState() == Indeterminate)
      face.Paint(dc, dstPt, TUIFace::Indeterm, IsPressed(), false);
    else if (GetButtonState() == Down) // Down and not flat
      face.Paint(dc, dstPt, TUIFace::Down, IsPressed(), false);
    else
      face.Paint(dc, dstPt, TUIFace::Normal, IsPressed(), false);
  }

  dc.SetTextColor(oldTxColor);

  dc.RestoreFont();
}
开发者ID:Meridian59,项目名称:Meridian59,代码行数:85,代码来源:btntextg.cpp


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