.


:




:

































 

 

 

 


. 1. Timer ( System)




1. Timer ( System)

- , , .

:

¨ Interval .

¨ Enabled ( / )

ú true

ú false

.

:

¨ OnTimer , Interval

 

v . .

, , AnsiString. ( . h), ( .cpp ). <Ctrl>+F6.

Name:

1. AnsiString ( Name.h) :

extern AnsiString Str;

2. - ( Name.cpp) :

AnsiString Str= 腅.;

Edit. , . Timer

Þ Interval = 100

Þ Enabled = true

OnTimer ( Timer) , :

void __fastcall TForm1::Timer1Timer (TObject *Sender)

{ Edit1->Clear();

if (!Str.IsEmpty()) //

{ Edit1->Text = Str;
char first = Str[1];

for (int i=1; i < Str.Length(); i++) //

Str[i] = Str[i+1]; //

Str[Str.Length()] = first;} }

100 (0,1 ) Edit , .. .

2. PageControl ( Win32)

PageControl - , , .

Properties

¨ ActivePage - TTabSheet

¨ PageCount - , ( )

, . :

ú New Page

ú Next Page

ú Previous Page

ú Delete Page

TTabSheet. , . :

¨ Caption -

¨ TabVisible -

v . , 3 , () : , , . , .

 

3. DateTimePicker ( Win32)

DateTimePicker .

:

¨ Kind

ú dtkDate .

ú dtkTime

¨ Date

¨ Time

¨ DateFormat

ú dfShort . . (15.03.2004)

ú dfLong . (15 2004 .)

:: (15:45:25)

¨ DateMode ( )

ú dmComboBox

ú dmUpDown - ( )

- ( ). .

¨ MaxDate

¨ MinDate

:

¨ OnChange .

Date Time ( , Kind). :

¨ DecodeDate (year, month, day) 3 , , .

¨ DecodeTime (hour, min, sec, msec) - 4 , , , .

¨ FormatString (format) .
format , :

ú ddddd . . (15.03.2004)

ú dddddd . (15 2004 .)

ú tt :: (15:45:25)

 

v . , , . DateTimePicker :

Þ Kind = dtkDate

Þ DateFormat = dfLong

Þ DateMode = dmComboBox

OnChange ( Events ) , :

void __fastcall TForm1::DateTimePicker1Change(TObject *Sender)

{ Str = DateTimePicker1->Date.FormatString("dddddd") + " "; }

 

DateTimePicker .

 

4. TrackBar ( Win32)

TrackBar , . , - : , ..

, , , - .

Properties

¨ Position . . Position, , .

¨ Min, - Position

:

¨ Orientation - :

ú trHorizontal

ú trVertical

¨ TickMarks -

ú tmBottomRight -

ú tmTopLeft -

¨ TickStyle -

ú tsAuto -

ú tsNone -

¨ Frequency -

¨ Cursor - ,

¨ SelStart SelEnd - , - , , .

¨ LineSize - , ,

¨ PageSize - , , PageUp PageDown

:

¨ OnChange . Position - .

 

v . TrackBar. TickMarks, TickStyle, Orientation. :

Þ Min=0

Þ Max=10

Þ Position = 5

OnChange (- ) , .. , :

void __fastcall TForm1::TrackBar1Change(TObject *Sender)

{ Timer1->Interval = 200-(TrackBar1->Position)*20; }

 

5. UpDown ( Win32)

UpDown - - Edit . UpDown Edit , , .

true Readonly Edit, - .

 

:

¨ Associate - , Edit.

¨ AlignButton

ú UdLeft

ú UdRight-

¨ Orientation

ú UdHorizontal - ( )

ú UdVertical - ( )

¨ ArrowKeys

ú true -

ú false

¨ Min -

¨ -

¨ Increment -

¨ Position - ( Min )

¨ Wrap - ,

ú false - , , ;

ú true - . , , ..

:

¨ OnChanging UpDown. Position, ,

v . Edit2 UpDown. UpDown:

Þ Associate = Edit2 ( )

Þ Max = 30

Þ Min = 10

Þ Position = 20 ( )

Þ Increment = 2 ( )

UpDown1Changing - OnChanging UpDown1 , :

{ Edit1->Font->Size = UpDown1->Position; }

6. ProgressBar (Win32)

ProgressBar - .

Properties

¨ Min -

¨ -

¨ Position - ( Min )

¨ Orientation

ú dHorizontal -

ú dVertical -

¨ Step 1

¨ Smooth

ú true -

ú false (1 1 , .. , Step)

 

v -

MyForm

Þ MyTimer

Þ EditTimer

Þ UpDownTime - EditTimer

Þ LabelTime

Þ Label1 - Caption = , EditTimer

Þ Label2 - Caption = , LableTime

Þ MyProgressBar -

Þ ButtonStart - .

!.

 

TMyForm *MyForm;

TProgressBar *MyProgressBar;

void__fastcall TMyForm::TMyForm(TComponent* Owner): Form(Owner)

{

MyProgressBar->Visible = false //

MyTimer->Enabled = false; //

}

 

void __fastcall TMyForm::ButtonStartClick(TObject *Sender)

{ MyTimer->Enabled = true; //

MyProgressBar->Position = 0; //

MyProgressBar->Max = UpDownTime->Position; //.

// EditTimer

MyProgressBar->Visible = true; //

}

 

void __fastcall TMyForm::MyTimerTimer(TObject *Sender)

{ //

LabelTime->Caption = Time().FormatString("tt");

//

if(MyProgressBar->Position < MyProgressBar->Max)

{

MyProgressBar->Position++; //

if ((MyTimer->Enabled) & (StrToInt(EditTimer->Text)!=0))

//

EditTimer->Text=IntToStr(StrToInt(EditTimer->Text)-1);

} //

else //

{

MyProgressBar->Visible =false;

MyTimer->Enabled = false;

ShowMessage(" !"); //

LabelTime->Caption = "";

}

}





:


: 2015-10-01; !; : 653 |


:

:

,
==> ...

1771 - | 1541 -


© 2015-2024 lektsii.org - -

: 0.071 .