Under C#, you can overload OnPaint on a class derived from Form and then it will automatically be called upon the paint event. I find that under IronPython that I am forced to explicitly add the OnPaint method to the paint message handler list. Is this by design?
import sys sys.LoadAssemblyByName("System") sys.LoadAssemblyByName("System.Drawing") sys.LoadAssemblyByName("System.Windows.Forms")
from System import * from System.Windows.Forms import * from System.Drawing import *
class HelloWorld(Form):
def __init__ (self): print "HelloWorld.__init__" self.Text = "Hello World" self.BackColor = Color.White self.Paint += HelloWorld.OnPaint # not necessary in Csharp
def OnPaint (self, pea): print "HelloWorld.OnPaint" grfx = pea.Graphics grfx.DrawString("Hell, Windows Forms!", self.Font, Brushes.Black, 0, 0)
Application.Run(HelloWorld()) |
_______________________________________________ users-ironpython.com mailing list users-ironpython.com@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com