Klasa printers - Wypełnienie kolorem

0

Witam. Za pomocą klasy printers drukuję sobie tabelkę i chcę aby komórki w pierwszym rekordzie były wypełnione kolorem. Szukałem w necie rozwiązania oraz dokumentacji tej klasy ale nie znalazłem. Proszę o pomoc.

0
Canvas property (TPrinter) napisał(a)

Delphi syntax:

property Canvas: TCanvas;

Description
Canvas represents the printing surface of a page. Use the Brush, Font, and Pen properties of the Canvas object to determine how drawing or text appears on the page.


Rectangle method (TCanvas) napisał(a)

Delphi syntax:

procedure Rectangle(X1, Y1, X2, Y2: Integer); overload;
procedure Rectangle(const Rect: TRect); overload;

Description
Use Rectangle to draw a rectangle using Pen and fill it with Brush. Specify the rectangle’s coordinates in one of two ways:

  • Giving four coordinates that define the upper left corner at the point (X1, Y1) and the lower right corner at the point (X2, Y2).
  • Using a TRect type.

To fill a rectangular region without drawing the boundary in the current pen, use FillRect. To outline a rectangular region without filling it, use FrameRect or Polygon. To draw a rectangle with rounded corners, use RoundRect.


FloodFill method (TCanvas) napisał(a)

Delphi syntax:

procedure FloodFill(X, Y: Integer; Color: TColor; FillStyle: TFillStyle);

Description
Use FloodFill to fill a possibly non-rectangular region of the image with the value of Brush. The boundaries of the region to be filled are determined by moving outward from the point (X,Y) until a color boundary involving the Color parameter is encountered.

X and X are the coordinates on the canvas where filling starts. Color is the color that defines the boundary of the region to fill. Its interpretation depends on the value of FillStyle. FillStyle specifies whether the region is defined by all pixels with the same value as Color, or all points with a different value.

0

z tym, że dla drukarki jest duża szansa, że FloodFill nie zadziała (sterownik nie ma tego zaimplementowanego). Tutaj nie ma problemu bo wypełnienie to prostokąt a ten łatwo narysować

0

Ja niestety nie mam jak tego sprawdzić, bo nie mam obecnie dostępu do drukarki, jednak warto sprawdzić; Jeśli jednak nie zadziała (a z tego co w Google widzę, to raczej nie zadziała) to pozostaje rysować przez Rectangle, FillRect czy nawet ciekawszy RoundRect - do wyboru do koloru;

Więcej na temat możliwości klas TPrinter i TCanvas oraz na co trzeba uważać można doczytać zarówno w pomocy środowiska, jak i w dokumentacji on-line.

1 użytkowników online, w tym zalogowanych: 0, gości: 1