Hi. It’s not like it’s impossible to make the text be on top of the DrawRectangle during the Draft and after releasing the MouseUp everything goes back.
try(destroydialog drawRol) catch()
rollout drawRol "Draw in Label"
(
dotNetControl lb "System.Windows.Forms.Label" width:240 height:30 pos:[10, 10]
local PaintRdy = false
on lb mouseDown s e do
(
PaintRdy = true
)
on lb mouseUp s e do
(
PaintRdy = false
)
on lb mouseMove s e do
(
if PaintRdy do
(
local RectBrush = dotnetobject "System.Drawing.SolidBrush" s.Backcolor.Red
local RectPen = dotnetobject "System.Drawing.Pen" s.Backcolor.Black 2
RectPen.alignment = (dotnetclass"System.Drawing.Drawing2D.PenAlignment").inset
DraGra = s.createGraphics()
if (e.x <= s.bounds.width) then (paintX = e.x) else (paintX = s.bounds.width)
RectObj = Rectangle 0 0 paintX s.bounds.height
DraGra.FillRectangle RectBrush RectObj
DraGra.DrawRectangle RectPen RectObj
)
)
on drawRol open do
(
lb.text = "Test Label Brush"
)
)
createdialog drawRol width:300 height:50
Comments (2)
Comment policy
new
True, I still did not understand how to return back to its original state, except how to assign label.image
nice one , but :
RectObj = dotnetobject "System.Drawing.Rectangle" 0 0 paintX s.bounds.height