Using System;
Using System. Drawing;
Using System. Collections;
Using System. ComponentModel;
Using System. Windows. Forms;
Using System. Data;
Namespace Miner
{
/// <Summary>
/// Summary des cription for Form1.
/// </Summary>
Public class Form1: System. Windows. Forms. Form
{
Private System. Windows. Forms. Panel panel1;
/// <Summary>
/// Required designer variable.
/// </Summary>
///
Private Button [] n = new Button [100];
Private int [] kn = new int [100];
Private System. ComponentModel. Container components = null;
Public Form1 ()
{
//
// Required for Windows Form Designer support
//
InitializeComponent ();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <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 ()
{
This. panel1 = new System. Windows. Forms. Panel ();
This. SuspendLayout ();
//
// Panel1
//
This. panel1.Location = new System. Drawing. Point (8, 8 );
This. panel1.Name = "panel1 ";
This. panel1.Size = new System. Drawing. Size (400,400 );
This. panel1.TabIndex = 0;
//
// Form1
//
This. AutoScaleBaseSize = new System. Drawing. Size (6, 14 );
This. BackColor = System. Drawing. Color. White;
This. ClientSize = new System. Drawing. Size (416,413 );
This. Controls. AddRange (new System. Windows. Forms. Control [] {
This. panel1 });
This. Name = "Form1 ";
This. Text = "Form1 ";
This. Load + = new System. EventHandler (this. form#load );
This. ResumeLayout (false );
}
# 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)
{
Int a = 0;
Int x = 0, y = 0;
For (a = 0; a <= 99; a ++)
{
N [a] = new Button ();
N [a]. BackColor = Color. White;
N [a]. FlatStyle = FlatStyle. Flat;
N [a]. Width = panel1.Width/10;
N [a]. Left = x * n [a]. Width;
N [a]. Height = panel1.Height/10;
N [a]. Top = y * n [a]. Height;
N [a]. Name = "B" +;
Panel1.Controls. Add (n [a]);
Panel1.Controls [a]. MouseDown + = new MouseEventHandler (this. ButtonArray_OnClick );
X + = 1;
If (x = 10)
{
X = 0;
Y + = 1;
}
}
}
Private void ButtonArray_OnClick (object sender, MouseEventArgs e)
{
MouseEventArgs arg = (MouseEventArgs) e;
Button b1 = (Button) sender;
If (arg. Button = MouseButtons. Right)
B1.BackColor = Color. White;
Else
{
// B1.BackColor = Color. White;
B1.Image = Image. FromFile ("f: \ my documents \ my pictures \ elements \ regular_smile.gif ");
}
}
}
}