using System using System Component Model using System

  • Slides: 38
Download presentation

using System; using System. Component. Model; using System. Runtime. Interop. Services; namespace System. Windows.

using System; using System. Component. Model; using System. Runtime. Interop. Services; namespace System. Windows. Forms { public class Button : Button. Base, IButton. Control { public Button(); public Auto. Size. Mode { get; set; } protected override void On. Click(Event. Args e); … } }

Masked. Text. Box

Masked. Text. Box

Split. Container

Split. Container

Элемент класса System. Windows. Forms. Label

Элемент класса System. Windows. Forms. Label

private System. Windows. Forms. Button button 1; private System. Windows. Forms. Button btn 245;

private System. Windows. Forms. Button button 1; private System. Windows. Forms. Button btn 245; private System. Windows. Forms. Picture. Box picture. Box 1; private System. Windows. Forms. Label label 2; this. label 2. Auto. Size = true; this. label 2. Back. Color = System. Drawing. System. Colors. Control; this. label 2. Font = new System. Drawing. Font("Microsoft Sans Serif", 19. 8 F, System. Drawing. Font. Style. Regular, System. Drawing. Graphics. Unit. Point, ((byte)(204))); this. label 2. Location = new System. Drawing. Point(275, 406); this. label 2. Name = "label 2"; this. label 2. Size = new System. Drawing. Size(354, 39); this. label 2. Tab. Index = 4; this. label 2. Text = "Автор: Алексеев В. А. ";

using System; … using System. Windows. Forms; namespace Windows. Forms. Application 1 { public

using System; … using System. Windows. Forms; namespace Windows. Forms. Application 1 { public partial class Form 1 : Form { public Form 1() { Initialize. Component(); this. label 2. Parent = picture. Box 1; label 2. Back. Color = Color. Transparent; } private void button 1_Click(object sender, Event. Args e) { this. Text = "Close"; btn 245. Text = "Start"; }

Пример private: System: : Void button 1_Click(System: : Object^ sender, System: : Event. Args^

Пример private: System: : Void button 1_Click(System: : Object^ sender, System: : Event. Args^ e) { this->open. File. Dialog 1 ->Initial. Directory = "c: \"; this->open. File. Dialog 1 ->Filter = "txt files (*. txt)|*. txt|All files (*. *)|*. *"; this->open. File. Dialog 1 ->Filter. Index = 2; // this->open. File. Dialog 1 ->Restore. Directory = true; this->open. File. Dialog 1 ->Multiselect=true; this->open. File. Dialog 1 ->Show. Help=true; this->open. File. Dialog 1 ->Title = "My Dialog"; this->open. File. Dialog 1 ->Default. Ext="txt"; if ( this->open. File. Dialog 1 ->Show. Dialog() == System: : Windows: : Forms: : Dialog. Result: : OK && this->open. File. Dialog 1>File. Name->Length > 0 ) { // Load the contents of the file into the Rich. Text. Box. this->rich. Text. Box 1 ->Load. File(this->open. File. Dialog 1 ->File. Name, Rich. Text. Box. Stream. Type: : Plain. Text); } }

С# Open. File. Dialog Open. Dlg = new Open. File. Dialog(); if (Open. Dlg.

С# Open. File. Dialog Open. Dlg = new Open. File. Dialog(); if (Open. Dlg. Show. Dialog() == Dialog. Result. OK) { Stream. Reader = new Stream. Reader(Open. Dlg. File. Name, Encoding. Default); rich. Text. Box 1. Text = Reader. Read. To. End(); Reader. Close(); } Open. Dlg. Dispose();

Пример 1 private: System: : Void button 1_Click(System: : Object^ sender, System: : Event.

Пример 1 private: System: : Void button 1_Click(System: : Object^ sender, System: : Event. Args^ e) { rich. Text. Box 1 ->Dock = Dock. Style: : Fill; загружает файл rich. Text. Box 1 ->Load. File( "C: \rich. Text. Box 1. rtf" ); находит первое совпадение rich. Text. Box 1 ->Find( "Text", Rich. Text. Box. Finds: : Match. Case); устанавливает цвет для выделенного фрагмента rich. Text. Box 1 ->Selection. Color = Color: : Red; устанавливает шрифт для выделенного фрагмента rich. Text. Box 1 ->Selection. Font = gcnew System: : Drawing: : Font("Verdana", 12, Font. Style: : Bold ); сохраняет файл rich. Text. Box 1 ->Save. File( "C: \rich. Text. Box 1. rtf", Rich. Text. Box. Stream. Type: : Rich. Text );

Пример 2 private: System: : Void button 2_Click(System: : Object^ sender, System: : Event.

Пример 2 private: System: : Void button 2_Click(System: : Object^ sender, System: : Event. Args^ e) { // Clear all text from the Rich. Text. Box; rich. Text. Box 1 ->Clear(); // Set the font for the opening text to a larger Arial font; rich. Text. Box 1 ->Selection. Font = gcnew System: : Drawing: : Font( "Arial", 16 ); // Assign the introduction text to the Rich. Text. Box control. rich. Text. Box 1 ->Selected. Text = "Формируем маркированный список: n"; // Set the Font for the first item to a smaller size Arial font.

rich. Text. Box 1 ->Selection. Font = gcnew System: : Drawing: : Font( "Arial",

rich. Text. Box 1 ->Selection. Font = gcnew System: : Drawing: : Font( "Arial", 12 ); // Specify that the following items are to be added to a bulleted list. rich. Text. Box 1 ->Selection. Bullet = true; // Set the color of the item text. rich. Text. Box 1 ->Selection. Color = Color: : Red; // Assign the text to the bulleted item. rich. Text. Box 1 ->Selected. Text = "Красный n";

// Apply same font since font settings do not carry to next line. rich.

// Apply same font since font settings do not carry to next line. rich. Text. Box 1 ->Selection. Font = gcnew System: : Drawing: : Font( "Arial", 12 ); rich. Text. Box 1 ->Selection. Color = Color: : Orange; rich. Text. Box 1 ->Selected. Text = "Оранжевый n"; rich. Text. Box 1 ->Selection. Font = gcnew System: : Drawing: : Font( "Arial", 12 ); rich. Text. Box 1 ->Selection. Color = Color: : Purple; rich. Text. Box 1 ->Selected. Text = "Пурпурный n"; // End the bulleted list. rich. Text. Box 1 ->Selection. Bullet = false;

 // Specify the font size and string for text displayed below bulleted list.

// Specify the font size and string for text displayed below bulleted list. rich. Text. Box 1 ->Selection. Font = gcnew System: : Drawing: : Font( "Arial", 16 ); rich. Text. Box 1 ->Selected. Text = "Формирование списка успешно завершено!";