Default
Google

How can I add images to my menu?

Applies To: C++Builder 1, C++Builder 3
Category: Knowledge Base

 1.
  Start a new project using File | New Application.
 
 2.
  Add a Menu. Insert the items File | New.
 
 3.
  Add two (2) Images. Load a small bitmap in each one of
      them.
 
 4.
  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);
}
 
 5.
  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



Acquiring image from ProHosting Banner Exchange