Set form caption : Form Properties « GUI Windows Forms « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / CSharp Tutorial » GUI Windows Forms » Form Properties 




Set form caption
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class SetFormCaption : System.Windows.Forms.Form
{
  private System.ComponentModel.Container components;

  public SetFormCaption()
  {
    InitializeComponent();
    Text = "www.java2s.com";    
  }

  protected override void Disposebool disposing )
  {
    ifdisposing )
    {
      if (components != null
      {
        components.Dispose();
      }
    }
    base.Disposedisposing );
  }

  private void InitializeComponent()
  {
    this.AutoScaleBaseSize = new System.Drawing.Size(513);
    this.ClientSize = new System.Drawing.Size(292273);
    this.Text = "DataGridExample";
    this.Resize += new System.EventHandler(this.SetFormCaption_Resize);
    this.Paint += new System.Windows.Forms.PaintEventHandler(this.SetFormCaption_Paint);
    }
  [STAThread]
  static void Main() 
  {
    Application.Run(new SetFormCaption());
  }

  private void SetFormCaption_Resize(object sender, System.EventArgs e)
  {
    Invalidate();
    Console.WriteLine("Resize");
  }

  private void SetFormCaption_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
    Graphics g = e.Graphics;
    g.DrawString("Text"
      new Font("Times New Roman"20)
      new SolidBrush(Color.Black)
      this.DisplayRectangle);    
  }

}














23.5.Form Properties
23.5.1.Change Form ClientSizeChange Form ClientSize
23.5.2.Form.StartPosition
23.5.3.Form with Maximize BoxForm with Maximize Box
23.5.4.Form without MinimizeBox and MaximizedBoxForm without MinimizeBox and MaximizedBox
23.5.5.Set form background colorSet form background color
23.5.6.Set form captionSet form caption
23.5.7.Set Form sizeSet Form size
23.5.8.Set Form Height
23.5.9.Set Form Width
23.5.10.Set FormBorderStyle
23.5.11.Center Form to the screenCenter Form to the screen
23.5.12.Resize redraw form: get/set Form styleResize redraw form: get/set Form style
23.5.13.Form Bounds SettingForm Bounds Setting
23.5.14.Form Opacity setting
23.5.15.Use Form.DialogResult
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.