Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Thu Sep 22, 2022 11:20 pm Post subject: Magnifier Over TImage Using Mouse Move (Code Review) |
|
|
As the subject, I try make it. Is there anyone to review the code and fix it?.
The problem, code work not as expected
Note, I already tried to use Draw / StretchDraw.
Code: | if Form1 then Form1.Destroy() end
Form1 = createForm()
Form1.setSize(700, 500)
Form1.Position = 'poScreenCenter'
Form1.Caption = 'CRDR - CE Magnifying Glass Effect'
PicMap = createImage(Form1)
PicMap.Align = 'alClient'
PicMap.BorderStyle = 'bsFixed'
PicMap.BorderWidth = 1
PicMap.Stretch = true
PicMap.Picture.loadFromStream(findTableFile('usmap.gif').Stream)
PicHidden = createImage(Form1)
PicHidden.Left = 648
PicHidden.Top = 448
PicHidden.Width = 165
PicHidden.Height = 106
PicHidden.Visible = false
PicHidden.Picture.loadFromStream(findTableFile('usmapsmall.jpg').Stream)
--------------------------------------------------------------------------------
SCALE_FACTOR = 2
SMALL_RADIUS = 25
BIG_RADIUS = SMALL_RADIUS * SCALE_FACTOR
BIG_DIAMETER = 2 * BIG_RADIUS
--rect1 = {}
--rect2 = {}
function picMap_MouseMove(X, Y)
X,Y = PicMap.ScreenToClient(getMousePos())
PicMap.Repaint()
--rect1.Left = X - BIG_RADIUS
--rect1.Top = Y - BIG_RADIUS
--rect1.Height = BIG_DIAMETER
--rect1.Width = BIG_DIAMETER
--rect2.Left = X * 2 - BIG_RADIUS
--rect2.Top = Y * 2 - BIG_RADIUS
--rect2.Height = BIG_DIAMETER
--rect2.Width = BIG_DIAMETER
par = [[ Original script in VB6 below :
PaintPicture picHidden.Picture, _
X - BIG_RADIUS, Y - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER,
X * 2 - BIG_RADIUS, Y * 2 - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER) ]]
--draw(x,y, graphic) : Draw the image of a specific Graphic class
PicMap.Canvas.copyRect(X * 2 - BIG_RADIUS, Y * 2 - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER, PicHidden.Picture.Bitmap.Canvas, X - BIG_RADIUS, Y - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER)
--draw(x,y, graphic) : Draw the image of a specific Graphic class
-- Make border to magnifier
--PicMap.Canvas.LineTo(X - BIG_RADIUS, Y - BIG_RADIUS, BIG_DIAMETER, BIG_DIAMETER)
end
function closed()
closeCE()
return caFree
end
Form1.Show()
PicMap.OnMouseMove = picMap_MouseMove
Form1.OnClose = closed |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|