WinForms - Tips & Tricks (August 2019)

WinForms Team Blog
03 September 2019

This edition of our WinForms Tips & Tricks series is somewhat unique. It includes a list of interesting Support Center tickets (just like previous editions) and a closer look at minor enhancements/features we expect to ship in our v19.2 release cycle.

SvgImageCollection - Import Images From Shared Assemblies

Based on Support Center traffic, many of you want to populate the SvgImageCollection with images stored in referenced assemblies. Prior to this release, we could only say “no,” and suggest that you load images in code (with the static FromResources method) as a workaround.

With v19.2, you can now address this requirement at design time.

Export Image Picker Images to Project Resources

Another image-related v19.2 enhancement involves the Vector Image Picker we introduced in v18.2. This is a panel that you can dock anywhere in Visual Studio – one that makes adding images to controls much easier (you can double-click icons to add them to selected controls or drag icons directly onto control surfaces). This WinForms utility even reads selected control captions and automatically displays matching icons under the “Suggestions” category.

Selection-Based Suggestions

Apart from adding the “PNG” tab to this panel (you can now add both vector and raster images), we’ve added a button that adds the selected image to the project resource file.

LayoutControl - Content Alignment Settings

In versions 19.1 and earlier, the was a certain ambiguity about the LayoutControlItem's ContentAlignment property. If you wanted to align a control embedded into a stretched Layout Item that is not limited by neighboring items, the ContentAlignment property was not enough. To achieve a layout similar to that in the following image, you also had to adjust the TrimClientAreaToControl and\or FillControlToClientArea settings.

Starting with v19.2, all three abovementioned properties will be hidden. In return, you’ll get the ContentVertAlignment and ContentHorzAlignment properties that work with any Layout Item regardless of the current setup.

Disabled Cell Behavior

In our very first Tips&Tricks post we mentioned our Behavior Manager component. In this release we’re adding a new behavior to the pool - Disabled Cell Behavior. This behavior automatically disables GridControl, VGridControl, and TreeList cells that do not match your custom expression. At your discretion, you can modify appearance settings for these disabled cells.

To learn more about this behavior, refer to the Disabled Cell Behavior help topic or launch the Data Grid API Code Samples demo.

Image Options for DevExpress Forms

Standard Visual Studio forms display .ico files within headers. Our own equivelants (XtraForm, RibbonForm, ToolbarForm, etc.) inherited this same logic. In v19.2 we’ve added an IconOptions settings group to all of our forms. Properties within this group allow you to specify regular and vector images as form icons. You can use custom images or those from our Image Galleries.

Thanks to this enhancement, we're thinking to replace the default Form icon with a vector counterpart for DevExpress forms. How would you rate this possible change? Do you ever use default form icons, or do you hide them (via the ShowIcon property) when there’s no custom replacement icon?

Interesting Customer Support Tickets

Here's our August selection interesting support tickets. Hopefully, you'll find them of value and can incorporate the suggestions in your next WinForms project. And of course, a huge shout-out to everyone who shared their real-life usage scenarios and unorthodox cases with us.

Free DevExpress Products – Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We’ll be happy to follow-up.
Christopher Jay
Christopher Jay

Some great little items in here.  Thanks for the continued improvements!


Will the super useful Image Picker be able to use custom icon folders yet?

3 September 2019
Michael Proctor [DX-Squad]
Michael Proctor [DX-Squad]

IconOptions is great, I already have a "BaseForm" class which inherits from XtraForm and introduces a IconSvg property which when set creates a multi sized Icon and places that Icon to the Form Icon property.

Can I confirm that when assigning a Svg the Icon that is "generated" for the form display is a multi image size? What sizes are included the resulting Icon?

3 September 2019
Appy Developers
Appy Developers

"Image Options for DevExpress Forms" Just excellent.

Thanks.


4 September 2019
Stas (DevExpress Support)
Stas (DevExpress Support)

@Christopher 

We agree that this feature would be very useful and will consider implementing it.


@Michael 

There aren't predefined sizes. The required form icons (title bar and task bar icons) are generated on the fly from an SVG image taking into account the current system DPI setting. 

4 September 2019
Benjamin Hofmann
Benjamin Hofmann

The missing feature from the SvgImageCollection is coming. Great!

Also the ImageOptions for Forms are a great addition.

And I just hit recently into the LayoutControl alignment ambiguity. Nice that this is done now in a better way. 

5 September 2019

Please login or register to post comments.