Mo‘yqalam
Konstanta
bsSolid
bsClear
bsHorizontal
bsVertical
bsFDiagonal
bsBDiagonal
bsCross
bsDiaoCross
Sohani bo‘yash uslubi
Uzluksiz bo‘yash
Soha bo‘yalmaydi
Gorizontal shtrixlash
Vertikal shtrixlash
Diagonal shtrixlash, oldinga og‘ish
Diagonal shtrixlash, orqaga og‘ish
Katakli gorizontal-vertikal shtrixlash
Katakli diagonalini shtrixlash
Sohani bo‘yash usullarining dastur oynasi.
twSoiid
bsClcar
bsHoruonlal
bsVcrtical
bsFD iagoiial
bsD D iiiioaal
h*.Cross
bsDiioCross
HsSaSei
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls;
TForml = class(TForm)
Buttonl: TButton;
procedure ButtonlClick(Sender: TObject);
private
{ Private declarations }
public
Var
Forml: TForml;
implementation
{$R*.dfm}
procedure TForml.ButtonlClick(Sender: TObject);
Const
bsName: array[1..8] of string =
('bsSolid', ’bsClear’,’bsHorizontal’,
'bsVertical',’bsFDiagonar,’bsBDiagonal’,
'bsCross', ’bsDiaoCross’);
Var
x,y: Integer;
w,h: Integer;
bs: TBrushStyle;
k: Integer;
ij: Integer;
Begin
Button 1.visible:=false;
w:=60; h:=40;
y:=80;
for i:=l to 2 do
begin
121
x:=10;
for j:=l to 4 do
begin
k:=j+(i-l)*4;
case k of
1: bs:= bsSolid;
2: bs:= bsClear;
3: bs:= bsHorizontal;
4: bs:= bsVertical;
5: bs:= bsFDiagonal;
6: bs:= bsBDiagonal;
7: bs:= bsCross;
8: bs:= bsDiagCross; end;
Canvas.Brush.Color := clOreen;
Canvas.Brush.Style := bs;
Canvas . Rectangle (x, y, x+w, y-h) ;
Canvas.Brush.Style := bsClear;
Canvas.TextOut(x, y-55, bsName[k]);
x := x+w+30;
end;
y:= y+h+30;
end;
end;
end.
Grafik obyekt yuzasiga matn chiqarishuchun TextOut usuliqollaniladi.
Bu usulni chaqirish instruksiyasi q si quyidagi ko‘rinishga ega:
Obyekt.Canvas.TextOut(x, u, Tekst)
Matn shrifti Font xossasining qiymati bilan aniqlanadi. Font xossasi
TFont tipidagi obyektdir. Quyidagi jadvalda TFont obyekti xossalari
keltirilgan.
TFont obyektining xossalari:
122
Bu xossabir necha uslublami kombinatsiyasini olishga imkon beradi.
Masalan: Obyekt. Canvas . Font : = [fsBold, fs Italic]
Color Simvollar rangi.
Matn chiqarish sohasi mo‘yqalam joriy rangiga bo‘yaladi. Shuning
uchun matn chiqarishdan oldin Brush. Color xossasiga bsClear
qiymatini yoki soha rangiga mos qiymatni berish lozim.
Dostları ilə paylaş: |