2-
, C#
, Upr : Model Info.
Upr .
Model .
Info , .
( ) Model Info.
- -. - .
.
Upr. , , .
Model Info. new . , . , , .
- but. , , .
Model Info.
Model , Info , . , ,
. ClickBut() . Click EventHandler. ClickBut(), mod inf , d Invalidate() , OnPaint() .
1.
using System;
using System.Drawing;
using System.Windows.Forms;
namespace csKurs2_1
{
class Model: Form
{
}
class Inf: Form
{
}
public class Upr: System.Windows.Forms.Form
{
public Upr ()
{
this.Size = new System.Drawing.Size(300,300);
this.Text = "Upr";
}
[STAThread]
static void Main()
{
Application.Run(new Upr());
}
}
}
, Form. Model Inf . Upr, Run Application. Run . Upr .
|
|
2.
...
public class Upr: System.Windows.Forms.Form
{
public Upr ()
{
this.Size = new System.Drawing.Size(300,300);
this.Text = "Upr";
Model mod= new Model ();
mod.Text= "Model";
Mod.Show ();
Inf inf= new Inf ();
inf.Text= "Information";
Inf.Show ();
}
[STAThread]
static void Main()
{
Application.Run(new Upr());
}
}
}
Upr , Show Form.
3.
...
public class Upr: System.Windows.Forms.Form
{
Model mod;
Inf inf;
Button but;
public Upr ()
{
this.Size = new System.Drawing.Size(300,300);
this.Text = "Upr";
but= new Button ();
but.Text="OK";
but.Location= new Point (10,10);
but.Size= new Size(30,20);
This.Controls.Add (but);
...
}
[STAThread]
static void Main()
{
Application.Run(new Upr());
}
}
}
but Button Controls.
4.
using System;
using System.Drawing;
using System.Windows.Forms;
namespace csKurs2_4
{
class Model: Form
{
private int d=3;