• 0

[C#] Remove Titlebar/Close Button


Question

19 answers to this question

Recommended Posts

  • 0

Try this:

  Quote
private const int WS_DLGFRAME = 0x400000;

protected override System.Windows.Forms.CreateParams CreateParams {

get {

CreateParams cp = base.CreateParams;

cp.Style = cp.Style & !WS_DLGFRAME;

return cp;

}

}

I don't know if it'll work (it's translated to C# from VB)

  • 0

I think you need to turn off MaximizeBox, MinimizeBox, and ControlBox in addition to setting FormBorderStyle to none.

There's an example in the MSDN article for ControlBox: http://msdn.microsoft.com/en-us/library/system.windows.forms.form.controlbox.aspx

  • 0
  On 15/04/2011 at 22:24, Gabureiru said:

Form -> FormBorderStyle = None

Doesn't keep an aero border

  On 15/04/2011 at 22:25, Jan said:

Try this:

I don't know if it'll work (it's translated to C# from VB)

That doesn't keep the aero border :(

  • 0
  Quote
[DllImport("uxtheme.dll")]

public static extern int SetWindowThemeAttribute(IntPtr hWnd, WindowThemeAttributeType wtype, ref WTA_OPTIONS attributes, uint size);

public struct WTA_OPTIONS

{

public uint Flags;

public uint Mask;

}

public static uint WTNCA_NODRAWCAPTION = 0x00000001;

public static uint WTNCA_NODRAWICON = 0x00000002;

WTA_OPTIONS wta = new WTA_OPTIONS() { Flags = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON, Mask = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON };

SetWindowThemeAttribute(this.Handle, WTA_NONCLIENT, ref wta, (uint)Marshal.SizeOf(typeof(WTA_OPTIONS)));

Try this.

  • 0
  On 15/04/2011 at 22:31, GreyWolf said:

! is ~ in C#

Try turning off the "boxes" I suggested but leave FormBorderStyle alone.

I've already done that, and that code work's ish now i use the "~" operand. It removes the title bar, but keeps a pure white border, not aero :(.

  • 0
  On 15/04/2011 at 22:35, GreyWolf said:

No need for any weirdness...

form.ControlBox = false;

form.MaximizeBox = false;

form.MinimizeBox = false;

form.Text = "";

:)

EDIT: Here is the result using that:

post-175510-0-34108500-1302907156.png

I do that and get the picture below;

  On 15/04/2011 at 22:36, Jan said:

Can you post some screenshots showing the border please?

sure;

4e176ca5d6bf8097d44be9f23f686684.png

  • 0
  On 15/04/2011 at 23:00, Xerax said:

4e176ca5d6bf8097d44be9f23f686684.png

KK, turn your Form Borderstyle in your form properties to the default. (Sizable)

Set ControlBox property to False

Set Locked Property to True

Set Text to (empty)

  • 0
  On 15/04/2011 at 23:41, firey said:

KK, turn your Form Borderstyle in your form properties to the default. (Sizable)

Set ControlBox property to False

Set Locked Property to True

Set Text to (empty)

It looks the same as it does in that image. :/ It might be windows 8, but i can't see why it would be.

  • 0
  On 15/04/2011 at 23:48, Xerax said:

It looks the same as it does in that image. :/ It might be windows 8, but i can't see why it would be.

Hmm.. what visual studio ya running? I don't have 8 installed.. but It's possible Aero interacts with applications differently...

I did exactly what I told you, and was able to get the expected result (thin glass border et all)

  • 0
  On 15/04/2011 at 23:49, firey said:

Hmm.. what visual studio ya running? I don't have 8 installed.. but It's possible Aero interacts with applications differently...

I did exactly what I told you, and was able to get the expected result (thin glass border et all)

VS2010, Profession x86 (via Dreamspark).

Yeah, it could be, due to the introduction of the aerolite(metro) themes. Weird.

  • 0
  On 15/04/2011 at 23:54, Xerax said:

VS2010, Profession x86 (via Dreamspark).

Yeah, it could be, due to the introduction of the aerolite(metro) themes. Weird.

Hmm, I have 2010 installed too, so I know it's not that. I would have to wager it on the Aerolite... but as a test.. try a new project.. don't change ANY settings except the ones I listed, see if it works.

  • 0
  On 15/04/2011 at 23:56, firey said:

Hmm, I have 2010 installed too, so I know it's not that. I would have to wager it on the Aerolite... but as a test.. try a new project.. don't change ANY settings except the ones I listed, see if it works.

aha! It workes! I'll just port my code into this project. Thank you all so very much :)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Size 15. In the first week I managed to get a full week before having to recharge from 10%. I looked online and Samsung recommends recharging it when it gets to 20-30% to preserve the battery life. In the second week, started wearing my Galaxy Watch6 Classic again, because I read that it offsets sensors to the Watch, meaning the battery lasts even longer... and a week on (today) the ring was at 31% when I recharged it fully again, so a difference of over 20% in combination with the Watch. By the way I do not wear my Watch to bed, so it is only the Ring doing the sleep tracking (which is hit or miss tbh) it stops tracking for an hour or two in the night, which is really annoying. I had the same thing with the Watch, and I found it uncomfortable to have on in bed. I have been reading that the battery can start to go bad even after the first week so I am glad it isn't affecting me (yet).
    • Visual Studio gets even smarter with more AI models and billing updates by Usama Jawad Visual Studio and Visual Studio Code are among the most popular integrated development environments (IDEs) out there. The tools boast more than 50 million monthly active users, which isn't surprising considering their platform agnosticism, deep integration with the Microsoft ecosystem, and the power of GitHub Copilot. Now, Microsoft is looking to entice even more customers who are eager to use AI models to boost their productivity during the development process. In a blog post, Microsoft has stated that it has updated the AI models list available in Visual Studio to default to smarter options. For example, Copilot will now use GPT-4.1 rather than GPT-4o, since it offers better responses with faster performance. In addition, users can now select between the following models to enhance their coding experience based on their preferences: Claude Sonnet 4 Claude Opus 4 Claude Sonnet 3.5 Claude 3.7 (non-thinking and thinking) OpenAI o3 mini Gemini 2.0 Flash Gemini 2.5 Pro Microsoft has noted that your selected model will persist across your workflows, so if you're unsure about which model to leverage, you can refer to its documentation here. Furthermore, Visual Studio is making it easier to switch between models that are included in your plan through a prompt in the model selector. When it comes to billing updates, Microsoft has built a new Copilot Consumptions user experience that can be accessed by navigating to the Copilot badge present in the top-right corner of the IDE. As the name suggests, this panel shows your consumption in an easily digestible format. You can also click on Manage Plan, which will take you to the GitHub website. It is important to note that some models are request-heavy, and Visual Studio will now indicate this to you while you are selecting your model. If you exhaust your premium requests, you will shift to a standard model seamlessly. You should also keep in mind that the GitHub Copilot pricing plans have been updated, and the billing experience in Visual Studio does reflect them.
    • Indeed. It's apparently just a new search window that calls itself a "launcher"...yeehaw?! bleh.
    • Last I checked, their "support clock" runs for five years. So EOL at end of 2028 for this model? Roll your own looks better all the time. I do understand that's not for everyone. I think the least they could do is offer you six months of free cloud so you could migrate to new hardware when the time comes. Assuming you stick with them as your hardware vendor, of course.
    • Music Collection 3.9.1.1 by Razvan Serea Music Collection is a free tool to archive and manage your music library. Add CDs, LPs, tapes, or digital files manually or via the Internet. Retrieve album data by artist, title, barcode, catalog number, or CD scan. Auto-import metadata from audio files. Browse, sort, filter, export, import, and generate reports effortlessly. Music Collection features: The program creates the collection's database in a Microsoft Access format, so if you want later, you can use it, without the help of the program. The user can create as many as different collections wants. Accepts all kinds of musical media (cd, lp, dvd-a, audio files etc.). Specially customized to add and edit classical music albums. Retrieves data from the Internet, such as cd info, album cover, artist information, tracks, and the lyrics of each track etc. For every album the program saves all media contained, every medium tracks and the lyrics for every track. Displays albums using filters or the advanced search feature. Lists selected albums in a grid or using images (default setting). Presents all items contained in the album, in one page for an easy album overview. The details that are shown there are: album cover, album artists, notes, the tracks of each medium, the lyrics of each track and the duration of each one, as well as the total duration of the album. Exports album information to html file. Exports collection albums to html,txt,csv,excel files. Imports album information from text files exported by another program. Manages all program data, such as a list of singers, composers, etc. Manages artist information (biography, best albums). Prints all the data shown in each table.. Creates reports, which you can configure by your preference.. Manages album loans. Shows collection statistics. Searches for tracks and opens the album medium that contains them. Skinable. The user can select from 30 different skins. Multi-language support. Music Collection 3.9.1.1 changelog: Added: Show selected group item total duration. Added: Option to show only the checked albums. Added: Save the checked album property. Added: Play checked tracks. Fixed: Some minor bugs. Download: Music Collection 3.9.1.1 | 8.0 MB (Freeware) Download: Portable Music Collection 3.9.1.1 View: Music Collection Home page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Conversation Starter
      Kavin25 earned a badge
      Conversation Starter
    • One Month Later
      Leonard grant earned a badge
      One Month Later
    • Week One Done
      pcdoctorsnet earned a badge
      Week One Done
    • Rising Star
      Phillip0web went up a rank
      Rising Star
    • One Month Later
      Epaminombas earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      528
    2. 2
      ATLien_0
      207
    3. 3
      +FloatingFatMan
      168
    4. 4
      Michael Scrip
      150
    5. 5
      snowy owl
      124
  • Tell a friend

    Love Neowin? Tell a friend!