本文整理汇总了C++中TCanvas::RoundRect方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::RoundRect方法的具体用法?C++ TCanvas::RoundRect怎么用?C++ TCanvas::RoundRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::RoundRect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ctlSplitterPaint
void __fastcall TfrmBaseConverter::ctlSplitterPaint(TObject *Sender)
{
TCanvas *oCanvas;
TRect oGrabber;
oCanvas = this->ctlSplitter->Canvas;
oGrabber = oCanvas->ClipRect;
//---------------------------------------------------------------------------
// Background
oCanvas->Pen->Color = (TColor)DEFAULT_SPLITTER_BORDER_COLOR;
oCanvas->Brush->Color = (TColor)DEFAULT_SPLITTER_BACK_COLOR;
oCanvas->RoundRect(oGrabber.Left, oGrabber.Top, oGrabber.Right, oGrabber.Bottom, 2, 2);
// Middle grabber
oGrabber = oCanvas->ClipRect;
oGrabber.Right -= 1;
oGrabber.Top = (int)(oCanvas->ClipRect.Height() / 2.5);
oGrabber.Bottom = oGrabber.Bottom - oGrabber.Top;
oCanvas->Pen->Color = (TColor)DEFAULT_SPLITTER_BORDER_COLOR;
for (int iItem = oGrabber.Top; iItem < oGrabber.Bottom;)
{
oCanvas->MoveTo(oGrabber.Left, iItem);
oCanvas->LineTo(oGrabber.Right, iItem);
iItem += 3;
}
return;
}
示例2: DrawMessage
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::DrawMessage(LPCSTR p)
{
TCanvas *pCanvas = PBoxT->Canvas;
int xr = pCanvas->TextWidth(p);
int xl = (PBoxT->Width - xr)/2;
xr += xl;
int FH = pCanvas->TextHeight(p);
int VC = PBoxT->Height - FH;
pCanvas->Pen->Color = clWhite;
pCanvas->Brush->Color = clBlack;
pCanvas->RoundRect(xl-10, VC-FH, xr+10, VC+FH, 10, 10);
pCanvas->Font->Color = clWhite;
pCanvas->TextOut(xl, VC-FH/2, p);
}
示例3: DrawControl
void TExtendedButton::DrawControl(void)
{
EDrawingMode iDrawingMode;
TCanvas *oCanvas;
long lStartColor;
long lEndColor;
long lBorderColor;
short iTextDeviation;
RECT oArea;
this->FDrawingBuffer->Width = this->Width;
this->FDrawingBuffer->Height = this->Height;
oCanvas = this->FDrawingBuffer->Canvas;
oCanvas->Font = this->Font;
//---------------------------------------------------------------------------
// Find the drawing mode
iDrawingMode = DM_NORMAL;
if (::GetAsyncKeyState(VK_LBUTTON) == 0)
{
if (PtInRect(this->Canvas->ClipRect, this->ScreenToClient(Mouse->CursorPos)) == true)
iDrawingMode = DM_HOT;
}
else
{
if (PtInRect(this->Canvas->ClipRect, this->ScreenToClient(Mouse->CursorPos)) == false)
{
if (this->FFocused == true)
iDrawingMode = DM_HOT;
}
else
iDrawingMode = DM_DOWN;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Define which colors to use for painting
switch (iDrawingMode)
{
case DM_NORMAL:
lStartColor = this->StartColor;
lEndColor = this->EndColor;
lBorderColor = this->BorderColor;
iTextDeviation = 0;
oCanvas->Font->Color = Graphics::clBlack;
break;
case DM_DOWN:
lStartColor = this->FBase->DarkenColor(this->EndColor, 20);
lEndColor = this->FBase->DarkenColor(this->StartColor, 20);
lBorderColor = this->FBase->DarkenColor(this->BorderColor, 50);
iTextDeviation = 1;
oCanvas->Font->Color = Graphics::clBlack;
break;
case DM_HOT:
lStartColor = this->FBase->LightenColor(this->StartColor, 100);
lEndColor = this->FBase->LightenColor(this->EndColor, 100);
lBorderColor = this->FBase->LightenColor(this->BorderColor, 100);
iTextDeviation = 0;
oCanvas->Font->Color = Graphics::clGray;
break;
default:
lStartColor = this->StartColor;
lEndColor = this->EndColor;
lBorderColor = this->BorderColor;
iTextDeviation = 0;
break;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Perform the actual drawing
this->FBase->FillGradient(oCanvas->Handle, oCanvas->ClipRect, lStartColor, lEndColor, comn::OT_DIAGONAL);
oCanvas->Pen->Color = (TColor)lBorderColor;
oCanvas->Brush->Style = Graphics::bsClear;
oCanvas->RoundRect(oCanvas->ClipRect.Left, oCanvas->ClipRect.Top, oCanvas->ClipRect.Right, oCanvas->ClipRect.Bottom, 6, 6);
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Draw the image if required
if (this->ImageID != comn::BI_NONE && this->DrawImage == true)
{
oArea.left = 2;
oArea.top = 2;
oArea.right = this->Width - 2;
oArea.bottom = this->Height - 2;
if (iDrawingMode == DM_DOWN)
{
oArea.left++;
oArea.top++;
oArea.right++;
oArea.bottom++;
}
this->FBase->DrawBitmap(oCanvas->Handle, oArea, this->ImageID, true);
}
//.........这里部分代码省略.........