I tried to get the following but did not find the right set of properties to modify.
I have a Windows forms application with an UltraToolbarsManager which displays a Ribbon with all its RibbonTabs collapsed. When the user clicks on a tab caption and that tab is displayed, I would like to display that tab in a semi-transparent way letting the form show through the tab transparency.
First, is it possible to do that?Second, how can I do that?
Thanks
There is currently no property to do this. However, you could use a creation filter to accomplish this. Add the following class to your project and in the constructor of your Form, create a new instance of it and assign it to the CreationFilter property of your UltraToolbarsManager:
public class OpacityCreationFilter : IUIElementCreationFilter{ private UltraToolbarsManager manager;
public OpacityCreationFilter( UltraToolbarsManager manager ) { this.manager = manager; }
void IUIElementCreationFilter.AfterCreateChildElements( UIElement parent ) { }
bool IUIElementCreationFilter.BeforeCreateChildElements( UIElement parent ) { if ( parent is RibbonTabPageUIElement && this.manager.Ribbon.IsMinimized ) { Form form = parent.Control.FindForm();
const float opacity = 0.6f;
if ( form != null && form.Opacity != opacity ) form.Opacity = opacity; }
return false; }}
Thanks, that worked perfectly
If you want the Form to have different levels of transparency, you will have to use unmanaged code (if you are not familiar with using unmanaged code, I would not recommend trying to accomplish this). You will first have to make the drop down form a layered window. You can do this with the SetWindowLong api, passing in GWL_EXSTYLE for the nIndex and or-ing in WS_EX_LAYERED to the window's existing ex-style for the new dwNewLong. Then you will have to create a bitmap with various transparencies on it and use that in the UpdateLayeredWindow api to make the form have different transparencies on it.
I answered too fast. This is not exactly what I need. Now everything is transparent, including the Tools and their caption within RibbonGroups because we change the opacity of the parent form. I tried setting BackColorAlpha and ForegroundAlpha of almost everything trying to change the display but couldn't.
Do you have any other tricks up your sleeve?
Marcel Gosselin