Exporting images from default themes

6 posts, 0 answers
  1. Miguel
    Miguel avatar
    5 posts
    Member since:
    Nov 2012

    Posted 20 Nov 2012 Link to this post

    Hi,

    I'm working on a project where the designers want a purple shade to selected items. The Office2010Silver theme is quite close to what they want, but I would have to change some elements to purple.

    At first, I thought the "AddColorBlend" was the way to go, but it seems that color blending is no longer supported.

    I can always edit the repository items one by one and change to purple equivalents where necessary, but I've run into some trouble with the images, as I found no way to export the images in an existing theme.

    Is there a way to export a image from a theme, or copy it to the clipboard, so that the hue is changes in an external app?

    Thanks,
    Miguel
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 22 Nov 2012 Link to this post

    Hello Miguel,

    Presently, the color blending feature is not available and the easiest way to modify your theme is by using the Visual Style Builder. We plan to add the color blending feature in future, however it is not yet scheduled and I cannot give you a time frame when it will be implemented.

    If you still want to do this with code, you can extract images from your theme by using the following code:
    Theme theme = ThemeRepository.FindTheme("ControlDefault");
    foreach (StyleRepository repository in theme.Repositories)
    {
        if (repository.ItemType == "Image")
        {
            foreach (PropertySetting setting in repository.Settings)
            {
                if (setting.Name == "Image")
                {
                    Bitmap bmp = setting.Value as Bitmap;
                    // do something with the bitmap    
                }
            }
        }
    }

    I hope this helps.
     
    Greetings,
    Jack
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Miguel
    Miguel avatar
    5 posts
    Member since:
    Nov 2012

    Posted 22 Nov 2012 Link to this post

    Hi Jack,

    Thanks for your reply, that does help. Of course, it would be better if the designer could export the image directly in VSB, maybe it would make an interesting feature?

    It would be helpful if the designer could easily relate the exported images to the repository items and properties that use them. Could you point me in the right direction as to how I would obtain this information? Ideally, I would save the bitmap with a name like repositoryitem.property.bmp

    Thanks,
    Miguel
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 26 Nov 2012 Link to this post

    Hello Miguel,

    Yes, this is an interesting feature and I added it in our issue tracking system. We will consider implementing it in a future version. Use the following link to track its status. I updated also your Telerik points.

    I am not sure about your second question. This code executes at run time and you cannot use it at design time. You can use the repository Key property to obtain the repository name.
     
    Greetings,
    Jack
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  6. Miguel
    Miguel avatar
    5 posts
    Member since:
    Nov 2012

    Posted 26 Nov 2012 Link to this post

    Hello Jack.

    Sorry, english is not my first language.

    What I meant to ask was if there was a way to get the repository item name that contains the image, so that I can save the image with that name (given that I will be exporting all the images from a theme, this will make identifying the image easier for the graphic designer).

    I've since found out how to get the repository item name so everything's fine now.

    Thanks again for your help,
    Miguel
  7. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 29 Nov 2012 Link to this post

    Hello Miguel,

    The StyleRepository.Key property represents the repository name. There is also Name property, however it is used only in Visual Style Builder to represent a more friendly name for the repository. That is why I recommend using the Key property in your application.

    All the best,
    Jack
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top
UI for WinForms is Visual Studio 2017 Ready