7 Answers, 1 is accepted
The following discussion contains the solution for this: Windows form shadow - Forms, Dialogs, TitleBar, StatusStrip - UI for WinForms Forum.
I hope this will be useful.
Regards,
Dimitar
Progress Telerik
I override the CreateParams property:
protected override CreateParams CreateParams
{
get
{
const int CS_DROPSHADOW = 0x20000;
CreateParams cp = base.CreateParams;
cp.ClassStyle |= CS_DROPSHADOW;
return cp;
}
}
But The shadow is not visible, I don't know why ??
Do any other windows have shadows? This is controlled in the Windows settings as well - see attached image.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
I know this post is slightly dated, but this still seems to be an issue.
After converting my vb.net project to Telerik (all windows.Forms convert to RadForms) now none show a shadow when active. Visually this is a mess, as some of the forms blend into each other when opened as dialog. I still have a few windows.ui message boxes that open throughout the application, and these all show the shadow.
I am attempting to find a property in the Visual Style builder to set this, as I don't want to have to add special code to every form in my application to see this.
Please let me know if I can configure a component (i'm guessing RadForm) in Visual Style Builder, and what properties if so, to always show a shadow whenever a form is used from my custom package.
As an aside, the Visual Style Builder application and Windows Demo Application both appear to be built on Telerik controls, and neither have a shadow in windows 10 (yes, i'm configured to show shadows, and all other non-Telerik windows show one)
Hi Mark,
The shadow effect is not available on our forms. Our theming functionality requires this effect to be disabled (this allow us to customize the borders and the title bar). A possible solution is to disable the form theming, this way you will have a standard title bar and shadows:
public RadForm1()
{
InitializeComponent();
this.AllowTheming = false;
}
I hope this helps. Should you have any other questions, do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Thanks for the response. I would like to use my form theme, so turning it off is not a real option. I will resign to placing a code block in each child form of the application to set it off from the parent form. The code block below is what I am using, and was translated from an earlier post on this thread to VB.net. It seems to work, but only produces a shadow to the right and bottom of the form. How can I adjust this to get a shadow on all 4 borders?
Protected Overrides ReadOnly Property CreateParams As CreateParams
Get
Const CS_DROPSHADOW As Integer = &H20000
Dim cp As CreateParams = MyBase.CreateParams
cp.ClassStyle = cp.ClassStyle Or CS_DROPSHADOW
Return cp
End Get
End Property
Thanks again for your assistance.
Hi Mark,
The DropShadow style is the only predefined shadow style that can be used in this case. And the aero style cannot be enabled for a single form with code. You can see more information about this in the following threads:
- c# - Drop Shadow On A Borderless WinForm - Stack Overflow
- c# - Windows 7 style Dropshadow in borderless form - Stack Overflow
A good solution (complex, however) is available here as well: wenerme/winform.DropShadow: A winform DropShadow demo.
I hope this helps.
Regards,
Dimitar
Progress Telerik