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.
No Comments

Please login or register to post comments.