Question about Image well and picture size:
What happens when you have a picture bigger than the size of the Image well box?
I know that scroll bars do not appear. How do I display the part of the pictures that do not show in an Image Well since you can’t scroll to those parts of the picture you cannot see?
What I want to do is to be able to use my mouse wheel to enlarge or shrink my picture and drag my picture so I can see other parts of the picture.
Or Is there another object I can use to do this. either way I will need some programming examples to do it
Canvas is the only way to do this. The great thing is that the Canvas lets you do everything. The drawback to the Canvas is that you have to code everything. AFAIK there’s no 3rd party control that does what you’re asking.
FWIW, none of these actions are very hard to do and it’s good practice to know how to manipulate the Graphics content in the Canvas.Paint event since it’s used in many places for various things.
Trust me… Bob (or most anyone else here) would not suggest something that won’t work, and will usually lead to a learning experience that will help you now and in the future.
It is possible (but perhaps beyond the present scope of you knowledge) to create a custom class based on the CANVAS control the WILL incorporate some of the features of the ImageWell and retain the massive flexiblity of the Canvas.
I personally have been using RealBasic/RealStudio/Xojo since 2006 and can honestly say I have NEVER used an ImageWell in a single project, but do use Canvas in almost all of them
It takes me a while to pick up things as I’m not to quick on the uptake anymore either and I’m easily confuse so it’s going to take me a few days to figure put what is going on,
Tim has been very help full with the link he provided and I’m going to study that and hope it helps
Dave
PS someone just invited me to join an Image well replacement but it disappeared before I could click on it.
[quote=446219:@David Howe]Question about Image well and picture size:
What happens when you have a picture bigger than the size of the Image well box?[/quote]
You may resize down the original image file and use the smaller one into the ImageWell. Or
Use a different Control. Read below
[quote=446219:@David Howe]What I want to do is to be able to use my mouse wheel to enlarge or shrink my picture and drag my picture so I can see other parts of the picture.[\quote]
You have work on your plate coding that.
Yes, as already stated, you can use a Canvas Control.
BUT:
You have to read the documentation to achieve your goal. Specifically, you have to:
a. Put a Canvas using the size you need in a Window,
b. Load the image,
c. Resize down * the image
d. Display it in the Canvas
happens when the canvas is asked to repaint
You get G as a parameter - this is a graphics object, you can draw what you like on it
.drawpicture to add a picture , at whatever zoom or scroll position you want.
if you add the mousewheel event, you can ‘know’ that someone wants to zoom in or out, set properties about zoom size, then call canvas.invalidate
when the canvas paints next, those properties will tell you how big to draw the picture
Thanks for all the help. That is what I really like about this forum. You not only try to help a me but you force me to think outside the box (as my wife is always telling me) and after a good nights sleep I have come up with a plan of action.
I’m a programmer by necessity not choice and I really have a hard time learning to code something new. That’s why I need examples.
My problem with last night is that I did Not realize that the image well resizes and or crops a picture so what I do now when I run into a picture that has been cropped is to SHELL the original picture into PAINT and my problem is solved.
I realized that I was trying to build my own version of the view options that PAINT gives me. So why NOT use Paint.
Without the help I got here I would never have realize how easy it was to fix my problem.
Thanks
Dave
Dave I’m sorry I though I posted this yesterday but here is the code you wanted to see.
I put this button in my Image well form (or window) so when I load a pictures (or chart, or map etc) into my image well and it looks distorted or parts of the image are cut off I can just push the paint button and I’m taken to paint and can enlarge the picture and/or edit the picture if I need to.
This works really well on charts or maps where I want to highlight the item I want people to see.
And the other thing is that I don’t have to learn all the ins and outs of canvas but when I have some time I can come back to this post and study it.
'MsgBox “At Button Paint”
Dim s As Shell
s = New Shell #If TargetWin32 Then
str__PathToProgramWanted = “%windir%\system32\mspaint.exe”
'MsgBox "str__PathToProgramWanted is: " + str__PathToProgramWanted
'MsgBox "str__AbsoultePathToPicture is: " + str__AbsoultePathToPicture
s.Execute(str__PathToProgramWanted, str__AbsoultePathToPicture) #Elseif TargetMacOS Or TargetLinux Then
s.Execute(“ls -la”) 'not used by me as it’s not a windows operation #Endif
If it hadn’t been for this post I would never come up this this solution
So I’m really thankful for all the help I’ve been given
Dave