Вы находитесь на странице: 1из 11


Visual basic is developed by Microsoft corporation u.s.a.it is a popular application development tool to develop windows applications .visual basic provides a graphical environment in which you can design programs with forms and controls which are the building block of your application. To design a paint program in vb using mouse events like mouse move and mouse down. mouse down event occurs when the user press a mouse button. and the mouse events happens when the mouse moves over an object. these two events can distinguish between left and middle mouse buttons .use a mouse down or mouse event procedure to specify actions that will occur when a given mouse button is pressed or released. Syntax Private sub object-mouse-down (button as integer, shift as integer ,x as single, y as single) End sub In this project we can also change colour and width of the drawing various kinds of pictures in a form with the help of another two forms including command buttons and labels.



The project presented here is a paint program in visual basic for the continous evaluvation work of plus two commerce students in computer application for the year 2011-2012.the objective of the project is to study the events , controls and methods of vb. This project deals with the controls and its related codes for preparing a simple software program in vb. The project is fundamentally about providing events ,methods, and also declaring variables in private or public environment. it is mainly concerned with visual basic . The output expected from this project are the events occurs in mouse and draw a paint program with also changing colour and width of the drawing various kinds of pictures.


1. To create a simple software program in visual basic 2. For studying events, controls, and method in visual basic. 3. For studying the declaration of variables with various data types. 4. How a program design, run , and debug in visual basic 5. And also how we prepare codes for creating a program in VB with its related data.

This is certificate of plus two commerce students in gov.h.s.s.cherpu had completed their project on a paint program in visual basic in the year 2011 in partial fulfillment of continous evaluvation work on the subject computer application


signature of the guide


Visual basic is the one of the most simplest and elegant gui application development tool. Vb provides a graphical environment in which one can visually design the forms and controls that become the building blocks of an application The VB IDE window contains menu bar, tool bar, and many windows such as the tool box ,form window, project window , the properties window and form lay out window. The form window: the form window shows a blank form that will act as the window of our application. The tool box : the tool box is located on the left side of the screen which displays the standard VB controls like label ,command button, check box etc...,that will become elements of the user interface. The properties window: the properties window appears on the right side of the screen below the project window which lets us change the characteristics or property setting of the controls on the form or the form itself like name , caption, alignment. The project window: the project window appears on the right side of the window which displays the components (different types of files) of a project in a tree structure, arrangement as several folders such as forms, modules etc. The form layout window: the form lay out window allows us to visually position our forms at design time Form: forms are the basic building blocks of a visual basic application; this window serves as the user interface in visual basic. different controls are placed on the form .for each form in an application , there is related form module (with file name extention .frm) that contains its code. Command button: a command button represents an action that is carried out when the user clicks on it use a command button control to begin or end a process.

Label: it is used to display read only text.that is the text that the user cannot edit . labels are commonly used to give titles to other controls that do not have a caption property.we can change the caption of the label by writing code in response to events at run time. Text box: the text box control is a small text editor and its most important property is the text ,which can set text on the control read the text that the user enters. Text boxes are basically used to get input from the user or to display text.


Steps 1: starting visual basic 1.click start button 2.select programs a sub menu will appear 3.select micro soft visual studio 6.0 from sub menu 4. click on Microsoft visual studio 6.0 item from the menu 5. the new project dialog box appears 6. select the standard exe project dialog box 7.a new project opens in visual basic integrated development environment STEP 2: desiginig user interface (a) set the form s properties *select the form by clicking on the form in the form window . the property window shows form 1 as the selected object. *now select the properties window of the form and also change the properties of the form



PROPERTY Caption Back colour Windowstate Auto redraw

VALUE A PAINT PROGRAM White 2-maximised True

(b) Creating menu items *in the menu editor window the programmer can specify the structure of the menu of adding one command at a time .each menu command has two mandatory properties. Caption: this is the string that appears on the application s menu bar. Name: this is the name of the menu command which does not appear on the screen but the code uses it to program these menu command. *select Tools ----> menu editor.menu editor window appears and create the following menu structure listed below CAPTION &COLOR MENU &WIDTH MENU &CLEAR MENU NAME COLOR WIDTH CLEAR INDEX 1 1 1

(c) add forms to our project *click project --------> Add form.add form dialog box appears and click open .a new form will be added .and save it. Similarly add in total two forms and save it with names colour selection and line width. (ii)form2 (a) set the form s caption property CONTROL Form 2 PROPERTY Caption Start up position Window state VALUE Color selection 1-Center owner 2-maximised

(b)Adding Labels to our colour selection form

*select label control from the tool box .mouse pointer now changed to cross hair *select the left hand corner of the area where the label should be ,press the left mouse-button and hold it *drag the mouse to the lower right corner of where the label should go *release the mouse button and the label will appear. *draw 10 labels and set its properties as shown below

CONTROL Label 1- Label 8 Label 8 Label 10

PROPERTY Border style Appearance Caption Auto size Name Caption

VALUE 1-Fixed single 0-Flate Selected color True Labresult Nil

(c) adding command button to our colour selection form * click on the command button control from the tool box and add two command buttons to our project and set its properties as shown below

CONTROL Command Button 1 Command Button 2

PROPERTY Name Caption Name Caption

VALUE Cmdok &OK Cmdcancel &CANCEL

(a) setting the form s properties CONTROL FORM 3 PROPERTY Caption Start up position Window state VALUE LINE WIDTH 2-Center screen 2-maximised

(b) adding label to our line width form *click on the label control and place it to the form and set its properties




(c) adding text box to our line width form *select the text box control from the tool box * text box can be added in the same manner as label control *add only one text box and change its properties CONTROL Text box 1 PROPERTY Name Text VALUE Txtwidth Nil

(d)adding command buttons to our line width form *select two command buttons from the tool box and set the properties as shown below CONTROL Command button 1 Command button 2 PROPERTY Name Caption Name Caption VALUE cmdok OK cmdcancel CANCEL

From the above project, we concluded that our aims of the project is very suessful. we also studied about the events, methods, and controls in a visual basic and how we prepare a simple software in visual basic