【问题标题】:GDI+ equivalent of GDI RectangleGDI+ 相当于 GDI 矩形
【发布时间】:2019-04-07 00:02:50
【问题描述】:

GDI Rectangle 函数的 GDI+ 等效项是什么?

| Library | Outline       | Fill interior | Both        |
|---------|---------------|---------------|-------------|
| GDI     | FrameRect     | FillRect      | Rectangle   |
| GDI+    | DrawRectangle | FillRectangle | ?           |

【问题讨论】:

  • FillRectangle 然后 DrawRectangle

标签: winapi gdi+ gdi


【解决方案1】:

Rectangle 的 GDI+ 版本

德尔福

class procedure TGDIPlusHelper.Rectangle(g: TGPGraphics; OutlinePen: TGPPen; InteriorFillBrush: TGPBrush; x, y, width, height: Single);
begin
    //GDI has Rectangle.
    //GDI+ we simulate it with FillRectangle followed by DrawRectangle
    g.FillRectangle(InteriorFillBrush, x, y, width, height);
    g.DrawRectangle(OutlinePen, x, y, width, height);
end;

C#

void Rectangle(Graphics g, Pen outlinePen; Brush interiorFillBrush, Single x, Single y, Single width, Single height)
{
    //GDI has Rectangle.
    //GDI+ we simulate it with FillRectangle followed by DrawRectangle
    g.FillRectangle(InteriorFillBrush, x, y, width, height);
    g.DrawRectangle(OutlinePen, x, y, width, height);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-13
    • 2016-12-10
    • 1970-01-01
    • 2011-02-28
    • 1970-01-01
    • 2010-10-10
    • 2012-12-08
    • 2011-01-19
    相关资源
    最近更新 更多