Tools Links Login

Professional look

This code will give a great effect to any control making the user interface much more professional

Original Author: Faisal Arif

Code

Option Explicit
Private Sub Command1_Click()
'Create a shadow to the right and below of Text1 (TextBox)
Shadow Me, Text1
End Sub
Private Sub Shadow(fIn As Form, ctrlIn As Control)
Const SHADOW_COLOR = &H40C0& 'Shadow Color
Const SHADOW_WIDTH = 3 'Shadow Border Width
Dim iOldWidth As Integer
Dim iOldScale As Integer
'Save the current DrawWidth and ScaleMode
iOldWidth = fIn.DrawWidth
iOldScale = fIn.ScaleMode
fIn.ScaleMode = 3
fIn.DrawWidth = 1
'Draws the shadow around the control by drawing a gray
'box behind the control that's offset right and down.
fIn.Line (ctrlIn.Left + SHADOW_WIDTH, ctrlIn.Top + _
      SHADOW_WIDTH)-Step(ctrlIn.Width - 1, _
      ctrlIn.Height - 1), SHADOW_COLOR, BF
'Restore Old Setting
fIn.DrawWidth = iOldWidth
fIn.ScaleMode = iOldScale
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 90 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.