17-10-12, 12:18 AM
كاتب الموضوع : AhmedEssawy
ليس هناك ما هو جديد في هذا الكود ، كل ما عليك هو معرفة الثوابت الخاصة بألوان الأزار الافتراضية ، ألوان الفورم ، الخطوط ... الخ .كود :
'Author: Dan McLeran
'Date Created: 08/25/1999
Public Function SetToDefaultSysColors(frm As Form, sErrorMsg As _
String) As Boolean
On Error GoTo ErrSetToDefaultSysColors
Dim cntrl As Control
'init to failure
SetToDefaultSysColors = False
'set form properties
frm.Font = vbWindowText
'set control properties
For Each cntrl In frm.Controls
If (TypeOf cntrl Is ComboBox) Or (TypeOf cntrl Is _
TextBox) Then
cntrl.BackColor = vbWindowBackground
cntrl.Font = vbWindowText
'NOTE: MUST HAVE REFERENCE TO FLEX GRID CONTROL
'FOR THIS TO WORK
ElseIf TypeOf cntrl Is MSHFlexGrid Then
cntrl.CellBackColor = vbWindowBackground
cntrl.CellFontName = vbWindowText
ElseIf TypeOf cntrl Is Label Then
cntrl.Font = vbWindowText
End If
Next cntrl
'indicate success
SetToDefaultSysColors = True
SetToDefaultSysColorsExit:
Exit Function
ErrSetToDefaultSysColors:
SetToDefaultSysColors = False
sErrorMsg = "Error number: " & Err.Number & vbCrLf & "Description: " & _
Err.Description & vbCrLf & "Function - " & modName & _
".SetToDefaultSysColors"
Resume SetToDefaultSysColorsExit
End Function