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


C++ TCanvas::RoundRect方法代码示例

本文整理汇总了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;
}
开发者ID:perracolabs,项目名称:MXPad,代码行数:32,代码来源:TBaseConverter.cpp

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

示例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);
    }
//.........这里部分代码省略.........
开发者ID:perracolabs,项目名称:MXPad,代码行数:101,代码来源:TExtendedButton.cpp


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