本文整理汇总了C++中Canvas::DrawOutlineRectangle方法的典型用法代码示例。如果您正苦于以下问题:C++ Canvas::DrawOutlineRectangle方法的具体用法?C++ Canvas::DrawOutlineRectangle怎么用?C++ Canvas::DrawOutlineRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas::DrawOutlineRectangle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rc
void
LargeTextWindow::OnPaint(Canvas &canvas)
{
canvas.ClearWhite();
PixelRect rc(0, 0, canvas.GetWidth() - 1, canvas.GetHeight() - 1);
canvas.DrawOutlineRectangle(rc.left, rc.top, rc.right, rc.bottom,
COLOR_BLACK);
if (value.empty())
return;
const PixelScalar padding = Layout::GetTextPadding();
rc.Grow(-padding);
canvas.SetBackgroundTransparent();
canvas.SetTextColor(COLOR_BLACK);
rc.top -= origin * GetFont().GetHeight();
#ifndef USE_GDI
canvas.Select(GetFont());
#endif
canvas.DrawFormattedText(&rc, value.c_str(), DT_LEFT | DT_WORDBREAK);
}
示例2: GetWidth
void
ContainerWindow::OnPaint(Canvas &canvas)
{
children.Paint(canvas);
if (HasBorder())
canvas.DrawOutlineRectangle(-1, -1, GetWidth(), GetHeight(),
COLOR_BLACK);
}
示例3: GetClientRect
void
PopupMessage::OnPaint(Canvas &canvas)
{
canvas.ClearWhite();
auto rc = GetClientRect();
#ifndef USE_WINUSER
canvas.DrawOutlineRectangle(rc.left, rc.top, rc.right, rc.bottom,
COLOR_BLACK);
#endif
const int padding = Layout::GetTextPadding();
rc.Grow(-padding);
canvas.SetTextColor(look.text_color);
canvas.SetBackgroundTransparent();
canvas.Select(look.text_font);
renderer.Draw(canvas, rc, text);
}
示例4: app
//------------------------------------------------------------------------------
int
main(int argc, char *argv[])
{
QApplication app(argc, argv);
Canvas c;
Pen(Pen::SOLID, 1, Color(0, 0, 0));
{
c.Select(Brush(Color(128, 128, 0, Color::TRANSPARENT)));
c.DrawKeyhole(200, 100, 50, 100, Angle::Degrees(-20), Angle::Degrees(20));
c.DrawKeyhole(400, 100, 50, 100, Angle::Degrees(70), Angle::Degrees(110));
c.DrawKeyhole(200, 300, 50, 100, Angle::Degrees(160), Angle::Degrees(200));
c.DrawKeyhole(400, 300, 50, 100, Angle::Degrees(-110), Angle::Degrees(-70));
c.show();
app.exec();
}
{
c.Clear();
c.DrawKeyhole(200, 100, 50, 100, Angle::Degrees(35), Angle::Degrees(55));
c.DrawKeyhole(400, 100, 50, 100, Angle::Degrees(125), Angle::Degrees(145));
c.DrawKeyhole(200, 300, 50, 100, Angle::Degrees(215), Angle::Degrees(235));
c.DrawKeyhole(400, 300, 50, 100, Angle::Degrees(305), Angle::Degrees(325));
c.show();
app.exec();
}
{
c.Clear();
c.DrawFilledRectangle(0, 0, 100, 100, Color(128, 128, 128,
Color::TRANSPARENT));
c.DrawFilledRectangle(100, 100, 200, 200, Color(128, 0, 0,
Color::TRANSPARENT));
c.DrawFilledRectangle(150, 150, 250, 250, Color(0, 128, 0,
Color::TRANSPARENT));
c.DrawFilledRectangle(200, 200, 300, 300, Color(0, 0, 128,
Color::TRANSPARENT));
c.DrawTransparentText(0, 0, "0");
c.DrawTransparentText(0, 100, "100");
c.DrawTransparentText(0, 200, "200");
c.DrawTransparentText(0, 300, "300");
c.DrawTransparentText(0, 400, "400");
c.DrawTransparentText(0, 500, "500");
c.DrawTransparentText(100, c.GetFontHeight(), "100");
c.DrawTransparentText(200, c.GetFontHeight(), "200");
c.DrawTransparentText(300, c.GetFontHeight(), "300");
c.DrawTransparentText(400, c.GetFontHeight(), "400");
c.DrawTransparentText(500, c.GetFontHeight(), "500");
c.show();
app.exec();
}
{
c.Clear();
c.DrawOutlineRectangle(100, 100, 200, 200, Color(255, 0, 0));
c.show();
app.exec();
}
{
c.Clear();
c.DrawRoundRectangle(100, 100, 200, 200, 10, 10);
c.DrawRoundRectangle(200, 200, 300, 300, 100, 100);
c.DrawRoundRectangle(300, 300, 400, 400, 50, 50);
c.show();
app.exec();
}
{
c.Clear();
PixelRect rc;
rc.left = 100;
rc.top = 100;
rc.right = 200;
rc.bottom = 200;
c.DrawRaisedEdge(rc);
c.show();
app.exec();
}
{
c.Clear();
RasterPoint rp[4];
rp[0] = {100, 100};
rp[1] = {200, 200};
rp[2] = {200, 300};
rp[3] = {300, 400};
c.DrawPolyline(rp, 4);
c.show();
app.exec();
}
{
c.Clear();
RasterPoint rp[6];
rp[0] = {100, 100};
rp[1] = {150, 50};
rp[2] = {200, 100};
rp[3] = {200, 200};
rp[4] = {150, 200};
rp[5] = {100, 100};
c.DrawPolygon(rp, 6);
c.show();
app.exec();
}
{
c.Clear();
//.........这里部分代码省略.........
示例5: vp
void
WndForm::OnPaint(Canvas &canvas)
{
const SingleWindow &main_window = GetMainWindow();
gcc_unused const bool is_active = main_window.IsTopDialog(*this);
#ifdef ENABLE_OPENGL
if (!IsDithered() && !IsMaximised() && is_active) {
/* draw a shade around the current dialog to emphasise it */
const ScopeAlphaBlend alpha_blend;
const PixelRect rc = GetClientRect();
const PixelScalar size = Layout::VptScale(4);
const RasterPoint vertices[8] = {
{ rc.left, rc.top },
{ rc.right, rc.top },
{ rc.right, rc.bottom },
{ rc.left, rc.bottom },
{ rc.left - size, rc.top - size },
{ rc.right + size, rc.top - size },
{ rc.right + size, rc.bottom + size },
{ rc.left - size, rc.bottom + size },
};
const ScopeVertexPointer vp(vertices);
static constexpr Color inner_color = COLOR_BLACK.WithAlpha(192);
static constexpr Color outer_color = COLOR_BLACK.WithAlpha(16);
static constexpr Color colors[8] = {
inner_color,
inner_color,
inner_color,
inner_color,
outer_color,
outer_color,
outer_color,
outer_color,
};
const ScopeColorPointer cp(colors);
static constexpr GLubyte indices[] = {
0, 4, 1, 4, 5, 1,
1, 5, 2, 5, 6, 2,
2, 6, 3, 6, 7, 3,
3, 7, 0, 7, 4, 0,
};
glDrawElements(GL_TRIANGLES, ARRAY_SIZE(indices),
GL_UNSIGNED_BYTE, indices);
}
#endif
ContainerWindow::OnPaint(canvas);
// Get window coordinates
PixelRect rcClient = GetClientRect();
// Draw the borders
if (!IsMaximised()) {
#ifndef USE_GDI
if (IsDithered())
canvas.DrawOutlineRectangle(rcClient.left, rcClient.top,
rcClient.right - 1, rcClient.bottom - 1,
COLOR_BLACK);
else
#endif
canvas.DrawRaisedEdge(rcClient);
}
if (!caption.empty()) {
// Set the colors
canvas.SetTextColor(COLOR_WHITE);
// Set the titlebar font and font-size
canvas.Select(*look.caption.font);
// JMW todo add here icons?
#ifdef EYE_CANDY
if (!IsDithered() && is_active) {
canvas.SetBackgroundTransparent();
canvas.Stretch(title_rect.left, title_rect.top,
title_rect.right - title_rect.left,
title_rect.bottom - title_rect.top,
look.caption.background_bitmap);
// Draw titlebar text
canvas.DrawText(title_rect.left + Layout::GetTextPadding(),
title_rect.top, caption.c_str());
} else {
#endif
canvas.SetBackgroundColor(is_active
? look.caption.background_color
: look.caption.inactive_background_color);
canvas.DrawOpaqueText(title_rect.left + Layout::GetTextPadding(),
title_rect.top, title_rect, caption.c_str());
#ifdef EYE_CANDY
}
//.........这里部分代码省略.........