Forms
 

Anchoring

The Anchor and Dock properties of a form are two separate properties. Anchor refers to the position a control has relative to the edges of the form. A textbox, for example, that is anchored to the left edge of a form will stay in the same position as the form is resized.

 


 

Docking

Docking refers to how much space you want the control to take up on the form. If you dock a control to the left of the form, it will stretch itself to the height of the form, but its width will stay the same.

 



Adding a Toolbar

 

Click on your Toolbar to select it. In the property box for the Toolbar, you'll notice that it has the default Name of ToolBar1. We'll keep this Name. But locate the Buttons

 


 

Each button on the toolbar has it's own properties and methods. The button you have just added has a default Name of ToolBarButton1. This is not terribly descriptive. What we're going to do is add three toolbar buttons: one to create a new file, one to open a file, and one to save a file. So,




  • Click the Name property and change it to tbrFileNew


  • Click Add to create a second button


  • Change the Name of this to tbrFileOpen


  • Add a third button and change the Name property to tbrFileSave


  • Then click OK


  • Your toolbar will look like this:



Adding Images to your Toolbar Buttons


The toolbar buttons get their pictures from the Image List control. You add pictures to the Image List, then point your toolbar at this control. The toolbar will then recognise the images in the list.


So expand the Toolbox, and scroll down until you find the ImageList control. Double click it to add one to your project. The ImageList is another control that doesn't appear on the form, but in the area below it:



 


 


 

Coding

(c) Shilpa Sayura Foundation 2006-2017