locked
how to change the font and color of form's heading RRS feed

  • Question

  • how do i change the color and font of form's heading. don't want to change the background color of whole form instead only the tile of form.
    Friday, December 11, 2009 12:36 PM

Answers

  • Have you read my reply to your another thread? Here I'd like to add a code sample to demonstrate my idea:

            private void AddFormHeader()
            {
                this.SuspendLayout();
                
                //Create a container panel to contain all controls in the form except the header label I'll add later.
                Panel p = new Panel();
                p.Size = this.Size;
                p.Location = new Point(0, 0);
                p.AutoScroll = true;

                foreach (Control c in this.Controls)
                {              
                    p.Controls.Add(c);
                }

                this.Controls.Add(p);

                //Create the header and add it to the form.
                Label header = new Label();
                header.Text = "hello!";
                header.Location = new Point(0, 0);

                this.Controls.Add(header);
                header.BringToFront();

                this.ResumeLayout();
            }

     If there is anything you don't understand please let me know. 


    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by poojs Wednesday, December 16, 2009 8:56 AM
    Tuesday, December 15, 2009 9:42 AM

All replies

  • Hi,

    I think to be able to achieve the customization you are after, you would have to draw your own title bar for your forms.

    Thanks

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Friday, December 11, 2009 2:40 PM
  • i have made my title bar using Label at the top of the form but it gets hide when i scroll down the screen. how can i fixed that title at the top of form
    Saturday, December 12, 2009 6:50 AM
  • Have you read my reply to your another thread? Here I'd like to add a code sample to demonstrate my idea:

            private void AddFormHeader()
            {
                this.SuspendLayout();
                
                //Create a container panel to contain all controls in the form except the header label I'll add later.
                Panel p = new Panel();
                p.Size = this.Size;
                p.Location = new Point(0, 0);
                p.AutoScroll = true;

                foreach (Control c in this.Controls)
                {              
                    p.Controls.Add(c);
                }

                this.Controls.Add(p);

                //Create the header and add it to the form.
                Label header = new Label();
                header.Text = "hello!";
                header.Location = new Point(0, 0);

                this.Controls.Add(header);
                header.BringToFront();

                this.ResumeLayout();
            }

     If there is anything you don't understand please let me know. 


    Please mark the post that helps you, and unmark that does not. This benefits our community.
    • Marked as answer by poojs Wednesday, December 16, 2009 8:56 AM
    Tuesday, December 15, 2009 9:42 AM
  • ok that panel. that 1 exists in toolbox.. ok fine earlier i did not understand exactly.
    Thanx a lot..
    Wednesday, December 16, 2009 8:56 AM