Set BackGroundImage to RadDock

17 posts, 0 answers
  1. bhogavalli
    bhogavalli avatar
    28 posts
    Member since:
    Sep 2010

    Posted 11 Nov 2010 Link to this post

    How  to set background image to raddock.

    Thanks
    Suresh
  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 11 Nov 2010 Link to this post

    Hello Suresh,

    Sorry there is no clean and nice way of doing this,

    But you can use this code to add an image primitive to the dock's children collection:
    var splitPanelElement = radDock1.RootElement.Children[0] as SplitPanelElement;
    var imagePrimitive = new ImagePrimitive();
    imagePrimitive.Image = new Bitmap(@"c:\Work\axIcon.png");
    splitPanelElement.Children.Add(imagePrimitive);

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
    Telerik WinForms MVP
  3. UI for WinForms is Visual Studio 2017 Ready
  4. bhogavalli
    bhogavalli avatar
    28 posts
    Member since:
    Sep 2010

    Posted 11 Nov 2010 Link to this post

    hi team,

    I used the code in this way.

         SplitPanelElement i_radelemet = radDock1.RootElement.Children[0] as SplitPanelElement;
                ImagePrimitive i_imagepr=new ImagePrimitive();
                i_imagepr.Image = new Bitmap("C:\\temp\\ActiveAlarmList.png");
                i_radelemet.Children.Add(i_imagepr);


    i am attaching file ,where i need a image ,but the above code does not work.Add does not display a image on raddock.

    the Red color block where i need place an image.in the attached file

    thanks
    suresh
  5. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 11 Nov 2010 Link to this post

    Hello again,

    There is no attached image to your last post.

    Best Regards,
    Emanuel Varga
    Telerik WinForms MVP
  6. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 11 Nov 2010 Link to this post

    Hello again,

    Sorry, I've just tested it again, and it is working, are you sure that is the location of your image?
    You could try it with a verbatim string, but it shouldn't make a difference.
    i_imagepr.Image = new Bitmap(@"C:\temp\ActiveAlarmList.png");

    Please check the Image property of the i_imagepr after you set the image for null.

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
    Telerik WinForms MVP
  7. bhogavalli
    bhogavalli avatar
    28 posts
    Member since:
    Sep 2010

    Posted 11 Nov 2010 Link to this post

    Hi team,

    Attached file contain the information in debug mode.the bmp  file is present in the location.

    But the image is not placed on raddock.please help.

    Thanks
    suresh
  8. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 11 Nov 2010 Link to this post

    Hello again,

    Which version of the telerik controls are you using?
    With the Q2 version everything is working like this.

    Best Regards,
    Emanuel Varga
    Telerik WinForms MVP
  9. bhogavalli
    bhogavalli avatar
    28 posts
    Member since:
    Sep 2010

    Posted 11 Nov 2010 Link to this post

    hi team,

    Exe version:RadControls_WinForms_2010_1_10_504_dev.exe

    Winforms Q1 2010 sp2.

    Thanks
    Suresh.
  10. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 11 Nov 2010 Link to this post

    Could you please try updating to the latest version Q3 2010?

    This should solve your problem.

    Best Regards,
    Emanuel Varga
    Telerik WinForms MVP
  11. bhogavalli
    bhogavalli avatar
    28 posts
    Member since:
    Sep 2010

    Posted 11 Nov 2010 Link to this post

    hi team,

    I have only a licensed version of RadControls_WinForms_2010_1_10_504_dev.exe.

    If i  need to have  Q3 i have  to buy one more licensed copy .

    Please let me know the details.Thanks a lot for the help.

    Thanks
    suresh.
  12. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 11 Nov 2010 Link to this post

    Hello again,

    Not even to Q2?

    Best Regards,
    Emanuel Varga
    Telerik WinForms MVP
  13. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 17 Nov 2010 Link to this post

    Hello bhogavalli,

    Thank you for writing.

    The desired behavior cannot be achieved with your version of our WinForms suite. You need to update to our latest release in order to be able set a background image. Feel free to download our Trial version from your account and give it a try.
     
    Greetings,
    Stefan
    the Telerik team
    See What's New in RadControls for WinForms in Q3 2010 on Wednesday, November 17, 11am Eastern Time: Register here>>
  14. nc
    nc avatar
    3 posts
    Member since:
    Jul 2011

    Posted 09 Aug 2011 Link to this post

    Hi
    I would be thankful if you send the code in VB.NET for setting the Dock Control background .

    Best Regards
  15. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 11 Aug 2011 Link to this post

    Hello,

    Thank you for writing.

    Here is the requested code:
    Dim lightVisualElement = New LightVisualElement
    lightVisualElement.BackgroundImageLayout = ImageLayout.Stretch
    lightVisualElement.BackgroundImage = New Bitmap("C:\Program Files (x86)\Telerik\RadControls for WinForms Q2 2011\Examples\QuickStart\Resources\06.png")
    splitPanelElement.Children.Add(lightVisualElement)

    I hope it helps.
     
    Best wishes,
    Stefan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  16. Mattias Hermansson
    Mattias Hermansson avatar
    24 posts
    Member since:
    May 2010

    Posted 22 Sep 2012 Link to this post

    Hello,
    is this still the right approach for applying a background image to a RadDock(want background when no DocumentWindow is shown):

    var splitPanelElement = radDock1.RootElement.Children[0] as SplitPanelElement; 
    var imagePrimitive = new ImagePrimitive(); 
    imagePrimitive.Image = new Bitmap(@"c:\Work\axIcon.png"); 
    splitPanelElement.Children.Add(imagePrimitive);

    Because I could not get it to work.
    I'm using WinForms Q2 2012 SP2(012.2.912.40)
  17. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 25 Sep 2012 Link to this post

    Hello Anders,

    The approach is the same, just the primitive should be added to the MainDocumentContainer:
    void radButton1_Click(object sender, EventArgs e)
    {
        var imagePrimitive = new ImagePrimitive();
        imagePrimitive.StretchHorizontally = true;
        imagePrimitive.StretchVertically = true;
        imagePrimitive.Image = new Bitmap(@"C:\img.png");
        radDock1.MainDocumentContainer.SplitPanelElement.Children.Add(imagePrimitive);
    }

    I hope this helps.
     
    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  18. Mattias Hermansson
    Mattias Hermansson avatar
    24 posts
    Member since:
    May 2010

    Posted 26 Sep 2012 Link to this post

    @Stefan

    Thanks, worked perfectly!
Back to Top
UI for WinForms is Visual Studio 2017 Ready