Results 1 to 6 of 6

Thread: Setting the treeview backcolor to form color

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    113

    Setting the treeview backcolor to form color

    I want to set the backcolor of the treeview control to the same grey shade as the form itself. However, I can't seem to find the exact same grey shade as the form.

    Anyone have any ideas ?

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    here you go

    VB Code:
    1. Private Sub Form1_Load(ByVal sender As System.Object_
    2. , ByVal e As System.EventArgs) Handles MyBase.Load
    3.         Dim color_of_Form1 As Color
    4.         color_of_Form1 = Me.BackColor
    5.         TreeView1.BackColor = color_of_Form1
    6.     End Sub

    have fun!!

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Look at the backcolor of the form in the properties window. Then figure out what it is set for. It is probably a system color. Then just set the back color of the treeview to the same exact setting (which by default is one of the system colors).

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Originally posted by pirate
    here you go

    VB Code:
    1. Private Sub Form1_Load(ByVal sender As System.Object_
    2. , ByVal e As System.EventArgs) Handles MyBase.Load
    3.         Dim color_of_Form1 As Color
    4.         color_of_Form1 = Me.BackColor
    5.         TreeView1.BackColor = color_of_Form1
    6.     End Sub

    have fun!!
    Whats wrong with: TreeView1.BackColor = Me.BackColor?

    Also the systemColors are enumerated in as SystemColors:
    TreeView1.BackColor =SystemColors.Control

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    nothing wrong with the code. . I was really wondering if there was any worng with that. Guess none.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Posts
    113
    Thanks to everyone for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width