Panel with picturebox scrollbar

T

Thiru .Net

hi wagner,
i have a doubt in panel control in windows application.

i have a panel control wherein i have put a picturebox control.
i show picture into picturbox control.

now i need to zoom in and zoom out the picture in the picturebox
control.
the picturebox control is within panel(autoscroll is enabled true)
scroll bars are enabled.

PictureBox1.Width = PictureBox1.Width + 25
PictureBox1.Height = PictureBox1.Height + 25

the problem is the picture goes only to right side when it gets its size
enlarged.

then i used left and top properties

PictureBox1.Width = PictureBox1.Width + 25
PictureBox1.Height = PictureBox1.Height + 25
PictureBox1.Left = PictureBox1.Left - 20
PictureBox1.Top = PictureBox1.Top - 5

the above code streched the picture both left and right side...but the
problem is i can scroll right side and see the picture but i could not
scroll left side to see picture streched on the left side.

i need to strech and zoom in and out both sides and should be viewed
thru scrollbars both sides using panel.

thanks in advance,

regards,
Thiru.



Regards,
Thiru.S
 
C

Cor Ligthert [MVP]

Hi,

Will you be so kind not to address messages to certain people active in this
newsgroup, especially not in this impolite way.

If you want to refer to another message, than connect it as a reply to the
message from the one who has answered you.

What your ask is AFAIK not not standard, however I *thought* that there is
in the 101 samples (advanced GDI) one that shows what you want to do.

http://www.microsoft.com/downloads/...F8-033D-420B-A3B1-3074505C03F3&displaylang=en

I hope this helps,

Cor
 
T

Thiru .Net

Hi cor,
i regret if u felt my mail to be impolite way. actually by mistake i
sent that mail in general.. i thought of sending thru thread messages.

that is why i addressed it to a particular person in the group.

anyways i regret for it.




Regards,
Thiru.S
 
H

Herfried K. Wagner [MVP]

Thiru .Net said:
i have a doubt in panel control in windows application.

i have a panel control wherein i have put a picturebox control.
i show picture into picturbox control.

now i need to zoom in and zoom out the picture in the picturebox
control.
the picturebox control is within panel(autoscroll is enabled true)
scroll bars are enabled.

PictureBox1.Width = PictureBox1.Width + 25
PictureBox1.Height = PictureBox1.Height + 25

the problem is the picture goes only to right side when it gets its size
enlarged.

I am not able to repro the problem using .NET 1.1 and the code mentioned
above.
 
T

Thiru .Net

below is the actual code i tried. pls try this...
-------------------------------------------

Public Class Form1
Inherits System.Windows.Forms.Form

Private Sub btnZoomOut_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnZoomOut.Click
PictureBox1.Width = PictureBox1.Width + 100
PictureBox1.Height = PictureBox1.Height + 75
PictureBox1.Left = PictureBox1.Left - 50
PictureBox1.Top = PictureBox1.Top - 20
End Sub

Private Sub btnZoomIn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnZoomIn.Click
PictureBox1.Width = PictureBox1.Width - 25
PictureBox1.Height = PictureBox1.Height - 25
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage

End Sub

Private Sub PictureBox1_MouseUp(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles
PictureBox1.MouseUp
PictureBox1.Width = PictureBox1.Width + 100
PictureBox1.Height = PictureBox1.Height + 100
End Sub

Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnBrowse.Click
OpenFileDialog1.ShowDialog()
PictureBox1.Image =
System.Drawing.Image.FromFile(OpenFileDialog1.FileName)
TextBox1.Text = OpenFileDialog1.FileName
End Sub
End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top