.


:




:

































 

 

 

 


. 1. ImageList ( Win32)




1. ImageList ( Win32)

ImageList ( 16 x 16 ). ImageList , . , 0.

:

¨ Width

¨ Height

¨ DrawingStyle

:

¨ Add ()

¨ Delete ()

¨ Clear ()

¨ FileLoad ()

¨ GetBitmap () , GetIcon

TImageList . TImageList ImageList Editor . ( Add), ( Delete), ( Clear). , .

 

v 1. 2 ImageList. 16x16, - 32x32. ImageList1 Files\ Common Files\ Borland Shared\ Images outclose.bmp Default, constr16.bmp handsh16.bmp Icons. Wedth Height ImageList2 32, Icons handshak.ico.

2. TreeView ( Win32)

, .

Items . TTreeNodes .

TreeView:

¨ ShowButtons +

¨ ShowLines

¨ ShowRoot .

¨ SortType .

ú stText -

ú stData - Data

ú stBoth - Data

¨ Count , , .. , .. Count , .

¨ Indent .

 

, . TreeView Items . New Item , New Subltem . Delete, . Load . . , , :

Standard

MainMenu

Label

Edit

Additional

BitBtn

SpeedBtn

MaskEdit

Item Properties , Text , , Image Index Selected Index , , . 0 , ImageList. Images TreeView. -1 ( ).

 

Item [intIndex]. , 0 ( .1 , 4),

{ TreeViewl->Items->Item[0]->Count }

Selected , . , Selected NULL. OnChange, TTreeNode*Node . , . :

void __fastcall TForm1::TreeView1Change (TObject *Sender, TTreeNode *Node)

{ Edit1->Text = Node->Text; } // Edit1

. Data.

 

:

¨ AddChild ()

¨ Add ()

¨ Insert ()

¨ Clear ()

¨ SaveToFile

, ,

{ TreeView1->Items->Add (NULL," "); }

 

v 2. , , . , ImageList1 ImageList2 1. *.h Student :

class Student

{ public:

AnsiString Fam;

AnsiString Name;

int NomZach; //

int Shit; //

Student (AnsiString F, AnsiString N,int NZ,int S)

{ Fam=F; Name=N; NomZach=NZ; Shit=S; };

};

Student* stud1 = new Student ("","",1496,7015);

Student* stud2 = new Student ("","",1355,7047);

Student* stud3 = new Student ("","",3792,6034);

Student* stud4 = new Student ("","",4550,7532);

Student* stud5 = new Student ("","",4567,7542);

TreeView. Button1 . Click ( , Items TreeView).

void __fastcall TForm1::Button3Click(TObject *Sender)

{

TTreeNode* Nd; // TTreeNodes

TreeView1->Items->Clear();

Nd=TreeView1->Items->Add(NULL," 240");

FillViewList (Nd,stud1); //

FillViewList (Nd,stud2);

FillViewList (Nd,stud3);

Nd=TreeView1->Items->Add(NULL," 243");

FillViewList (Nd,stud4); //

FillViewList (Nd,stud5);

}

FillViewList (), *.h

private: void __fastcall FillViewList(TTreeNode* Nd, Student* stud);

*.cpp

void __fastcall TForm1::FillViewList (TTreeNode* Nd, Student* stud)

{

TTreeNode* NdChild;

NdChild=TreeView1->Items->AddChild (Nd,stud->Fam);

NdChild->Data=stud; //

NdChild->ImageIndex=1;

NdChild->SelectedIndex=1;

}

, , , :

Edit1->Text=((Student*) Nd->Data) ->Name; //Nd-

 

3. ListView ( Win32)

ListView , , , . : , vsReport - .

ListView:

¨ Items TListItem,

¨ ViewStyle - . :

ú vsIcon -

ú vsSmallIcon -

ú vsList -

ú vsReport -

¨ Columns vsReport, TListColumn. ShowColumnHeaders true

¨ Largelmages , (vsIcon)

¨ SmallImages , vsSmallIcon, vsList vsReport

Items , :

ú SubItems , ..

ú Caption - , , vsReport.

ú ImageIndex - , ImageList. Largelmages SmallImages

Items NewItem - NewSubltem - . Caption ImageIndex. Columns , ListView . Caption

ListView:

¨ Clear () -

¨ Add () -

¨ Delete ()

 

v 3. . ListView , ..

void __fastcall TForm1::FormCreate(TObject *Sender)

{ ListView1->ViewStyle = vsList; }

Columns, 4 ( Caption) , , , . . , ( ) ListView. OnChange :

void __fastcall TForm1::TreeView1Change(TObject *Sender, TTreeNode *Node)

{ int i;

ListView1->Items->Clear(); //

if (Node->Level > 0) //

SetViewList (Node); //

else //

for (i=0; i<Node->Count; i++)

SetViewList (Node->Item[i]); } //

SetlViewList (), *.h

private: void __fastcall SetViewList(TTreeNode* Nd);

*.cpp

void __fastcall TForm1::SetViewList(TTreeNode * Nd)

{ TListItem *Item1; //

Item1=ListView1->Items->Add(); //

Item1->Caption=((Student*)Nd->Data)->Fam; //

// , ..

Item1->SubItems->Add(((Student*)Nd->Data)->Name);

Item1->SubItems->Add(IntToStr(((Student*)Nd->Data)->NomZach));

Item1->SubItems->Add(IntToStr(((Student*)Nd->Data)->Shit));

Item1->ImageIndex=2; //

}

 

4. OpenDialog ( Dialogs)

, .

, Dialogs Execute (), . :

¨ FileName

¨ DefaultExt -

¨ Title -

¨ Filter - .

¨ FilterIndex ,

¨ Options ,

, . , FileName .

SaveDialog, . , OpenDialog.

v 4. :

void __fastcall TForm1::Button1Click(TObject *Sender)

{ SaveDialog1->Title = "Save File"; //

SaveDialog1->Filter = "Text files (*.txt)|*.TXT"; //

if (SaveDialog1->Execute())

if (FileExists (SaveDialog1->FileName))

TreeView1->SaveToFile(SaveDialog1->FileName);

}

5. FontDialog ( Dialogs)

, .

:

¨ Font - , ( )

¨ Options - , (, , )

 

 

6. ColorDialog ( Dialogs)

, .

:

¨ Color

¨ Options - , (, .)





:


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


:

:

,
==> ...

1762 - | 1526 -


© 2015-2024 lektsii.org - -

: 0.049 .