Hiiiii
I m making an window application, in which i have written some text in the text property of the form, but i want that when application is running, in that case form text should not be displayed.....
And i don't want to use the form property: FormBorderStyle-->None, Because in that case the form will become unmovable.
Can anyone Tell me some other solution related to this................

Dani AI

Generated

Both and are right — removing the form caption is the simplest route. A couple of practical notes and an alternate approach are useful so the UI stays usable and accessible.

If you only want to hide the title text, clear the form's caption (set the Text property to an empty string) either in the designer or after InitializeComponent. Also consider toggling ShowIcon if you want the icon gone too. If your app uses resource/localized strings, make sure nothing resets the Text later in code or resource-generated InitializeComponent.

If you do decide to go borderless (FormBorderStyle = None) to get full control over chrome, you must reimplement basic window behaviors such as dragging. Below is a minimal C# pattern you can attach to a top panel or the form itself so the user can still click-and-drag to move the window:

using System.Runtime.InteropServices;

private const int WM_NCLBUTTONDOWN = 0xA1;
private const int HTCAPTION = 0x2;

[DllImport("user32.dll")]
private static extern bool ReleaseCapture();

[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

// Wire this to the MouseDown event of the panel or form
private void Drag_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left)
    {
        ReleaseCapture();
        SendMessage(this.Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
    }
}

Cautions and extra tips: removing the visible title can affect accessibility and Alt+Tab labels — add an AccessibleName if screen readers are a concern. Going borderless also means you’ll need to reimplement resizing, system menu, and standard window buttons if you need them. For reference, see the .NET Form.Text documentation and the Win32 SendMessage/ReleaseCapture docs for the dragging technique: Form.Text (System.Windows.Forms) and SendMessage / ReleaseCapture.

Recommended Answers

All 3 Replies

You can use following code on form_load event :

this.Text=" ";

You can try this as well

public Form1() {
  InitializeComponents();
  this.Text = string.Empty; 
}

thank you buddies............

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.