GDI + эквивалент GDI Rectangle - PullRequest
       35

GDI + эквивалент GDI Rectangle

0 голосов
/ 02 ноября 2018

Что такое GDI + эквивалент функции GDI Прямоугольник ?

enter image description here

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

1 Ответ

0 голосов
/ 03 января 2019

GDI + версия Rectangle

Delphi

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);
}
...