locked
i want to change backcolor and border color of panel scrollbar control RRS feed

  • Question

  • i have one question for winform panel but not wpf.

    if panel1.AutoScroll is true then panel control have scrollbar.

    but basic panel control not supported to change color for this scrollbar

    i want to change backcolor and border color of scrollbar

    is it possible?


    Heetaek,KIM


    • Edited by icookie Saturday, July 28, 2012 6:03 PM
    • Moved by Sheldon _Xiao Monday, July 30, 2012 7:03 AM (From:Windows Presentation Foundation (WPF))
    Saturday, July 28, 2012 6:03 PM

Answers

  • Unfortunately no in case of native winform controls and maybe Yes in case of any thirdparty controls.

    The reason is that the scroll bars used by the control are not actual scroll bar controls. They don't have their own window handles, and their drawing is managed completely internally by the control. And, of course, the control in WinForms is just a thin wrapper around that same control provided by the Win32 API. Neither of them expose any facility for changing the scroll bar's color.

    Meantime, there is article by James Brown's Custom Scrollbar Library (link), but it's written in C and you have to port it  to C#.

    If this post answers your question, please click Mark As Answer. If this post is helpful please click Mark as Helpful.

    Regards,
    Nair S

    • Proposed as answer by Bob Wu-MT Thursday, August 2, 2012 8:42 AM
    • Marked as answer by Bob Wu-MT Thursday, August 9, 2012 7:15 AM
    Saturday, July 28, 2012 11:44 PM
  • Hi HeeTaek,

    How is it going with Nair's suggestion?

    In fact, I think you can use a Scrollbar out side of the Panel and hide the build-in one. For more details, see http://www.codeproject.com/Articles/14801/How-to-skin-scrollbars-for-Panels-in-C

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Bob Wu-MT Thursday, August 9, 2012 7:15 AM
    Wednesday, August 1, 2012 7:35 AM

All replies

  • Unfortunately no in case of native winform controls and maybe Yes in case of any thirdparty controls.

    The reason is that the scroll bars used by the control are not actual scroll bar controls. They don't have their own window handles, and their drawing is managed completely internally by the control. And, of course, the control in WinForms is just a thin wrapper around that same control provided by the Win32 API. Neither of them expose any facility for changing the scroll bar's color.

    Meantime, there is article by James Brown's Custom Scrollbar Library (link), but it's written in C and you have to port it  to C#.

    If this post answers your question, please click Mark As Answer. If this post is helpful please click Mark as Helpful.

    Regards,
    Nair S

    • Proposed as answer by Bob Wu-MT Thursday, August 2, 2012 8:42 AM
    • Marked as answer by Bob Wu-MT Thursday, August 9, 2012 7:15 AM
    Saturday, July 28, 2012 11:44 PM
  • Hi HeeTaek,

    How is it going with Nair's suggestion?

    In fact, I think you can use a Scrollbar out side of the Panel and hide the build-in one. For more details, see http://www.codeproject.com/Articles/14801/How-to-skin-scrollbars-for-Panels-in-C

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Bob Wu-MT Thursday, August 9, 2012 7:15 AM
    Wednesday, August 1, 2012 7:35 AM