Common Dialog Box

Enter your search terms Submit search form

 


 

 

This is a program that make use of the common dialog box to open an image file, to change text color and background color of the labels that show time and time. In this program, you need to insert the Microsoft Common Dialog Control 6.0. If it is not in the toolbox menu, you have to press Ctrl+T to open the components selection menu and select it then click OK. You also need to insert an image box, the timer and two labels.

 

Private Sub BackClrMnu_Click()
CommonDialog2.Flags = &H1&
CommonDialog2.ShowColor

Label1.BackColor = CommonDialog2.Color
Label2.BackColor = CommonDialog2.Color
End Sub

Private Sub DateMnu_Click()
Label2.Caption = Date
End Sub

Private Sub OpenMnu_Click()
CommonDialog1.Filter = "Bitmaps(*.BMP)|*.BMP|Metafiles(*.WMF)|*.WMF"
CommonDialog1.ShowOpen
Image1.Picture = LoadPicture(CommonDialog1.FileName)
CloseMnu.Enabled = True
End Sub

Private Sub TextClrMenu_Click()
CommonDialog1.Flags = &H1&
CommonDialog1.ShowColor
Label1.ForeColor = CommonDialog1.Color
Label2.ForeColor = CommonDialog1.Color
End Sub

Private Sub TimeMnu_Click()
Label1.Caption = Time
End Sub

 

 

 

 

 

 [Back to VBToday]