VCL
, Delphi, , . Delphi. (RTTI).
Delphi Delphi, (Visual Component Library, VCL). Delphi, , ( ), ( ) . TButton, TEdit, TLabel . , TTimer,
TTable, TQuery .
- , . "", "" - .
. .
. (, , TLabel, TEdit), (, , ).
, Delphi, . .
Delphi . , .
- .
Windows. : TListView, TRichEdit, TImageList
. Win32 Delphi. (wrapper) Windows. Windows .
- .
, Delphi. . .
. 6.
- .
, . , - ( ). TShape, TLabel, TImage .
, , - .
" . , . TTimer.
, , , , .
, Delphi.
, , .
. , . , (). :
property : ;
- - ;
- - , ;
- - .
, . read write. , Delphi : stored, default (nodefault), implements.
.
read write :
read write
- , ( ) , , .
, read () , , write () , .
stored, default (nodefault), implements.
, , Delphi.
stored : true false. , Delphi . , Delphi , , stored true,
. ( stored false) .
default.
:
property MaxLength: Integer read FMaxLength write SetMaxLength default 0;
, MaxLength, integer FMaxLength, FMaxLength SetMaxLength. , .
, implements . ,
property Mylnterface: IMylnterface read FMylnterface implements IMylnterface;
implements . , . , implements, :
- ;
- ;
- read.
, , Object Pascal. . Delphi (. 2.1).
2.1.
Delphi
, Delphi.
Action , (, . ). , . TActionList .
Active , . : false true. false, ( ) . Active true, :
- BeforeOpen;
- ( state) dsBrowse;
- ;
- AfterOpen.
, :
Tablel.Active := true;
open ( Active true)
Close (false): Tablel.Open;
Align . .
- alNone - , . Align .
- alTop - -. -. .
- alBottom - aiTop, , -.
- alLeft - -. -. - .
- alRight - alLeft, , -.
- alclient - -. - . , -.
alTop alBottom alLeft aiRight. , , Align alTop, - alRight, (. 2.1).
Anchors . Delphi 4. , :
- akTop - ; - akLeft - ;
- akBottom - ;
- akRight - .
. 2.1. Align
, , . , .
AutoCalcFields onCalcFields. true . onCalcField, , :
- ;
- dsEdit;
- , , ;
- - .
,
, AutoCalcField false.
AutoEnable . true, , EnabledButtons, . EnabiedButtons ( . ).
AutoMerge , c . true.
MDI AutoMerge , . . .
AutoOpen - . true, , DeviceType ( . ). , EMClDeviceError. AutoOpen false, Open.
AutoSelect , , , , . ( Memo, RichEdit .). true, , , . AutoSelect , , , , .
AutoSize , (Edit), . true, .
Bitmap TBitmap, . Bitmap , style , Bitmap.
BoundsRect .
: Left ( ), ( ), width ( ) Height (). .
, .
Break . :
- mbNone - ( );
- mbBarBreak - ;
- mbBreak - .
(. 2.2).
( Break mbBarBreak), ( Break mbBreak).
. 2.2. Break
Brush . , . Color style.
Canvas , . , .
Capabilities . Open. . capabilities :
- mpCanEject - , ; - mpCanPlay - ; - mpCanRecord - ;
- mpcanstep - ;
- mpuseswindow - .
capacity , TList. , , EOutOfMemory. capacity Count , , , TList, a count , . , capacity count. count, , Capacity. , . capacity , count,
EListError.
caption , . ( , , .). , ( Name). . (&). , "" caption &: &. "" . <1t>+<>.
charset . . , (. 2.2).
2.2.
, , , charset RUSSIAN_CHARSET.
clientHeight . , . , -.
clientorigin ( ) . . TPoint. .
clientRect . . TRect.
clientwidth .
ciipRect , . , clipRect, . .
color . , (, ), , Delphi (. 2.3).
2.3. ,
, clBackground, Windows, . .
commonAvi Windows - Shell32.dll. , , , .
componentcount , .
component index ( ) , -.
components , . index , Componentindex. . , , Componentcount.
. , . - , , Button1 10 . :
for i := 0 to Componentcount - 1 do
if (Components[i].Name <> 'Button1') then
(Components[i] as TControl).Left:=(Components[i] as TControl).Left + 10;
controicount . , , , Parent . controicount .
controls , . index . . .
Controlstate , . , .
Controlstyle . , , . , .
CopyMode copyRect, TBitmap. . . 2.4
CopyMode.
2.4. CopyMode
. , , , . :
Imagel.Canvas.CopyMode := cmSrcInvert;
Imagel.Canvas.CopyRect (Rect (0,0,200,200), Image2.Canvas,
Rect (0,0,200,200)); Imagel.Canvas.CopyRect (Rect (0,0,200,200), Image2.Canvas,.
Rect '(0,0,200,200));
count , TList. ( Add Delete) . , TList . Pack. count , .
cti3D . true, , - false, .
Cursor , . Dragcursor, , . Delphi . , . . 2.5 .
2.5.
DesktopFont , Windows. DesktopFont True , Font Windows. lconFont Screen. , , Windows , Font .
DeviceType , . dtAutoSelect. , , FileName.
Display , . . nil, , . , , Panel 1, :
MediaPlayerl.Display := Panel1;
DispiayRect , Display, .
c , Display = nil. DispiayRect
, . , , - , . :
MediaPlayerl.DispiayRect := Rect(10,10,300,200);
(10, 10) 300 200 .
DragMode . : automatic dmManual. , . . , , BeginDrag.
Drawingstyle . :
- dsFocused - 25% , BlendColor. , ;
- deselected - , dsFocused, 50%;
- dsNormal - , BkColor. BkCoior ciNone, ;
- dsTransparent - , BkCoior.
Enabled , . (Enabled = false) . , . . , , Enabled false:
Buttonl.Enabled := false;
Font , (, , . .).
Groupindex .
Handle Win32 API, . Handle .
Handle , , . .
Height .
HelpContext , - . , , <F1>.
Hint . , (|). :
Buttonl.Hint := "[ "
, Buttonl "", , , , . , (|). ,
ShowHint true.
imageindex , . .
lsControl . true, , . false, .
items , TList. items Pointer. .
Left . . .
List TList. .
LockCount , () . .
Mode . . 2.6 .
2.6. Mode
Name , , . . Delphi , Button1, Button2, Labell . . .
Notify , onNotify (open, close, Next .).
Parent ( - !) , .
. Parent , . . , . Owner . - , . , (, , ).
Parentctiso , ctiso.
ParentFont , , . , , parentFont true , , Font .
ParentshowHint showHint. .
, . . , , , .
PenPos . MoveTo . , MoveTo.
Pitch . Windows :
- , . . , ;
- . Pitch:
- fpDefauit - , , . . , ;
- fpFixed - ; - fpvariable - .
Pixels Y , clipRect. , ciipRect, -1.
shortcut , .
showHint . Hint.
showing , . , . . showing visible. visible (, ) true, showing true. visible -
false, Showing false.
size .
Taborder <b>. . Taborder -1, <b>. , : Button1, Button2 Button3. : Button2, Button1 Button3, Taborder Button1 1, Button2 0, Button3 2.
Tabstop , <b>. true, <b> , Taborder. Tabstop false, Taborder <b>.
Tag . Longint. Tag , .
Text , . TEdit -.
TextFlags TextOut TextRect. :
- ETO_CLIPPED - , ;
- ETO_OPAQUE - ;
- ETO_RTLREADING - . Windows, ;
- ETO_GLYPH_INDEX - GDI Windows. TrueType.
, .
Transparentcoior .
visible , . true, , - .
width , .
- , . . , , , , . :
Buttonl.Click
(click) (Buttonl).
, . :
type TMyComponent = class(TObject)
procedure DoSomething;
end;
, , DoSomething procedure. , . , . :
procedure TMyComponent.DoSomething; begin
// ,
// DoSomething
end;
, DoSomething
(procedure TMyComponent.DoSomething;).
, Delphi.
Add TList, TstringList Tstrings. ,
. , , . Count . EListError , , Duplicates dupError..
rc . . (X1, YI) (X2, Y2) , . (X3, Y) , , (X3, Y). (X4, Y4) , , (X4, Y4). . , . 2.3.
. 2.3. , Arc
. 2.3 Arc: Imagel.Canvas.Arc (0,0, 200,100, 200,10, 0,0);
, MS Windows, 1+2, Y1+Y2 X1+X2+Y1+Y2. 32 768.
Assign . : 1 := 2. , <-> <->, Assign . Assign . ,
D.Assign(S) D "", s ( s ). Assign , AssignTo, TPersistent , . s.AssignTo(D). AssignTo , AssignTo TPersistent . Assign . Timage:
Imagel.Picture.Assign (Clipboard);
, ,
Clipboard.Assign (Imagel.Picture);
Windows uses , Clipboard, ClipBrd.
BeginDrag , . , DragMode dmManual. , dmAutomatic, . BeginDrag onMouseDown. immediate BeginDrag , , DragCursor, . , immediate false, , . , , .
BringToFront Z-. Z- controls (. " " ). , Z- , , . , BringToFront "" , . , . Z- , , , TM, - BringToFront .
BrushCopy () , . Delphi .
CanFocus , . true, visible Enabled true.
changeScale . , , Left, width, Height. ChangeScale , : . . , Forml , , - :
Forml.ChangeScale (2,1);
Forml .
, , , , , D, :
Forml.ChangeScale (1,3);
chord , . Arc. chord , . 2.4.
. 2.4. , Chord
className .
clear , , , .
:
ListBoxl.Clear; Memol.Clear;
Clear Clipboard. Clear
.
click Onciick . . , Onciick Buttoni :
Button1.Click;
clientloScreen . . - . ScreenTodient.
containsControi , ( ) - . , true, - false.
controlAtpos . , , , POS. , , ControiAtpos nil. AllowDisabled , , ( Disabled = true).
copyRect . , copyMode.
Delete , TList, TStringList, TStrings TMenuitem. - - . , . . , , , .
, . , , . , .
Destroy . .
Destroy . Free, , , Destroy. , Free . Release.
DisabieAiign . , EnableAlign.
Dormant . GDI, . ( 2.1).
2.1
// Bitmapl
Bitmapl.LoadFromFile ('mypicture.bmp');
// Bitmap2 Bitmapl
Bitmap2.Assign (Bitmapl);
// Dormant GDI
Bitmap2.Dormant;
Draw , , Graphic, , . , , . :
Imagel.Canvas.Draw (10, 10, Image2.Picture.Bitmap);
, 10, 10 image1
Image2.
DrawFocusRect XOR. . :
Imagel.Canvas.DrawFocusRect (Rect (0,0,30,30);
Ellipse . - (X1, YI) (X2, Y2) , .
Error TList.
Raise. :
List.Error (" % List', I);
- .
Exchange . index1 index2.
Exchange - .
Expand TList. . , , - .
FiliRect , Brush. , image1 , Brush:
with Image1.Canvas do FiliRect (Rect (0, 0, Width, Height));
FindNextControl curControl , . , . GoForward - . true, , - . checkTabstop - , , Tabstop false. true, , - . checkParent , , , . false, , - .
First TList.
FloodFill - .
: , . (, ) . . color , . Fillstyle . fsSurface, , Color, . Fiiistyie fsBorder, , , color, .
Focused , . true, , -
false.
FrameRect . (Brush). . . , , imagei :
with Imagei.Canvas do begin
Brush.Color := clRed;
FrameRect ( Rect (10,10,150,100));
end;
Free . , , , Destroy.
GetTabOrderList TList , . Tabstop . , .
HandleAl located . , , true. , , . Handle .
HandleNeeded , . createHandle , .
Hide ., .
Component.Visible := false;
, .
, , .
indexof - TList . , -1.
insert . index , . ( ). , , EListError. Add.
invalidate , - .
Last , TList, Count -i.
LineTo . (penPos) (, Y), , .
LoadFromClipboardFormat Windows Clipboard.
LoadFromFiie , FileName. - ( , ), , EInvalidGraphic.
LoadFromstream , stream. , , TBlobStream.
Lock . unlock. Lock Lockcount, . , . , TryLock. .
Mask - . Transparentcoior , .
Move , , Curindex , Newlndex.
MoveTo (Penpos) (, ). . penPos.
OpenBit TBits, false.
Pack TList , nil. .
Pie . Arc. pie , . 2.5.
. 2.5. Pie
Play AVI. : FromFrame, ToFrame count. , - , - . , count , , stop.
Polygon , Points, , , Brush. :
Imagel.Canvas.Polygon ( [ Point (10, 10), Point (30,10),
Point (130, 30), Point (240, 120) ]) ;
image1 , .
PolyLine , . . - . Polygon , PolyLine
Points.
Rectangle . : . ,
Brush.
FillRect, - RoundRect. , FrameRect.
Refresh . Repaint.
Remove item TList. , , . Delete.
Repaint . Refresh. Repaint invalidate, update.
RoundRect . , Brush. (X1, Y1) (2, Y2) ( Rectangle). X3 Y X3 X. .
saveToclipboardFormat Windows Clipboard Windows. : Assign.
saveToFile , FileName.
SaveToStream , stream.
ScreenTociient .
ScroilBy ( ). Deltax DeltaY, , , . , - . , Formi 10 :
Forml.ScroilBy (-10, 0);
SelectFirst , . ,
Forml.SeiectFirst;
Forml.
SelectNext , curControl. GoForward : true, , - . checkTabstop , true TabStop.
sendCancelMode . , - , . .
sendToBack Z-no. , - . , .
SetBounds : Left, Top, width Height. , , - ALeft, ATop, AWidth AHeight. . , , , .
SetchiidOrder , child, . , order: :
Forral.SetChildOrder (Buttonl, 5);
, Buttonl Form1 ( ).
SetFocus . :
Memol.SetFocus;
setzorder Z-. TopMost true, Z-, .
show , . visible true. sort
TList.
stretchDraw , , Graphic , Rect, . , , image2 20x20 20x20 , Image 1:
Imagel.Canvas.StretchDraw ( Rect (0,0,19,19), Image2.Picture.Bitmap);
TextExtent , Text, , . TSize.
TextHeight , Text, .
Textout , Text (, Y). :
Imagel.Canvas.TextOut (10, 100, ' Delphi');
" Delphi" image1, (10, 100).
TextRect Textout , , , .
Textwidth Text , .
TryLock , . true LockCount , . , false LockCount.
unlock . Unlock LockCount .
update , - .
(Field) () - , . , . :
type
TMyComponent = class private
FMyFieldl: char; FMyField2: real; FMyFieldS: string; FMyField4: boolean;
end;
, TmyComponent,
FMyFieldl, FMyField2, FMyFieldS FMyField4,
. , .
() . , TMyComponent - TObject, , , , . , , - , , , .
, Windows - . , , . . , .
(event) - , , (event handler).
, . , - , , onclick, . , Button1 onciick. , Delphi - Buttonlclick, Onciick. , Buttoni Buttonlclick.
, (. 2.6).
. 2.6.
, Delphi. :
.
onchange - . - , .
onclick , , . , Onciick :
- , , (Grid), (Tree), (List) (DropDown List);
- <> <Enter> , (, ) (component.Focused =
True);
- <Enter>, , ;
- <Esc>, , ;
- ("" ) . , caption &, . , <Alt>+<>, onclick;
- checked RadioButton
true;
- Checked checkBox; - click .
onciick , , .
onDblclick , , .
Onclick OnDbiciick, . OnStartDrag , , . . , , . Sender,
, ( , ).
onDragDrop , . , . source , Sender - , . , Y . , , .
onDragOver , . , -. ( ) OnDragDrop, . , , Accept. , OnDragOver , . :
procedure TForml.ListBox2DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean); begin
// , //
end;
. DragCursor , .
OnDragDrop OnDragOver.
OnDragDrop , . , ListBox: ListBoxi ListBox2. items. 1. . . 10 (. 2.7).
. DragMode ListBoxi dmAutomatic,
. (ListBox2) OnDragOver ( 2.2).
2.2
procedure TForml.ListBox2DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept := Source is TListBox;
end;
. 2.7. OnDragDrop OnDragOver
, ListBox2 TListBox. OnDragDrop ( 2.3):
2.3
procedure TForml.ListBox2DragDrop(Sender, Source: TObject; X, : Integer);
begin
ListBox2.Items.Add(ListBoxl.Items[ListBoxl.Itemlndex]);
end;
, ListBoxl
ListBox2.
! . .
OnEndDrag - , . , , ( , ). .
OnEndDrag. (, " " ""). Sender - , Target - ( ) nil ( ). ( 2.4).
2.4
procedure TForml.ComponentlEndDrag(Sender,
Target: TObject; X, Y: Integer);
begin
If Target = Nil then ShowMessage(' '+
(Sender as TControl).Name + ' ') else
ShowMessage((Sender as TControl).Name + ' ' + (Target as TControl).Name);
end;
, 2.3, . OnEndDrag (ListBox1). , - (. 2.8), - -, . 2.9.
. 2.8. , ListBox1 ListBox2
. 2.9. , e ListBox1
OnEnter , . . (. . , , ) OnEnter , .
OnExit OnEnter. , , . . . . OnEnter, OnExit , -, .
, OnEnter OnExit. Button1 RadioGroupi (. 2.10). ( items).
. 2.10. , OnEnter OnExit
. , ( - Button1). , :
Button1 OnExit;
- RadioGroupi - OnEnter;
- , - OnEnter.
Button1, :
- OnExit; - - OnExit;
- Button1 - OnEnter.
onKeyDown , . , . , <Shift>, <Alt> <Ctrl>. - , sender, , Key shift. Key . , -
, . (. 2.7).
2.7.
, NumLock
(/). shift , :
- ssshift - <Shift>;
- ssAlt - <Alt>;
- ssctrl - <Ctrl>.
OnKeyDown. , , <Ctrl>+<Shift>+<L>. OnKeyDown :
if ((Key = ord CL1)) and (ssShift in Shift) and (ssCtrl in Shift)) then ShowMessage (' <Ctrl>+<Shift>+<L>');
ord (), ( , <L>). , , , , <Ctrl>+<Shift>+<L>, (. 2.11).
. 2.11. , OnKeyDown
onKeypress . Key, char. , .
OnKeyPress <Shift>, <Ctrl> <Alt>. , <Shift>+<b>, Key OnKeyPress "", <Shift> . , <Alt>, OnKeyPress <>+< > . <11>+< > OnKeyPress , Key .
OnKeyUp . , OnKeyDown.
OnKeyUp OnKeyDown.
onMouseDown , . Button, shift, x Y. Button , :
- mbLeft - ; - mbMiddle - ; - mbRight - .
shift shift , . , <Shift>, <Ctrl> <Alt>.
Y .
onMouseUp , . onMouseDown.
onMouseMove . ' , - .
. - .
: shift, Y, .
onPaint. , Windows . . , . , , BitMap, OnPaint :
Canvas.Draw (, , BitMap);
OnProgress , . . OnProgress : stage, PercentDone, RedrawNow, R Msg. stage (, , ) psstarting (), psRunning (), psEnding (). PercentDone , . RedrawNow , . R , . , Msg . . Msg .
Delphi, VCL (. 2.12).
. 2.12. Delphi
, , , TObject. TObject :
- , , ;
- (RTTI);
- ;
- , .
, TObject - TPersistent. , . TPersistent - TObject, , , . TPersistent :
- ;
- ;
- .
- TPersistent TComponent - (VCL) Delphi. Tcomponent, :
- Delphi, ;
- ;
- ActiveX (Wizard).
- TComponent - Tcontrol. TControl , . . . , TControl, , , , , . .
, TControl.
- TGraphicControl. , , . . . - . TGraphicControl , TBevel, TImage, TSpeedButton .
TGraphicControl canvas, , . , TGraphicControl Paint. - TGraphicControl Windows, , , Twincontrol.
- Twincontroi. . - , :
- ;
- . , , (parent). , , (child);
- Windows (handle). , .
TButtonControl, TCustomEdit
.
(RTTI)
(Runtime Type Information, RTTI) - Delphi . Delphi TObject, , . . 2.8 .
2.8. RTTI
Delphi : is as. , - .
Delphi , . RTTI. . , - , . , , TButton, Enabled false. 2.5.
2.5
for i:=0 to ComponentCount-1 do
if Components[i] is TButton then
TButton(Components[i]).Enabled:=false;
is . as. , 2.6, , TControi.
2.6
for i:=0 to ComponentCount-1 do
(Sender as TControi).Enabled:=false;
, - , , , . , , , . , , , . , , . , , , . , , , .
{DATA}
| | 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _. 10.11.2021 - 12:36: - Conscience -> . ? - _. 10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _. 10.11.2021 - 12:35: - Ecology -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> . - _. 10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _. 10.11.2021 - 09:18: - New Technologies -> , 5G- - _. 10.11.2021 - 09:18: - Ecology -> - _. 10.11.2021 - 09:16: - Ecology -> - _. 10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _. 10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
|