.


:




:

































 

 

 

 





, MyButtonClick () -.

, who , . , , , . MyButtonClick () :

 

// listing 4

// .

Protected void MyButtonClick(object who, EventArgs e)

{

Button b = (Button) who;

if(b.Top == 200)

b.Location = new Point(10, 10);

Else

b.Location = new Point(100, 200);

}

 

who Button, ( MyButton) .

, , . , , .

.

 

Windows- . . ( ), , .

, , MessageBox. . Show ().

Show () . :

 

Public static DialogResult Show(

string msg,

string caption,

MessageBoxButtons mbb)

, , msg.

caption.

, , mbb.

.

, Show (), , . :

 

Abort Cancel Ignore No

None OK Retry Yes

 

: if (result == DialogResult.Yes)

Application.Exit();

 

MessageBoxButtons , :

AbortRetrylgnore OK OKCancel

RetryCancel YesNo YesNoCancel

 

, .

, mbb YesNo, .

 

, Show (), , .

, , , , , .

, .

, , , , . , . , .

 

// listing 5

// .

Using System;

Using System.Windows.Forms;

Using System.Drawing;

class ButtonForm: Form

{

Button MyButton;

Button StopButton;

Public ButtonForm()

{

Text = " ";

// .

MyButton = new Button();

MyButton.Text = " ";

MyButton.Location = new Point(100, 200);

MyButton.Width = 100;

StopButton = new Button();

StopButton.Text = "";

StopButton.Location = new Point(100, 100);

// .

MyButton.Click += new EventHandler(MyButtonClick);

Controls.Add(MyButton);

StopButton.Click += new EventHandler(StopButtonClick);

Controls.Add(StopButton);

}

[STAThread]

Public static void Main()

{

ButtonForm skel = new ButtonForm();

Application.Run(skel);

}

// MyButton.





:


: 2016-10-22; !; : 576 |


:

:

: , .
==> ...

1491 - | 1468 -


© 2015-2024 lektsii.org - -

: 0.009 .