-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFig-13.40 - VisualInheritanceTest.cs
More file actions
66 lines (54 loc) · 1.55 KB
/
Copy pathFig-13.40 - VisualInheritanceTest.cs
File metadata and controls
66 lines (54 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Fig. 13.40: VisualInheritanceTest.cs
// Formulário derivado usando herança visual.
using System;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
// Cole classe VisualInheritance (Fig-13.38 - VisualInheritance.cs) aqui.
partial class VisualInheritanceTest : VisualInheritance
{
private Button learnProgramButton;
private void InitializeComponent()
{
this.learnProgramButton = new Button();
// learnProgramButton.
this.learnProgramButton.Name = "learnProgramButton";
this.learnProgramButton.Text = "Learn the\nProgram";
this.learnProgramButton.AutoSize = true;
this.learnProgramButton.Location = new Point(100, 40);
this.learnProgramButton.Click += new EventHandler(learnProgramButton_Click);
// VisualInheritanceTest.
this.Controls.Add(this.learnProgramButton);
this.Name = "VisualInheritanceTest";
this.Text = "VisualInheritanceTest";
}
private void learnProgramButton_Click(object? sender, EventArgs e)
{
MessageBox.Show(
"This program was created by Deitel & Associates",
"Learn the Program", MessageBoxButtons.OK,
MessageBoxIcon.Information
);
}
}
partial class VisualInheritanceTest
{
private Container? components = null;
public VisualInheritanceTest()
{ InitializeComponent(); }
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{ components.Dispose(); }
base.Dispose(disposing);
}
}
static class Program
{
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
Application.Run(new VisualInheritanceTest());
}
}