Transparent border of windows form

rahul kumar 605 Reputation points
2023-06-21T08:52:51.8866667+00:00

Hi , I need to make the border area of a windows form transparent . I have tried several approaches but failed to get the working one as mostly they are for the whole form not for the border area . pls suggest me the approach as I am not good in GDI .
This is what I am looking for . You can see the blurry effect on the border of the Windows form below (when hover on text files ) .
transparent border

Developer technologies | Windows Forms
Developer technologies | C#
Developer technologies | 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.
{count} votes

1 answer

Sort by: Most helpful
  1. Minxin Yu 13,506 Reputation points Microsoft External Staff
    2023-06-22T07:31:18.2366667+00:00

    Hi,

    I'm afraid it is hard to do with Winform itself. Need to draw semi-transparent border by yourself.

    The Winform style you provided in picture is Aero style.
    It was used in Win7 by default and has been deprecated.
    Since you're drawing the non-client area, this requires the DWM api.

    Currently DwmSetWindowAttribute DWMWA_BORDER_COLOR does not support ARGB.

    DwmEnableBlurBehindWindow

    Beginning with Windows 8, calling this function doesn't result in the blur effect, due to a style change in the way windows are rendered.

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.