Post by tsh73 on Dec 27, 2021 15:03:32 GMT
and (one of) way of resizing graphicbox.
Notice bitmap redraw (background by sprite engine) does not scale down, only up.
Drag by lower right 10 pixels.
Notice bitmap redraw (background by sprite engine) does not scale down, only up.
Drag by lower right 10 pixels.
' Form created with the help of Freeform-J v.261006
' Generated on Dec 26, 2021 at 22:10:10
nomainwin
'cooment it out to get bitmap redraw
'start with "bad" bitmap resize
'vectorRedraw=1
WindowWidth = 550
WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
statictext #main.statictext1, "Drag lower right corner to resize graphicbox", 10, 5, 312, 20
CHECKBOX #main.ch, "vector redraw", [set], [reset], 10, 30, 200, 25
graphicbox #main.gr, 10, 60, 100, 100
open "resize graphicbox" for window as #main
print #main.gr,"down; fill white; flush"
print #main.gr, "home; posxy cx cy" 'reads size of graphicbox as 2*cx, 2*cy
print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
#main.gr "when leftButtonDown [start]"
#main.gr "when leftButtonUp [fin]"
drag=0
gosub [draw]
wait
[quit.main]
Close #main
END
[reset]
vectorRedraw=0
wait
[set]
vectorRedraw=1
wait
[start]
if MouseX<2*cx-10 then wait
if MouseY<2*cy-10 then wait
drag=1
'sx=MouseX
'sy=MouseY
wait
[fin]
if not(drag) then wait
#main.gr "locate 10 60 ";MouseX;" ";MouseY
#main "refresh"
print #main.gr, "home; posxy cx cy" 're-read size of graphicbox
'print 2*cx, 2*cy
if vectorRedraw then
gosub [draw]
else
#main.gr "background bmp"
#main.gr, "drawsprites"
end if
drag=0
wait
[draw]
'first time draw for bitmap redraw
'or every time for vector redraw
#main.gr, "cls"
r=.8*min(cx,cy)
pi=acs(-1)
n = 7
a=0
x=cx+r*cos(a)
y=cy+r*sin(a)
#main.gr, "place ";x;" ";y
for i = 0 to n*int(n/2) step int(n/2)
a=2*pi/n*i
x=cx+r*cos(a)
y=cy+r*sin(a)
#main.gr, "goto ";x;" ";y
'print i, x,y
next
#main.gr, "flush"
#main.gr "getbmp bmp 0 0 ";2*cx;" ";2*cy
#main.gr "background bmp"
return