تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
استعادة ألوان وخطوط الفورم إلى الوضع الافتراضي من خلال الكود
#1
كاتب الموضوع : 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
}}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم