How can I add images to my menu?
Applies To: C++Builder 1, C++Builder 3
Category: Knowledge Base
- Start a new project using File | New Application.
-
- Add a Menu. Insert the items File | New.
-
- Add two (2) Images. Load a small bitmap in each one of
- them.
-
- Edit the OnShow event of your form:
-
- void __fastcall TForm1::FormShow(TObject *Sender)
- {
- SetMenuItemBitmaps(MainMenu1->Handle, New1->
- Command, MF_BYCOMMAND, Image1->Picture->
- Bitmap->Handle, Image2->Picture->Bitmap->
- Handle);
- }
-
- Double-click the OnClick event of the New menu item:
-
- void __fastcall TForm1::New1Click(TObject *Sender)
- {
- if(New1->Checked)
- New1->Checked = false;
- else
- New1->Checked = true;
- }
C++Builder Developer's Network
Copyright © Yoto Yotov