Delphi Toolbar component (Ttoolbar)

Source: Internet
Author: User

The toolbar component (Ttoolbar) provides a way for users to access shortcut menus.

Buttions

Lists the tool buttons in the toolbar that hold a list of Ttoolbutton instances

Canvas

Use this property in the Oncustomdraw or Oncustomdrawitem event to draw on the toolbar.

Constraints

Specify the size limit for Ttoolbar

Customizable

Set this property to True to allow users to add, remove, and move toolbar buttons while the program is running. The user can press the SHIFT key to drag the button to a new location, or drag it away

Cusstiomizekeyname

Use this property to specify the location where the button configuration is saved when the current user first displays a customized dialog box for the toolbar

Cusstiomizevaluename

Use this property to specify the location where the button configuration name is saved when the current user first displays a customized dialog box for the toolbar

Disabledimages

This property contains an image list, and the ImageIndex property of each tool button determines the icon to display on the button.

Image

Provide an image list for Ttoolbar

Menu

Use this property to make the buttons on the toolbar correspond to items in the menu

Example drawing on a ttoolbar component with the Canvas property

 

Const arect:trect;   var Defaultdraw:boolean); var   bitmap:tbitmap;begin  bitmap:= tbitmap.create;  Bitmap. LoadFromFile ('C:\Documents and Settings\All Users\Documents\My Pictures\ example Picture \mm1.bmp ' );  ToolBar1.Canvas.StretchDraw (ARECT,BITMAP);  Bitmap. Free;end;

Example 2: Make a transparent button effect

Const arect:trect;   var Defaultdraw:boolean); var   bitmap:tbitmap;begin  bitmap:= tbitmap.create;  Bitmap. LoadFromFile ('C:\Documents and Settings\All Users\Documents\My Pictures\ example Picture \mm1.bmp ' );  ToolBar1.Canvas.StretchDraw (ARECT,BITMAP);  Bitmap. Free;end;procedure tform1.formcreate (sender:tobject); begin  Toolbar1.showcaptions:= True;  Toolbar1.flat:true; end;end.

Example 3 button onclick event instance

procedure Tform1.toolbutton1click (sender:tobject); Begin    Case  as Ttoolbutton  ). Indexof0: Begin       ShowMessage (' open program ' );     End;   1 : Begin       ShowMessage (' Save program ');     End;  End;end;end.

 

Delphi Toolbar component (Ttoolbar)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.