| Topic: Projects using Intrinsic and Professional ActiveX Control In this Lesson we will explain some five Projects as shown below using ActiveX Controls.
1. Project using the Common Dialog Control: The Common Dialog Control is first drawn into the Toolbox from Component Dialog Menu. This dialog box gives support to use some of the dialog boxes supplied by Windows 95 in your own projects. In the absence of this control you have to write codes for creating such dialog boxes,. The dialog boxes supported by Common Dialog Control are Open, Save, Print, PrintSetup, Font, Color and Help. Drag a Common Dialog Control, and seven command buttons in the form. Give the name and caption property of the Command buttons as shown in the figure 1.
Entering codes for the Command Buttons: Open the code window by double clicking the command button and write the code as shown in the figure 1a. Private Sub Color_Click() Private Sub Font_Click() Private Sub Help_Click() Private Sub Open_Click() Private Sub Print_Click() Private Sub PrintSetup_Click() Private Sub Save_Click() Figure 1a Running the Project: Select Start from the Run Menu. You will find the Common dialog box has become invisible in the run mode window. The run mode window appears as in the figure 2. On clicking the open button, you will get the open dialog window as in the figure 3. Click the cancel button in the open dialog window . Now click the Save button to view the Save window. Repeat this for viewing all the other windows and see that the project is successful..
The traditional text box control is ideal for text entry at a given font and size. RichTextBox Control allows the user to enter text with varying fonts and sizes. Add the RichTextBox control and the Common Dialog Control to the Toolbox by drawing them from the component dialog box. Drag a RichTextBox control, Common Dialog Control and a Command Btton control in the form. Set the command button caption and name as font. A font dialog box can be opened only through the Common Dialog control. The Common Dialog control box will be invisible during run time. .Save the form and the project. The project at the design time looks as in the figure 4. Entering the Code: Open the code window by double clicking the font button. Enter the codes as shown in the figure 4a and finally save the project. Private Sub Font_Click() RichTextBox1.SelFontName = CommonDialog1.FontNameRichTextBox1.SelFontSize = CommonDialog1.FontSize Figure 4a Running the Project: Select Start from the Run menu. You type any text in the RichTextBox and select it. Click the font button. The font dialog box will open. Set the desired font and size. On deselecting the text, you will find the text printed in the desired font and size. The run mode window is shown in the figure 5.
3. Project using DriveListBox, FileListBox, DirListBoc and ImageBox: In this project, the DriveListBox, the FileListBox and theDirListBox are coordinated to disk access without any programming. One can select a gif file from the disk and load it in the Image box. The four controls are drawn into the design window and arranged as shown in the figure 6. In this example we are going todisplayThe ImageBox control simply appears as empty rectangle in the design mode. At run time it will be loaded by the a .gif files. So change the Pattern property of the FileListBox from its default to *.gif. Entering the Code: Open the code window by double clicking the DirListBox. The codes are entered as shown in the figure 6a.Private Sub Dir1_Change() Private Sub Drive1_Change() Private Sub File1_DblClick()
5. Multiple document Interface: The MDI was designed to simplify the exchange of information among documents, all under the same roof. With a MDI application, you can maintain multiple windows, but not multiple copies of the application. Data exchange is easier when you can view and compare many documents simultaneously. The main form or MDI form is not duplicated, but it acts as a container for all the windows, and it is called the parent window. A MDI application must have at least two forms, the parent form and one or more child forms. There can be many child forms, but only one parent form. He parent form may not contain controls. While the parent form is open in the design mode, though the icons in the toolbox are not disabled, but you cannot place any control on the form. But you can place controls in child forms. To create a MDI application follow these steps:
Dim i Private Sub newchild_Click() Private Sub MDIForm_Load() Private Sub tile_Click() Figure 9a
|