Professional Documents
Culture Documents
? Adding Art-effects
Adding artwork and special effects to an application is the most exciting and addicting
part of programming. Creating impressive and useful graphical effects with Visual Basic
is very simple. Here we will discuss
Line1 BorderWidth 5
Bordercolor Dark Blue
? Double-click the Quit Command Button and type End in the cammand1_click
event procedure, and then close the code window.
? Click the start button on the toolbar and the will appear as:
The following example uses three graphical command buttons (Bold, Italic, and
Underline) to format the text on the form.
Label1
Image3
Image2
Image1
Label2
? Open New form in your project by clicking Project>>Add form, then selecting the
form option.
? Create the following objects in the blank form.
? Click Start command from the toolbar to run the program. When the command
buttons are clicked , this program will change the font type of the text.
In drag-and-drop features, user can drag the object from one location to another by
pressing the mouse button, and then releases the mouse button to relocate the object or to
issue a command.
To add Drag and Drop support to a program the following three steps are required:
Enable Drag and Drop object. To add drag and drop support to an object, it is required
to set DragMode property to 1 by using program code or the property window.
Select a drag icon. By default rectangle is used to represent an object being dragged. But
it can be substituted by setting DragIcon property of the object to the Bitmap or icon by
using program code or the property window.
Write DragDrop or DragOver event procedure for the target object. Event procedure
should be written for the object that is the target, or destination, object of the dragging
motion.
Write the following code for the form_load() and Image2_DragDrop events.
Visual basic uses the MouseIcon property to set the pointer shape.
? Adding Animation
? Open new form in your project by clicking Project>>Add form. Then selecting the
form option.
? Create the following objects in the blank form.
Visible True
Timer1 Enabled True Private Sub Timer1_Timer()
Interval 65 Image1.Move Image1.Left - 50, Image1.Top - 75
End Sub
? Click Start button to run the program. A rocket is moving from one point to other
point in the output window.
? Few Examples
Image1
Image3
Image6
Open the new form in your project by clicking the Project>>Add form.
Create the following objects in the blank form.
Example 2: Adding a smoke cloud with animation effect to the above program.
In the previous form add picture of cloud and timer to it as shown above.
Set the following properties for the picture box and timer
Object Property value
Picture1 Appearance 3D
BackColor Lightgray
BorderStyle 0-None
Picture C:\program files\Microsoft visual studio \common
Visible \graphics\ icons\Elements\Cloud.ico
False
Timer1 Enabled False
Interval 65
? Open the new form in your project by clicking the Project>>Add form.
? Create the following objects in the blank form.
? Run the program by clicking Start button. The earth icon will appear alone on the
form.
? Click the Earth icon several times to expand it on the screen.