using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class Form1 : System.Windows.Forms.Form{
public Form1()
{
InitializeComponent();
SetStyle(ControlStyles.Opaque, true);
Bounds = new Rectangle(0, 0, 500, 300);
}
protected override void OnPaint(PaintEventArgs e) {
Graphics g = e.Graphics;
g.FillRectangle(Brushes.White, ClientRectangle);
// Draw left justified text
Rectangle rect = new Rectangle(0, 0, 400, Font.Height);
g.DrawRectangle(Pens.Blue, rect);
g.DrawString("www.java2java.com", Font,
Brushes.Black, rect);
}
private void InitializeComponent()
{
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
static void Main()
{
Application.Run(new Form1());
}
}
|