Ahojte
Mam dva samostatne subory InheritHelloWorld a HelloWorld.
Chcem aby metoda "Main" bola vstupnym bodom programu v subore InheritHelloWorld. ako to mam nastavit??
a potom do prikazoveho riadku pri kompilovani zadam obidva subory zdrojoveho kodu nejak takto???
csc.exe InheritHelloWorld.cs HelloWorld.cs /Main:InheritHelloWorld.cs
pouzivam Visual C# 2008
tu su tie kody:
Kód:
//InheritHelloWorld.cs
using System;
using Drawing;
using System.Windows.Forms;
class InheritHelloWorld: HelloWorld//trieda "InheritHelloWorld" dediod triedy "HelloWorld"
{
public new static Main()
{
Application.Run(new InheritHelloWorld());
}
public InheritHelloWorld()
{
Text = "Inherit" + Text;
}
protected override void OnPaint(PaintEventArgs pea)
{
Graphics grfx = pea.Graphics;
grfx.DrawString("Hello from InheritHelloWorld!", Font, Brushes.Black, 0, 100);
}
}
Kód:
HelloWorld.cs
using System;
using System.Drawing;
using System.Windows.Forms;
class HelloWorld : Form //dedenie z triedy Form
{
public static void Main()
{
Application.Run(new HelloWorld());
}
public HelloWorld()
{
Text = "Hello World";
BackColor = Color.White;
}
protected override void OnPaint(PaintEventArgs pea)
{
Graphics grfx = pea.Graphics;
grfx.DrawString("Hello, Windows Forms!", Font, Brushes.Black, 0, 0);
}
}
diki za info