using
System;
using
System.Drawing;
using
System.Drawing.Drawing2D;
using
System.Collections;
using
System.ComponentModel;
using
System.Windows.Forms;
using
System.Data;
namespace
NonStandardUI1
{
///
<summary>
/// Summary description
for Form1.
///
</summary>
public class
Form1 : System.Windows.Forms.Form
{
///
<summary>
///
Required designer variable.
///
</summary>
private
System.ComponentModel.Container components = null;
public
Form1()
{
//
//
Required for Windows Form Designer
support
//
InitializeComponent();
//
//
TODO: Add any constructor code after InitializeComponent call
//
this.SetStyle(ControlStyles.ResizeRedraw,true);
}
///
<summary>
///
Clean up any resources being used.
///
</summary>
protected
override void
Dispose( bool disposing )
{
if(
disposing )
{
if
(components != null)
{
components.Dispose();
}
}
base.Dispose(
disposing );
}
#region Windows Form Designer generated code
///
<summary>
///
Required method for Designer
support
- do not modify
///
the contents of this method with the code editor.
///
</summary>
private
void InitializeComponent()
{
//
//
Form1
//
this.AutoScaleBaseSize
= new System.Drawing.Size(5, 13);
this.ClientSize
= new System.Drawing.Size(292, 266);
this.Name
= "Form1";
this.Text
= "Form1";
this.Load
+= new System.EventHandler(this.Form1_Load);
this.Paint
+= new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
}
#endregion
///
<summary>
///
The main entry point for the application.
///
</summary>
[STAThread]
static
void Main()
{
Application.Run(new
Form1());
}
private
void Form1_Load(object
sender, System.EventArgs e)
{
GraphicsPath
gp=new GraphicsPath();
gp.AddEllipse(0,0,this.Width,this.Height);
this.Region=new
Region(gp);
gp.Dispose();
}
private
void Form1_Paint(object
sender, System.Windows.Forms.PaintEventArgs e)
{
Random
r=new Random(1);
for(int
x=0; x<100; x++)
{
Pen
p=new
Pen(Color.FromArgb(r.Next(255),r.Next(255),r.Next(255)),r.Next(10));
e.Graphics.DrawLine(p,r.Next(this.Width),r.Next(this.Height),r.Next(this.Width),r.Next(this.Height));
p.Dispose();
}
}
}
}
Imports
System
Imports
System.Drawing
Imports
System.Drawing.Drawing2D
Imports
System.Collections
Imports
System.ComponentModel
Imports
System.Windows.Forms
Imports
System.Data
Namespace
NonStandardUI1
'/ <summary>
'/ Summary description for Form1.
'/ </summary>
Public Class
Form1
Inherits
System.Windows.Forms.Form
'/
<summary>
'/
Required designer variable.
'/
</summary>
Private
components As System.ComponentModel.Container =
Nothing
Public
Sub New()
'
'
Required for Windows Form Designer support
'
InitializeComponent()
'
'
TODO: Add any constructor code after InitializeComponent call
'
Me.SetStyle(ControlStyles.ResizeRedraw,
True)
End
Sub 'New
'/
<summary>
'/
Clean up any resources being used.
'/
</summary>
Protected
Overloads Overrides
Sub Dispose(ByVal
disposing As Boolean)
If
disposing Then
If
Not (components Is
Nothing) Then
components.Dispose()
End
If
End
If
MyBase.Dispose(disposing)
End
Sub 'Dispose
#Region
"Windows Form Designer generated code"
'/
<summary>
'/
Required method for Designer support - do not modify
'/
the contents of this method with the code editor.
'/
</summary>
Private
Sub InitializeComponent()
'
'
Form1
'
Me.AutoScaleBaseSize
= New System.Drawing.Size(5, 13)
Me.ClientSize
= New System.Drawing.Size(292, 266)
Me.Name
= "Form1"
Me.Text
= "Form1"
End Sub
'InitializeComponent
#End
Region
'/
<summary>
'/
The main entry point for the application.
'/
</summary>
<STAThread()> _
Shared
Sub Main()
Application.Run(New Form1)
End
Sub 'Main
Private
Sub Form1_Load(ByVal
sender As Object,
ByVal e As System.EventArgs)
Handles MyBase.Load
Dim
gp As New
GraphicsPath
gp.AddEllipse(0, 0, Me.Width,
Me.Height)
Me.Region
= New [Region](gp)
gp.Dispose()
End
Sub 'Form1_Load
Private
Sub Form1_Paint(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.PaintEventArgs) Handles
MyBase.Paint
Dim
r As New
Random(1)
Dim
x As Integer
For
x = 0 To 99
Dim
p As New
Pen(Color.FromArgb(r.Next(255), r.Next(255), r.Next(255)), r.Next(10))
e.Graphics.DrawLine(p,
r.Next(Me.Width), r.Next(Me.Height),
r.Next(Me.Width), r.Next(Me.Height))
p.Dispose()
Next
x
End
Sub 'Form1_Paint
End Class
'Form1
End
Namespace
'NonStandardUI1