April 19, 2024, 07:33:52 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


graphic problem

Started by splakidas, April 09, 2007, 02:37:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

splakidas

I have a window with a jpeg.
Now i want to draw 10 rectangles wich i want to move arround and have the option to resize.
I want also to know every time the size  of them.

How can i realize that ? i stuck

splakidas

i just found an old example.

i think its a good start. That example puts different buttons on a window and you can also remove them
AutoDefine "OFF"
Window w1
Int count,controtype,style,flags,selected
String controltext
Int x,y,w,h,hwnd
controtype = @SysButton
controltext = "My Button"
style = 0x50000000
flags = 0
OpenWindow w1,20,20,600,400,@Size|@MaxBox,0,"ibMouseFocusRect",&hnd
ibSetWindowSysColor(w1,15)
EnableTabs(w1,1)
BeginMenu w1
MenuTitle "&Control Type"
MenuItem " Button",0,1
MenuItem " SysButton",0,2
MenuItem " CheckBox",0,3
MenuItem " Radio",0,4
MenuItem " Edit",0,5
MenuItem " RichEdit",0,6
MenuItem " ListBox",0,7
SEPARATOR
MenuItem " Remove Selected",0,20
MenuItem " Remove All",0,21
MenuTitle "&Style Type"
MenuItem " Group",0,101
MenuItem " TabStop",0,102
EndMenu
ibMenuToggleState(w1,1)

WaitUntil w1=0
End

Sub hnd
POINT pt
Int z,ret
Select @Class
Case @IDControl
selected = @ControlID
Case @IDLButtonDN
ret = ibMouseFocusRect(w1,x,y,w,h,&cback)
If w > 19 AND h > 19
count++
Control w1,controtype,controltext,x,y,w,h,style|flags,count
selected = count
EndIf
Case @IDMenuPick
If @MenuNum < 10
For z = 1 To 7
CheckMenuItem(w1,z,0)
Next z
CheckMenuItem(w1,@MenuNum,1)
EndIf
Select @MenuNum
Case 1
controtype = @Button
controltext = "My Button"
style = 0x50000000
Case 2
controtype = @SysButton
controltext = "My SysButton"
style = 0x50000000
Case 3
controtype = @CheckBox
controltext = "My CheckBox"
style = 0x50000003
Case 4
controtype = @RadioButton
controltext = "My RadioButton"
style = 0x50000009
Case 5
controtype = @Edit
controltext = "My Edit"
style = 0x50800000
Case 6
controtype = @RichEdit
controltext = "My RichEdit"
style = 0x50B010C4
Case 7
controtype = @ListBox
controltext = "My ListBox"
style = 0x50800140
Case 20
If selected > 0
ibDestroyControl(w1,selected)
selected = 0
EndIf
Case 21
For z = 1 To count
ibDestroyControl(w1,z)
Next z
count = 0
Case 101
If ibMenuToggleState(w1,101)
flags = flags | @Group
Else
flags = flags & Not(@Group)
EndIf
Case 102
If ibMenuToggleState(w1,102)
flags = flags | @TabStop
Else
flags = flags & Not(@TabStop)
EndIf
EndSelect
Case @IDMouseMove
' SetCaption w1,"x "+Str$(@MouseX)+"    y "+Str$(@MouseY)
Case @IDCloseWindow
CloseWindow w1
EndSelect
Return
EndSub

Sub cback(x:Int,y:Int,w:Int,h:Int),Int
Move w1,0,0
Print w1,x
Print w1,y
Print w1,w
Print w1,h
Print w1,"     "

' If w > 299
' Return 0 :' exit the ibMouseFocusRect function if w > 299
' EndIf

' although we exit here at > 299 the width that is returned from ibMouseFocusRect
' will more than likely be wider than 300 because the dragging is still being
' performed during this call back function

Return 1 :' must return 1 to continue
EndSub