This is a migrated thread and some comments may be shown as answers.

Glass effect with DwmExtendFrameIntoClientArea

7 Answers 461 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Julien
Top achievements
Rank 1
Julien asked on 06 Aug 2011, 05:51 AM
Hi,

I'm trying to get the Office 2010 look & feel so i'd like to apply glass effect on the RadRibbonWindow, wich works fine with a standard window (http://msdn.microsoft.com/en-us/library/ms748975.aspx).

Have you already set a handler that would prevent that feature to work ?

Regards.
<telerik:RadRibbonWindow xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="TestRibbon.MainWindow"
        Title="MainWindow" Height="350" Width="525"
        Loaded="Window_Loaded" Background="Transparent">
</telerik:RadRibbonWindow>

public partial class MainWindow : RadRibbonWindow
{
    public MainWindow()
    {
        InitializeComponent();
    }
 
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        try
        {
            IntPtr mainWindowPtr = new WindowInteropHelper(this).Handle;
            HwndSource mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr);
            mainWindowSrc.CompositionTarget.BackgroundColor = Color.FromArgb(0, 0, 0, 0);
 
            System.Drawing.Graphics desktop = System.Drawing.Graphics.FromHwnd(mainWindowPtr);
            float DesktopDpiX = desktop.DpiX;
            float DesktopDpiY = desktop.DpiY;
 
            MARGINS margins = new MARGINS();
            margins.cxLeftWidth = Convert.ToInt32(0 * (DesktopDpiX / 96));
            margins.cxRightWidth = Convert.ToInt32(this.Width * (DesktopDpiX / 96));
            margins.cyTopHeight = Convert.ToInt32(0 * (DesktopDpiX / 96));
            margins.cyBottomHeight = Convert.ToInt32(this.Height * (DesktopDpiX / 96));
 
            int hr = DwmExtendFrameIntoClientArea(mainWindowSrc.Handle, ref margins);
            if (hr < 0)
            {
                MessageBox.Show("Can't apply glass...");
            }
        }
        catch (DllNotFoundException)
        {
            Application.Current.MainWindow.Background = Brushes.White;
        }
    }
 
    [StructLayout(LayoutKind.Sequential)]
    public struct MARGINS
    {
        public int cxLeftWidth;
        public int cxRightWidth;
        public int cyTopHeight;
        public int cyBottomHeight;
    };
 
    [DllImport("DwmApi.dll")]
    public static extern int DwmExtendFrameIntoClientArea(
        IntPtr hwnd,
        ref MARGINS pMarInset);
}

7 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 10 Aug 2011, 03:35 PM
Hi Julien,

 This feature is tightly coupled with your Windows Settings. Please check here==>
Control Panel==>All Control Panel Items==>Personalization==>Window Color and Appearance whether
EnableTransparency is set to Checked. Please let us know if this helps you.

Greetings,
Petar Mladenov
the Telerik team

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

0
Julien
Top achievements
Rank 1
answered on 11 Aug 2011, 10:15 AM
Hi,

It's not really the problem: it's easy set the window transparancy with AllowsTransparency="True" but that implies to set WindowStyle="None" and loosing the title bar, std resize border and std buttons.

What I want is to have the QuickAccessToolbox in the title bar (and the resize features and standard sys buttons) like the first screen shot based on a RadRibbonWindow, but with the global window transparency like the second screen shot based on a standard window.

The problem is that at some point the RadRibbonWindow must override some display parameters...

Would you see any way to do it without having to recode the title bar move (and manage the onmousedown on all the ribbon to launch DragMove), the border risize and the std button on a standard window with transparency ?
0
Tina Stancheva
Telerik team
answered on 16 Aug 2011, 04:37 PM
Hi Julien,

I am not sure if I understood your scenario correctly. But we have a feature request to combine the Aero RadRibbonWindow with the RadRibbonView`s tabstrip like in the Office Application. If this is what you need then you can vote for its implementation here.

Best wishes,
Tina Stancheva
the Telerik team

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

0
Julien
Top achievements
Rank 1
answered on 16 Aug 2011, 05:02 PM
Not quite, I already have the two components merged as you could see in QuikToolbox-in-titlebar.png, it's just that the graphical effect using DwmExtendFrameIntoClientArea from DwmApi.dll won't apply. So the question is: did the developpers use any trick for rendering that would prevail on an effect working fine with a standard window ?

Thanks in advance
0
Tina Stancheva
Telerik team
answered on 18 Aug 2011, 01:04 PM
Hi Julien,

Unfortunately the RadRibbonView control doesn't support this functionality at the moment. However, based on your feedback we logged a feature request in our PITS and if the item gathers enough popularity, we will definitely consider implementing it.

I updated your Telerik account for your feedback.

All the best,
Tina Stancheva
the Telerik team

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

0
Steve
Top achievements
Rank 1
answered on 12 Oct 2011, 09:00 PM
It seems to me that mimicing the Office 2010 look would necessitate this.
0
Tina Stancheva
Telerik team
answered on 14 Oct 2011, 12:21 PM
Hi Steve,

Thank you for your feedback. I can see your point on the matter and we'll definately consider the implementation of this feature.  However, please keep in mind that due to the many pressing tasks in our to-do list, we have to constantly prioritize them and the customers demand for a feature is a big factor in this process. And this is why we cannot bind to any time frames at the moment.

Greetings,
Tina Stancheva
the Telerik team

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

Tags
RibbonView and RibbonWindow
Asked by
Julien
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Julien
Top achievements
Rank 1
Tina Stancheva
Telerik team
Steve
Top achievements
Rank 1
Share this question
or