--------------------------------------------------------------------------------
function createPictureFromURL(url)
local http = getInternet()
local file = http.getURL(url)
http.destroy()
local picture = createPicture()
local stream = createStringStream(file)
picture.loadFromStream(stream)
stream.Destroy()
return picture
end
function fLoad()
url = "https://st.motortrend.com/uploads/sites/5/2018/11/2019-Mazda3-hatch-profile.jpg"
mypic = createPictureFromURL(url)
img.setPicture(mypic)
img.AutoSize = true
end
function img_MouseDown(sender, X, Y)
X,Y = img.ScreenToClient(getMousePos())
if isKeyPressed(VK_LBUTTON) then
MouseIsDown = true
m_PanStartPoint.X = X
m_PanStartPoint.Y = Y
img_MouseMove()
end
end
function img_MouseMove(sender, X, Y)
X,Y = img.ScreenToClient(getMousePos())
-- if isKeyPressed(VK_LBUTTON) then
if MouseIsDown == true then
DeltaX = (m_PanStartPoint.X - X)
DeltaY = (m_PanStartPoint.Y - Y)
scr.HorzScrollBar.Position = DeltaX - scr.HorzScrollBar.Position
scr.VertScrollBar.Position = DeltaY - scr.VertScrollBar.Position
end
end
function img_MouseUp(sender, X, Y)
X,Y = img.ScreenToClient(getMousePos())
MouseIsDown= false
m_PanStartPoint.X = X
m_PanStartPoint.Y = Y
end
function FormClose(sender)
closeCE()
return caFree
end
function img_MouseMove(sender)
-- if isKeyPressed(VK_LBUTTON) then
if MouseIsDown == true then
local X,Y = img.ScreenToClient(getMousePos())
scr.HorzScrollBar.Position = X - scr.HorzScrollBar.Position
scr.VertScrollBar.Position = Y - scr.VertScrollBar.Position
end
end
You want reverse?
Code:
function img_MouseMove(sender)
-- if isKeyPressed(VK_LBUTTON) then
if MouseIsDown == true then
local X,Y = img.ScreenToClient(getMousePos())
local reverse = bNot(X - scr.HorzScrollBar.Position)
scr.HorzScrollBar.Position = reverse + scr.Width * 1.2
scr.VertScrollBar.Position = Y - scr.VertScrollBar.Position
end
end
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum