.lua Expert Cheater
Reputation: 1 Joined: 13 Sep 2018 Posts: 202
|
Posted: Tue Sep 22, 2020 5:30 am Post subject: |
|
|
You need to solve several problems:
First: we should record the coordinate point when the mouse clicks (as the origin coordinate), and draw the area horizontally and vertically with this coordinate point
Second: the brush color should follow the area being drawn, not the entire canvas
Code: | if f then f.Destroy() end
f=createForm()
f.Color=0x00ff00
f.setSize(300,300)
--f.OnMouseDown=function(p) f.dragNow() end
local down=1
f.OnMouseDown=function()
down=0
end
f.OnMouseUp=function()
down=1
end
f.OnMouseMove=function()
local x,y=f.ScreenToClient(getMousePos())
if down==0 then
f.caption=x..' '..y
f.Canvas.Clear()
f.Canvas.Pen.Width=1
f.Canvas.Brush.Color=0x00ffff
f.Canvas.roundRect(f.width-x, f.height-y, x, y, 16, 16)
end
end
f.setLayeredAttributes(0x0000ff,220,3,3) |
|
|