Can't Fully Hide Top Bar in Windows Form C#

can synonym
can definition
can y
can verb
can.'' acronym
can noun meaning

I am working in C#. I know that this question is commonly asked, it's just that I still cannot fully hide the top bar. This is the result that I get when I set the the form text string to be "" and controlbox = false.

Still want the shadow effect :

So as you can see the border on the side is gone (great!) and there is the usual shadow (great!) but the top border has this odd white line that I cannot seem to remove.

I do not want to set the form border property to 'none' as I enjoy the integrated sizable controls and form shadow, so that is not an option. Any other suggestions for this?

Thanks in advance!

(I should specify that the buttons on the upper right hand side are generated by me and show the edge of my editable form. The white space above that is what I am trying to remove.)

I know this post is old but I stumbled on to this problem and finally solved it so I'm posting it here for anyone that it can help.

So, I made a custom resizable borderless Form class with my own control bar and buttons, similar to the OP. The idea was to have that Form, with all the related WndProc code, act as the base class for all the other dialog forms in the project.

As I was running my project I was getting the exact same white line at the top of my form even though I had set all the appropriate form properties correctly.

The problem ended up being that with Form inheritance, all derived Forms also have their own private InitializeComponent method. I had no idea that the VS IDE set the FormBorderStyle property to Sizable in the derived Form class because my attention was only on the custom base class.

If you are using a custom base class for your Form, setting FormBorderStyle correctly in the derived class fixes the problem.

Verb Can, can meaning: 1. to be able to: 2. used to say that you can and will do something: 3. to be allowed to: . Learn more. Can definition, to be able to; have the ability, power, or skill to: She can solve the problem easily, I'm sure. See more.

If you click the Form, go to properties and there is the section FormBorderSyle and put it in False

May I? Can I? - English Grammar - English, Can may refer to: Contents. 1 Containers; 2 Music; 3 Other; 4 See also. Containers[edit]. Aluminum can · Drink can · Oil can · Steel and tin cans · Trash can  Define can. can synonyms, can pronunciation, can translation, English dictionary definition of can. to be able to, have the power or skill to: I can take a bus to the

If you just don't set FormBorderStyle to None for a shadow, I already answered how to easily make shadows here: Drop shadow on Borderless Winform-No flicker or disappearance

Here's my answer:

Pls try the below steps and revert back for any errors:

Add the below code to a new code file named DropShadow.cs;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Core
    public class DropShadow
        #region Shadowing

        #region Fields

        private bool _isAeroEnabled = false;
        private bool _isDraggingEnabled = false;
        private const int WM_NCHITTEST = 0x84;
        private const int WS_MINIMIZEBOX = 0x20000;
        private const int HTCLIENT = 0x1;
        private const int HTCAPTION = 0x2;
        private const int CS_DBLCLKS = 0x8;
        private const int CS_DROPSHADOW = 0x00020000;
        private const int WM_NCPAINT = 0x0085;
        private const int WM_ACTIVATEAPP = 0x001C;


        #region Structures

        public struct MARGINS
            public int leftWidth;
            public int rightWidth;
            public int topHeight;
            public int bottomHeight;


        #region Methods

        #region Public

        public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);

        public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);

        public static extern int DwmIsCompositionEnabled(ref int pfEnabled);

        public static bool IsCompositionEnabled()
            if (Environment.OSVersion.Version.Major < 6) return false;

            bool enabled;
            DwmIsCompositionEnabled(out enabled);

            return enabled;


        #region Private

        private static extern int DwmIsCompositionEnabled(out bool enabled);

        [DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
        private static extern IntPtr CreateRoundRectRgn
            int nLeftRect,
            int nTopRect,
            int nRightRect,
            int nBottomRect,
            int nWidthEllipse,
            int nHeightEllipse

        private bool CheckIfAeroIsEnabled()
            if (Environment.OSVersion.Version.Major >= 6)
                int enabled = 0;
                DwmIsCompositionEnabled(ref enabled);

                return (enabled == 1) ? true : false;
            return false;


        #region Overrides

        public void ApplyShadows(Form form)
            var v = 2;

            DwmSetWindowAttribute(form.Handle, 2, ref v, 4);

            MARGINS margins = new MARGINS()
                bottomHeight = 1,
                leftWidth = 0,
                rightWidth = 0,
                topHeight = 0

            DwmExtendFrameIntoClientArea(form.Handle, ref margins);




In your form, add this line below InitializeComponent();

(new Core.DropShadow()).ApplyShadows(this);

CAN (noun) definition and synonyms, VerbEdit. can (third-person singular simple present can, present participle -, simple past could, past participle (obsolete except in adjectival use) couth). 110 synonyms of can from the Merriam-Webster Thesaurus, plus 97 related words, definitions, and antonyms. Find another word for can. Can: to bring (as an action or operation) to an immediate end.

Use can in a sentence, Can was the leading avant-garde rock group of the 70s. Can experimented with noise, synthesizers, non-traditional music, cut-and-paste techniques, and, most  Can means someone or something knows how to, is able to, is likely to or has the right to do something. An example of can is someone knowing how to play the piano. An example of can is a cat being able to paint. An example of can is a car that usually starts.

Can, 1.4Used to indicate that something is typically the case. 'antique clocks can seem out of place in modern homes'. More example sentences. A Controller Area Network (CAN bus) is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other's applications without a host computer. It is a message-based protocol , designed originally for multiplex electrical wiring within automobiles to save on copper, but can also be used in many other

CAN, can. (kæn). n. 1. a container, esp for liquids, usually of thin sheet metal: a petrol can;  Can(stylised as CAN) was a German experimental rockband formed in Colognein 1968 by the core quartet of Holger Czukay(bass, tape editing), Irmin Schmidt(keyboards), Michael Karoli(guitar), and Jaki Liebezeit(drums).

  • Did you try this: How to create a form with a border, but no title bar? (like volume control on Windows 7)
  • @RezaAghaei Yes I did, I actually read that before posting this. form.FormBorderStyle = FormBorderStyle.SizableToolWindow; I what I have set as my border, yet it still looks the same.
  • Hi. Got any luck on this one? I'm facing the same issue, tried many solutions with no luck...
  • Can you help me with a sample? I can't get your idea.