Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
GDI over Picture
Hi
I currently use the OI bitmap control to have an image, which I then use the GDI to draw on, essentially as an overlay.
This does not support zoom/pan.
I tried the SRP picture control, and this clears any GDI as soon as the mouse moves over it.
Also the cursor changes to a 'grab' when panning.
Is it possible to a) allow the GDI to remain on top, and b) allow control of the cursor, eg to keep as a crosshair.
Don, if not possible, but is feasible, please Email me with approximate costs.
Colin
I currently use the OI bitmap control to have an image, which I then use the GDI to draw on, essentially as an overlay.
This does not support zoom/pan.
I tried the SRP picture control, and this clears any GDI as soon as the mouse moves over it.
Also the cursor changes to a 'grab' when panning.
Is it possible to a) allow the GDI to remain on top, and b) allow control of the cursor, eg to keep as a crosshair.
Don, if not possible, but is feasible, please Email me with approximate costs.
Colin
Comments
What is it you are drawing? Given that you are changing the cursor, can I assume you are requiring some dynamic interaction? I started to add an event that would allow you to draw on the Picture, but only when the Picture itself redraws. Do you need something that allows you to redraw more often than that?
This is done by defining ground level points, and depths, and with clever mathematics it calculates the results and displays on screen. See two screen shots following.
The drawing currently on these screens is just a plain white image, set to stretch.
This can be replaced by an actual drawing image, allowing the user to click the mouse to create the ground level points, and the building site excavation areas. The other method of doing this is via a hard copy (say A1) drawing, and a digitiser.
I use calls to GDI.DLL to draw on the image, so that when the user clicks, resizes, etc, then the screen is refreshed.
On the assumption that I could call a method to redraw the picture after each action, then this might suffice.
The aim here is to allow the user to pan/zoom, and then use my GDI calls.
I should be able to use the results from the pan and zoom to recalculate my results and display.
Colin
While allowing you to draw on the surface of the SRP Picture Control is a possibility, it's also worth noting that the SRP Picture Control supports EMF files, which you create using the same GDI calls. You'd have to update the file when the user makes changes (and reloading it into the SRP Picture Control), but you gain the advantage of not having to scale your code because the SRP Picture Control will do all that for you, and at top speeds.
It looks like what you are really after is a kind of "canvas" control where you simply add shapes and text and respond to mouse clicks. The SRP Picture Control falls a bit short and the SRP Sketch Control is probably too much.
At any rate, the next release (which will come out any day now) will have a new event called OnCustomDraw, which will pass to you the DC handle, but you'll have to use that event synchronously because the handle is to a background DC. All SRP Controls are double buffered to prevent flickering. I'll explain it in the documentation.
The EMF is interesting, I will need to check that out.
Problem is that users will have all sorts of imagfe formats, but I note there are free converters about the place which would assist in this. Then the original image wont be affected/modified.
I will have a play with the new event, and DC handle and see what it brings.
Colin
Cheers, M@
Let me know what you are trying to achieve, never know there might be some thoughts I can offer.
Colin
The SRP Sketch control looks closer, but I need to be able to draw icons and shapes programmatically on a picture background.
Please Email me and we can discuss outside of the forum
Colin.Rule@cssp.co.uk