.


:




:

































 

 

 

 





, MainMenu. ( Visual Studio 2005 MenuStrip, - ToolStrip.)

, , , , .

System.Windows.Forms ( ) , .

ToolStrip , , .

MenuStrip - . ToolStrip. ToolStripMenu menuStrip.

ToolStripMenuItem . ToolStripMenuItem .

Show, " Undo". Show :

public static DialogResult Show(string message);

, Show , DialogResult.OK

MessageBox.Show, MessageBox,

public static DialogResult Show{string message, // string caption, // MessageBoxButtons btns, // , MessageBoxIcon icon, // , MessageBoxDefaultButton defButton, // MessageBoxOptions opt // };

caption MessageBox. btns , . MessageBoxButtons

icon MessageBox.Show . MessageBoxIcon

1.

1. , , / . MenuStrip . 10.1.

, : "", "", "".

. :

"" - Name objektToolStripMenuItem,

"" - exitToolStripMenuItem,

"" - HelpToolStripMenuItem.

. 10.1. MenuStrip

2. "" : "", "", "", "", "", ".

MenuStrip . 10.2.

. 10.2.

3. "" : "", "", "", "", "". "" - " ".

"" xitToolStripMenuItem Visual Studio Click , ( exitToolStripMenuItem_Click):

private void exitToolStripMenuItem_Click(object sender, EventArgs e){// }

4. (Properties) , Click menuItemExit_Click . 10.3.

. 10.3. Click exitToolStripMenuItem_Click

5. exitToolStripMenuItem_Click. Exit Application:

private void exitToolStripMenuItem_Click(object sender, EventArgs e){Application.Exit();}

6. , "", , :

private void objektToolStripMenuItem_Click(object sender, EventArgs e){MessageBox.Show(" ");}

Visual Studio InitializeComponent -, .

2.

(MDI) - MDI . - , MDI . "", MDI .

1. (Form1), , IsMDIContainer - true. MDI . WindowsState Maximized.

2. , (FormEmployee). Project/Add Windows Form. "".

3. , , MDI , , "" - - employeeToolStripMenuItem ( , Click employeeToolStripMenuItem_Click).

private void menuItemEmploye_Click(object sender, System.EventArgs e)

{ // FEmployee FormEmployeeFormEmployee FEmployee = new FormEmployee();// FEmployee.MdiParent = this;// FEmployee.Show();}

3.

1. "" (actionToolStripMenuItem) :

"" (undoToolStripMenuItem),

"" (createToolStripMenuItem),

"" (editToolStripMenuItem),

"" (saveToolStripMenuItem),

"" (removeToolStripMenuItem).

2.

(Separator - name = toolStripSeparator1).

3. ""(reportToolStripMenuItem) " " (reportToolStripMenuItem1), " " (reportToolStripMenuItem2). . 10.4.

. 10.4.

4. (Form1) : "", "" "".

(FormEmployee) "" "". : "", "", "", "" "".

MegreAction MegreIndex ToolStripMenuItem.

5. , objektToolStripMenuItem MegreAction Append, MegreIndex 0, dictionaryToolStripMenuItem helpToolStripMenuItem - 1 2. , "" actionToolStripMenuItem () "" (reportToolStripMenuItem) MegreAction Insert, MegreIndex , .. 1 ( objektToolStripMenuItem).

6. , "" , 10.5.

.10.5.

4.

(, , , ) . " " : ( ""), ( ""), ( ""), ( "") ( "").

FormEmployee.

1. :

Undo-; New-; Edit -; Save -; Remove-

, , , -, , .

2. Undo FormEmployee.cs :

private void Undo(){ MessageBox.Show(" Undo");}

3. "". FormEmployee "". VS :

private void undoToolStripMenuItem_Click(object sender, EventArgs e){}

4. undoToolStripMenuItem_Click Undo:

private void undoToolStripMenuItem_Click(object sender, EventArgs e){Undo();}

5. Undo. "" , . 10.6.

. 10.6.

6. - "", "", "" "".

5.

1. Remove, . Remove :

private void Remove(){DialogResult result = MessageBox.Show(" \n ? ","", MessageBoxButtons.YesNo, MessageBoxIcon.Warning,MessageBoxDefaultButton.Button2);switch (result){case DialogResult.Yes:{// MessageBox.Show(" ");}case DialogResult.No:{// MessageBox.Show(" ");break;}}

"" . 10.7.

. 10.7.

MessageBox, Windows - .

2. FormAbout , , . 10.8

. 10.8. Windows - FormAbout

3. (. 10.9.), AboutBox

. 10.9.

AboutBox1 .

4. AboutBox . . .

5. AboutBox1 :

public AboutBox1()

{

InitializeComponent();

this.Text = String.Format(" {0}", AssemblyTitle);

this.labelProductName.Text = AssemblyProduct;

this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);

this.labelCopyright.Text = ", 2009";

this.labelCompanyName.Text = " , -401";

this.textBoxDescription.Text = " ";

}

ShowDialog. " / ". :

//

private void aboutToolStripMenuItem_Click(object sender, EventArgs e)

{AboutBox1 aboutBox = new AboutBox1();

aboutBox.ShowDialog(this); }

, / , . 10.10.

. 10.10.

DialogResult.

6.

ToolStrip . , ToolStripItem.

Visual Studio.NET , .

1. Toolbox ToolStrip FormEmployee.

2. button ToolStrip FormEmployee . 10.11. .

.10.11.

3. toolStripButtonUndo, toolStripButtonNew, toolStripButtonEdit, toolStripButtonSave, toolStripButtonRemove. . 10.12.

. 10.12. FormEmployee

4. . Image . 10.13.

. 10.13. Image

5. Image ,

6. Import , . .

Visual Studio 2005\VS2005ImageLibrary\bitmaps\commands\16color ( ).

. 10.14.

, toolStripButton, , , .

. "", "", "", "" "".

.

7. ToolTipText . .10.16. "" (toolStripButtonUndo) ToolTipText "".

. 10.15.

.10.16 .

. 10.16.

8. . . , Undo. :

private void toolStripButtonUndo_Click(object sender, EventArgs e){ Undo();}

7.

ContextMenuStrip , , .

1. Toolbox contextMenuStrip FormEmployee. FormEmployee

2. . .10.17.

. 10.17.

3. contextMenuStrip1 FormEmployee (Properties) , ContextMenuStrip .10.18.

. 10.18.

, "" . .

. 10.19.

4. . FormEmployee, ContextMenuStrip , "". , "" - Undo(). .

private void undo1ToolStripMenuItem_Click(object sender, EventArgs e){Undo();}

1. , .

2. , , .

3. , - ,

4. .

5.

1. ?

2. ?

3. ToolStrip?

4. Undo?

[3-4, 11-12].

11

Windows-

Microsoft Visual Studio. Net

: Windows-, , Windows-

1. .

  1. FormEmployee .
  2. "", "" , , .
  3. Load.
  4. .




:


: 2018-11-11; !; : 417 |


:

:

, .
==> ...

1582 - | 1456 -


© 2015-2024 lektsii.org - -

: 0.095 .