[Closed] system.drawing.pen?
What am I doing wrong here?
aColor = dotNetClass "system.drawing.color"
aPen = dotNetObject "system.drawing.pen" aColor 2
You need to set color first.
aColor = dotNetClass "system.drawing.color"
aColor = aColor.fromargb 255 255 255
aPen = dotNetObject "system.drawing.pen" aColor 2
you probably need to pass it an actual color from the .fromARGB method rather than the class.
How come you get your own dotnet class paul?
-- aColor = dotNetClass "system.drawing.color"
aColor = (dotNetClass "system.drawing.color").yellow -- it must be the object
aPen = dotNetObject "system.drawing.pen" aColor 2
…
OK next questions I have a label, I want to draw a line in it. I’m using sender.createGraphics() and then creating a pen and drawing the line. Works only for a second. I get a flash of the line and then it is gone. Any idea what is wrong?
I would rather not have to draw in a bitMap. I should just be able to draw into the label as I am and have it stay.
I’m doing it in a function that is being called from the mouseDown handler.
you are doing everything right… i don’t see a problem
try(destroydialog drawRol) catch()
rollout drawRol "Draw in Label"
(
dotNetControl lb "System.Windows.Forms.Label" width:180 height:30 pos:[10, 10]
local pen = dotNetObject "system.drawing.pen" (dotNetClass "system.drawing.color").red 2
on lb mouseDown s e do
(
g = s.createGraphics()
g.DrawLine pen 0 e.y s.bounds.width e.y
)
)
createdialog drawRol width:200 height:50
something forces labels redraw…
Look like I have to do it with the paint event. As soon as I did that it stays.
So I’m using the labels paint event and the arg.graphics to keep it updated.
This is very slow to update. What do I call to stop the display until it is drawn?