Im trying to make it so if Canvas1 in window1 has a picture in it, display that same file in window2 canvas1 . how can i get it to mirror canvas1 on window1?
Define picture objects that contains the images in your environment and set both Canvases’ BackDrop to the same Picture.
what if i need the items to scale to fit . im doing this so when the user clicks on the picture it opens a new window “Preview” and displays the image in a much larger canvas. can you show me an example ?
[quote]when the user clicks on the picture it opens a new window “Preview” and displays the image in a much larger canvas.
There are tidier ways, but:
Assuming the picture being shown in canvas1 is called BunnyPic (for example)
Add a modal window frmPreview to the project
Give it the much larger canvas.
Add a property ‘the pic’ as global to the window
Add g.drawpicture thepic, 0,0,g.width,g.height,0,0,thepic.width,thepic.height to the canvas’ Paint event
In the MouseDown event of the first canvas, add this:
dim f as new frmPreview
f.thepic = BunnyPic
I used modal so that the source image doesn’t go out of scope if the main window closes and the preview window remains.
Better might be to have BunnyPic as an app - level variable so that they both use the same image independently
@Travis McBride - the key to scaling are the values passed to the DrawPicture method. Take a look at the docs for the Graphics.DrawPicture Method. There are some good examples there.