اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

مساعدة في كود او طريقة تغيير للون خلفية TreeView1


محمد حمزه

الردود الموصى بها

السلام عليكم ورحمة الله وبركة

برجاء المساعده في كود يغير للون خلفية TreeView1

ملحوظه اعمل على اصدار اوفيس 2019

شكرا لكم

تم تعديل بواسطه محمد حمزه
رابط هذا التعليق
شارك

Private Const GWL_STYLE = -16&
Private Const TVM_SETBKCOLOR = 4381&
Private Const TVM_GETBKCOLOR = 4383&
Private Const TVS_HASLINES = 2&
Private Const CLR_INVALID = &HFFFF
Private Declare Function SendMessage Lib "user32" _
                         Alias "SendMessageA" _
                         (ByVal hwnd As Long, _
                          ByVal wMsg As Long, _
                          ByVal wParam As Long, _
                          lParam As Any) As Long

Private Declare Function GetWindowLong Lib "user32" _
                         Alias "GetWindowLongA" _
                         (ByVal hwnd As Long, _
                          ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib "user32" _
                         Alias "SetWindowLongA" _
                         (ByVal hwnd As Long, _
                          ByVal nIndex As Long, _
                          ByVal dwNewLong As Long) As Long

Private Declare Function OleTranslateColor Lib "oleaut32" _
                         (ByVal clr As OLE_COLOR, _
                          ByVal hPal As Long, _
                          dwRGB As Long) As Long
Private Function TranslateColor(ByVal clrColor As OLE_COLOR, _
                               Optional hPalette As Long = 0) As Long

If OleTranslateColor(clrColor, hPalette, TranslateColor) Then
  TranslateColor = CLR_INVALID
End If
End Function
Private Sub ChangeBackgroundColor(ByVal hwnd As Long, ByVal longColor As Long)
Dim longStyle As Long
    SendMessage hwnd, TVM_SETBKCOLOR, 0, ByVal TranslateColor(longColor)
    longStyle = GetWindowLong(hwnd, GWL_STYLE)
    SetWindowLong hwnd, GWL_STYLE, _
        longStyle And (Not TVS_HASLINES)
    SetWindowLong hwnd, GWL_STYLE, longStyle
End Sub

Private Sub Form_Load()
  ChangeBackgroundColor axTreeView.hwnd, 14935260      ' axTreeView is me.axTreeView
End Sub

 

  • Like 1
رابط هذا التعليق
شارك

من فضلك سجل دخول لتتمكن من التعليق

ستتمكن من اضافه تعليقات بعد التسجيل



سجل دخولك الان
  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information