C++/CLI Adding shadow to panel

Wami007 296 Reputation points
2021-04-03T21:52:58.82+00:00

** Hello Everyone....!
i am trying to add simple shadow to Panel in my User Form but can't find resource on right way. Can anyone help for it or convert attached c# code for apply able to Panel **

private const int CS_DropShadow = 0x00020000;

protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ClassStyle != CS_DropShadow;
return cp;
}
}

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,279 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,538 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,125 questions
0 comments No comments
{count} vote

Accepted answer
  1. Viorel 112.5K Reputation points
    2021-04-04T06:09:37.493+00:00

    According to documentation, the CS_DROPDOWN style is available for top-level windows only, not for controls.

    You can simulate simple shadow using an additional empty panel. For example, if your panel is called panel1, you can insert another one programmatically:

    auto shadow = gcnew Panel;
    shadow->Size = panel1->Size;
    shadow->Left = panel1->Left + 4;
    shadow->Top = panel1->Top + 4;
    shadow->BackColor = Color::FromArgb( 0xAAD3D3D3 );
    shadow->BorderStyle = BorderStyle::None;
    panel1->Parent->Controls->Add( shadow );
    shadow->SendToBack( );
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. henrihan-8261 6 Reputation points
    2021-04-04T12:15:26.963+00:00
    0 comments No comments