Background image Layout

5 posts, 1 answers
  1. Juan Pablo
    Juan Pablo avatar
    19 posts
    Member since:
    Oct 2008

    Posted 24 Nov 2008 Link to this post

    Hello experts!
    Look, I have a radtreeview with a background image, but I need that that image always displays at the bottom left side of the control. How I can accomplish this?

    I tried with all the layouts available, and mixed them with different image sizes, but I'm not getting the desired results.

    Thank you for your help!
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 28 Nov 2008 Link to this post

    Hello Juan Pablo,

    Thank you for the question.

    There are two approaches that I would suggest:
    • Making an image appropriate for your needs. The background color of this image will be the back color of RadTreeView, its size will be equal to the size of RadTreeView and the desired 'bottom-left' image should be placed in the bottom left part of the this RadTreeView-sized image.
    • Add an ImagePrimitive to RadTreeView and assign it your 'bottom-left' image. Please note that, if you want to follow this approach, you should turn off the RadTreeNodes' animations. To do so, make your custom theme, where the Animate checkboxes of the TreeNodeUI's state tabs are unchecked. In addition, in your project, you should call RadTreeView.Invalidate() whenever you move the form and RadTreeView.InvalidateNode when the mouse pointer is leaving a node.

    I have demonstrated both approaches in the sample project attached. I hope this helps. If you have additional questions, feel free to contact me.

    Sincerely yours,

    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Juan Pablo
    Juan Pablo avatar
    19 posts
    Member since:
    Oct 2008

    Posted 28 Nov 2008 Link to this post

    Thanks for your reply and for your example.
    Now I notice that I didn't explain me well.

    Look, the tree view is docked to a tablelayoutpanel that resizes when the parent resizes. And the image should always appear at the bottom left corner.

    Thanks for your help
  5. Answer
    Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 01 Dec 2008 Link to this post

    Hi Juan Pablo,

    In the case of a runtime resized RadTreeView, you should use the ImagePrimitive approach. Just set the correct Location whenever the Size of RadTreeView is changed:
    void radTreeView1_SizeChanged(object sender, EventArgs e)  
    {  
        img.Location = new Point(0, this.radTreeView1.Height - RadTreeViewImage.Properties.Resources._1_New.Height);  

    I am attaching a modified version of my project to demonstrated the approach. If you need additional assistance, feel free to contact me.

    Regards,
    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 18 Mar 2011 Link to this post

    Hi Juan Pablo,

    Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out.
    For more information about this release, please refer to this blog post.
     
    All the best,
    Stefan
    the Telerik team
Back to Top
UI for WinForms is Visual Studio 2017 Ready