P
p988
using System;
using System.Windows.Forms;
using System.Drawing;
class MyForm : Form
{
MyForm ()
{
Text = "Windows Forms Demo";
}
protected override void OnPaint (PaintEventArgs e)
{
e.Graphics.DrawString ("Hello, world", Font,
new SolidBrush (Color.Black), ClientRectangle);
}
void MyMethod()
{
//...
}
static void Main ()
{
Application.Run (new MyForm ());
}
}
Why "protected" access specifier used for "OnPaint()" above?
Is this because that MyForm is potentially used as a parent class of another
level of deriative?
If MyForm class will be used as a parent class, how to handle the "static
void Main()" in its child classes?
What's the default access specifier for "MyMethod()" if it doesn't have one?
using System.Windows.Forms;
using System.Drawing;
class MyForm : Form
{
MyForm ()
{
Text = "Windows Forms Demo";
}
protected override void OnPaint (PaintEventArgs e)
{
e.Graphics.DrawString ("Hello, world", Font,
new SolidBrush (Color.Black), ClientRectangle);
}
void MyMethod()
{
//...
}
static void Main ()
{
Application.Run (new MyForm ());
}
}
Why "protected" access specifier used for "OnPaint()" above?
Is this because that MyForm is potentially used as a parent class of another
level of deriative?
If MyForm class will be used as a parent class, how to handle the "static
void Main()" in its child classes?
What's the default access specifier for "MyMethod()" if it doesn't have one?