本文整理汇总了C++中TRect::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ TRect::Set方法的具体用法?C++ TRect::Set怎么用?C++ TRect::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRect
的用法示例。
在下文中一共展示了TRect::Set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetValue
void TScrollBar::SetValue(int32 value)
{
if (value < fMinimum)
value = fMinimum;
else if (value > fMaximum)
value = fMaximum;
if (value != fValue)
{
TRect oldThumb;
GetThumb(oldThumb);
fValue = value;
HandleCommand(this, this, kValueChangedCommandID);
TRect newThumb;
GetThumb(newThumb);
if (newThumb != oldThumb)
{
TDrawContext context(this);
TRect rect;
if (newThumb.left < oldThumb.left)
rect.Set(newThumb.right, newThumb.top, oldThumb.right, newThumb.bottom);
else if (newThumb.left > oldThumb.left)
rect.Set(oldThumb.left, newThumb.top, newThumb.left, newThumb.bottom);
if (newThumb.top < oldThumb.top)
rect.Set(newThumb.left, newThumb.bottom, newThumb.right, oldThumb.bottom);
else if (newThumb.top > oldThumb.top)
rect.Set(newThumb.left, oldThumb.top, newThumb.right, newThumb.top);
if (context.GetDepth() < 8)
{
context.SetStipple(TGraphicsUtils::GetGrayStipple());
context.SetForeColor(kBlackColor);
context.SetBackColor(kWhiteColor);
}
else
context.SetForeColor(kMediumGrayColor);
context.PaintRect(rect);
DrawThumb(context);
}
}
}
示例2: IdentifyPoint
ScrollBarPart TScrollBar::IdentifyPoint(const TPoint& point, TRect& outTrackingRect) const
{
GetArrow1(outTrackingRect);
if (outTrackingRect.Contains(point))
return kArrow1;
GetArrow2(outTrackingRect);
if (outTrackingRect.Contains(point))
return kArrow2;
TRect thumb;
GetThumb(thumb);
if (thumb.Contains(point))
{
outTrackingRect = thumb;
return kThumb;
}
TRect thumbArea;
GetThumbArea(thumbArea);
if (! thumbArea.Contains(point))
return kNone;
if (IsVertical())
{
outTrackingRect.Set(thumbArea.left, thumbArea.top, thumbArea.right, thumb.top);
if (outTrackingRect.Contains(point))
return kPageUp;
else
{
outTrackingRect.top = thumb.bottom;
outTrackingRect.bottom = thumbArea.bottom;
return kPageDown;
}
}
else
{
outTrackingRect.Set(thumbArea.left, thumbArea.top, thumb.left, thumbArea.bottom);
if (outTrackingRect.Contains(point))
return kPageUp;
else
{
outTrackingRect.left = thumb.right;
outTrackingRect.right = thumbArea.right;
return kPageDown;
}
}
}