Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8436029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:04:48+00:00 2026-06-10T07:04:48+00:00

I’m working on a Windows Forms app and I’m wanting to remove the close

  • 0

I’m working on a Windows Forms app and I’m wanting to remove the close button from the top. I’m aware of the ControlBox option, but I’m wanting to provide a help button. Is there a way to have the Close button not visible while maintaining the help button?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:04:49+00:00Added an answer on June 10, 2026 at 7:04 am

    Your best bet may be to subcribe to the FormClosing event of the form like so and cancel the closing action:

    // In your code somewhere subscribe to this event
    Form1.FormClosing += Form1_FormClosing;
    
    void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        e.Cancel = true;
    }
    

    The benefit of doing this is that it prevents the user from closing the application from the close button and the taskbar.

    Obviously you don’t want to ALWAYS cancel the form from closing. So you will want to set some type of boolean flag that you will check in the event listener as to whether you want the form to be allowed to close or not. Example:

    void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        if (BlockClosing)
            e.Cancel = true;
    }
    

    EDIT: If you don’t want to approach the problem that way, and you really do intend to completely remove the close button, then your best bet is to create your own custom title bar. In that case, you set the form’s FormBorderStyle property to None. And you then dock your custom title bar to the top of the form. Here is some sample code from one I made a while back:

    using System;
    using System.ComponentModel;
    using System.Windows.Forms;
    
    namespace Spectrum.UI
    {
        public partial class TitleBar : UserControl
        {
            public delegate void EventHandler(object sender, EventArgs e);
            public event EventHandler MinButtonClick;
            public event EventHandler MaxButtonClick;
            public event EventHandler CloseButtonClick;
    
            #region Properties
            [Category("Appearance")]
            public string Title
            {
                get { return TitleLabel.Text; }
                set { TitleLabel.Text = value; }
            }
    
            [Category("Appearance")]
            public bool MinimizeEnabled
            {
                get
                {
                    return minButton.Visible;
                }
                set
                {
                    minButton.Visible = value;
                }
            }
    
            [Category("Appearance")]
            public bool MaximizeEnabled
            {
                get
                {
                    return maxButton.Visible;
                }
                set
                {
                    maxButton.Visible = value;
                }
            }
            #endregion
    
            public TitleBar()
            {
                InitializeComponent();
                ShowTitleBarImage = false;
            }
    
            #region Mouse Events
            private void TitleBar_MouseDown(object sender, MouseEventArgs e)
            {
                this.OnMouseDown(e);
            }
    
            private void TitleBar_MouseUp(object sender, MouseEventArgs e)
            {
                this.OnMouseUp(e);
            }
    
            private void TitleBar_MouseMove(object sender, MouseEventArgs e)
            {
                this.OnMouseMove(e);
            }
            #endregion
    
            #region Button Click Events
            private void minButton_Click(object sender, EventArgs e)
            {
                if (MinButtonClick != null)
                    this.MinButtonClick.Invoke(this, e);
            }
    
            private void maxButton_Click(object sender, EventArgs e)
            {
                if (MaxButtonClick != null) 
                    this.MaxButtonClick.Invoke(this, e);
            }
    
            private void closeButton_Click(object sender, EventArgs e)
            {
                if (CloseButtonClick != null) 
                    this.CloseButtonClick.Invoke(this, e);
            }
            #endregion
        }
    }
    

    This is how my custom titlebar looked when I was done

    As you can see from the image, I also added a background image to the control. Depending on your patience and your requirements, you can use images and PictureBox controls to make this look as much like a standard title bar as you need.

    In the above example I placed three buttons on the control with images I found online to represent minimize, maximize, and close. in your case you would simply exclude a close button. I also placed a string on the control with an appropriate font to serve as the title of the window.

    Adding the custom title bar to your form is easy.

    public TitleBar titleBar = new TitleBar();
    titleBar.Dock = DockStyle.Top;
    titleBar.MaximizeEnabled = true;
    titleBar.MinimizeEnabled = true;
    titleBar.Size = new System.Drawing.Size(10, 40); // Width doesn't matter - I wanted it 40 pixels tall
    titleBar.Title = "Title Example";
    titleBar.MinButtonClick += titleBar_MinButtonClick;
    titleBar.Max ButtonClick += titleBar_MaxButtonClick;
    this.Controls.Add(this.TitleBar);
    

    And then last step is to set up your event listeners for the min and max button clicks:

    private void titleBar_MinButtonClick(object sender, EventArgs e)
    {
        WindowState = FormWindowState.Minimized;
    }
    
    private void titleBar_MaxButtonClick(object sender, EventArgs e)
    {
        WindowState = FormWindowState.Maximized;
    }
    

    You may also note that I included events for mouse down, up and move in my title bar. This was so that I could create listeners in my form to move the form when the user clicked and dragged the title bar. This is optional and depends on if you need the user to be able to move your application window.

    The added benefit of doing this is that can use the title bar for additional controls. For example, my application was custom written for use on a toughbook style tablet computer with a small touchscreen display. In my application, utilization of the limited space was extremely important. I was able to further modify what I’ve described here to also include menu bar style control directly on the title bar. In addition, I added more buttons to the left of the stand minimize, maximize, and close buttons. Really helped me utilize every square inch of the screen in my application. Couldn’t have done it with the standard title bar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.