By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,610 Members | 1,601 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,610 IT Pros & Developers. It's quick & easy.

Fit large picture in PictureBox

P: n/a
Hello,

In my application I have a picturebox that must contain previews of picture
files. The picturebox must always have the same size. For small images
that fit, everything is ok.

How can I fit in larger pictures?
(Ideally would be that the picture is centered and fit in the box)

Is this possible with the standard control?
(if not, are there other controls who can do it out there?)

Tia
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Dick,

The picturebox has in my opinion although it derives from control the most
special properties, one of them is

sizemode
http://msdn.microsoft.com/library/de...emodetopic.asp

I hope this helps?

Cor

In my application I have a picturebox that must contain previews of picture files. The picturebox must always have the same size. For small images
that fit, everything is ok.

How can I fit in larger pictures?
(Ideally would be that the picture is centered and fit in the box)

Is this possible with the standard control?
(if not, are there other controls who can do it out there?)

Tia

Nov 21 '05 #2

P: n/a
Thanks for the answer, but that doesn't do the trick with pictures that are
larger than the control itself.
The only that works is sizemode 'StretchImage', but then the image is
deformed.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:On**************@TK2MSFTNGP15.phx.gbl...
Dick,

The picturebox has in my opinion although it derives from control the most
special properties, one of them is

sizemode
http://msdn.microsoft.com/library/de...emodetopic.asp
I hope this helps?

Cor

In my application I have a picturebox that must contain previews of

picture
files. The picturebox must always have the same size. For small images
that fit, everything is ok.

How can I fit in larger pictures?
(Ideally would be that the picture is centered and fit in the box)

Is this possible with the standard control?
(if not, are there other controls who can do it out there?)

Tia


Nov 21 '05 #3

P: n/a
Dick,

It does a scrollbar will come up in your form when that is, depending on the
setting of course assuming you did not only look to StrechImage.

Cor
Thanks for the answer, but that doesn't do the trick with pictures that are larger than the control itself.
The only that works is sizemode 'StretchImage', but then the image is
deformed.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:On**************@TK2MSFTNGP15.phx.gbl...
Dick,

The picturebox has in my opinion although it derives from control the most special properties, one of them is

sizemode

http://msdn.microsoft.com/library/de...emodetopic.asp

I hope this helps?

Cor

In my application I have a picturebox that must contain previews of

picture
files. The picturebox must always have the same size. For small images that fit, everything is ok.

How can I fit in larger pictures?
(Ideally would be that the picture is centered and fit in the box)

Is this possible with the standard control?
(if not, are there other controls who can do it out there?)

Tia



Nov 21 '05 #4

P: n/a
A scrollbar will come up in you form:
So the control itself is resized I assume (made bigger).

I want the control to be the same size all the time and the image inside
resized with no deformation if that's possible.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OC**************@TK2MSFTNGP11.phx.gbl...
Dick,

It does a scrollbar will come up in your form when that is, depending on the setting of course assuming you did not only look to StrechImage.

Cor
Thanks for the answer, but that doesn't do the trick with pictures that

are
larger than the control itself.
The only that works is sizemode 'StretchImage', but then the image is
deformed.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:On**************@TK2MSFTNGP15.phx.gbl...
Dick,

The picturebox has in my opinion although it derives from control the most special properties, one of them is

sizemode

http://msdn.microsoft.com/library/de...emodetopic.asp

I hope this helps?

Cor

>
> In my application I have a picturebox that must contain previews of
picture
> files. The picturebox must always have the same size. For small images > that fit, everything is ok.
>
> How can I fit in larger pictures?
> (Ideally would be that the picture is centered and fit in the box)
>
> Is this possible with the standard control?
> (if not, are there other controls who can do it out there?)
>
> Tia
>
>



Nov 21 '05 #5

P: n/a
Hi Dick
I use the following to resize the image when its too big
to fit in the picturebox.

Dim caminho As String
Dim imagem As Image
Dim vista_reduzida As Image
Dim a As System.Drawing.Image.GetThumbnailImageAbort
Dim b As System.IntPtr

Try
imagem = imagem.FromFile(caminho)

Dim resolucao_V As Single = imagem.Width
Dim resolucao_H As Single = imagem.Height
If resolucao_H > 992 And resolucao_V > 712 Then
vista_reduzida = imagem.GetThumbnailImage(992, 712,
a, b)
Me.PictureBox1.Image = vista_reduzida
Else
Me.PictureBox1.Image = Image.FromFile(caminho)
End If

Catch ex As Exception
MessageBox.Show(ex.Message, "SIGDIN",
MessageBoxButtons.OK, MessageBoxIcon.Error,
MessageBoxDefaultButton.Button3)
End Try

Kind Regards
Jorge
-----Original Message-----
A scrollbar will come up in you form:
So the control itself is resized I assume (made bigger).

I want the control to be the same size all the time and the image insideresized with no deformation if that's possible.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OC**************@TK2MSFTNGP11.phx.gbl...
Dick,

It does a scrollbar will come up in your form when that is, depending on
the
setting of course assuming you did not only look to

StrechImage.
Cor
> Thanks for the answer, but that doesn't do the trick with pictures that
are
> larger than the control itself.
> The only that works is sizemode 'StretchImage', but
then the image is > deformed.
>
> "Cor Ligthert" <no**********@planet.nl> wrote in message > news:On**************@TK2MSFTNGP15.phx.gbl...
> > Dick,
> >
> > The picturebox has in my opinion although it derives from control the most
> > special properties, one of them is
> >
> > sizemode
> >
>

http://msdn.microsoft.com/library/default.asp?

url=/library/en-
us/cpref/html/frlrfsystemwindowsformspictureboxclasssizemo
detopic.asp > >
> > I hope this helps?
> >
> > Cor
> >
> > >
> > > In my application I have a picturebox that must contain previews of > > picture
> > > files. The picturebox must always have the same size. For small
images
> > > that fit, everything is ok.
> > >
> > > How can I fit in larger pictures?
> > > (Ideally would be that the picture is centered

and fit in the box) > > >
> > > Is this possible with the standard control?
> > > (if not, are there other controls who can do it out there?) > > >
> > > Tia
> > >
> > >
> >
> >
>
>


.

Nov 21 '05 #6

P: n/a
I will try it.
Thanks.

"Jorge" <an*******@discussions.microsoft.com> wrote in message
news:8d****************************@phx.gbl...
Hi Dick
I use the following to resize the image when its too big
to fit in the picturebox.

Dim caminho As String
Dim imagem As Image
Dim vista_reduzida As Image
Dim a As System.Drawing.Image.GetThumbnailImageAbort
Dim b As System.IntPtr

Try
imagem = imagem.FromFile(caminho)

Dim resolucao_V As Single = imagem.Width
Dim resolucao_H As Single = imagem.Height
If resolucao_H > 992 And resolucao_V > 712 Then
vista_reduzida = imagem.GetThumbnailImage(992, 712,
a, b)
Me.PictureBox1.Image = vista_reduzida
Else
Me.PictureBox1.Image = Image.FromFile(caminho)
End If

Catch ex As Exception
MessageBox.Show(ex.Message, "SIGDIN",
MessageBoxButtons.OK, MessageBoxIcon.Error,
MessageBoxDefaultButton.Button3)
End Try

Kind Regards
Jorge
-----Original Message-----
A scrollbar will come up in you form:
So the control itself is resized I assume (made bigger).

I want the control to be the same size all the time and

the image inside
resized with no deformation if that's possible.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OC**************@TK2MSFTNGP11.phx.gbl...
Dick,

It does a scrollbar will come up in your form when that is, depending on
the
setting of course assuming you did not only look to

StrechImage.
Cor

> Thanks for the answer, but that doesn't do the trick with pictures that are
> larger than the control itself.
> The only that works is sizemode 'StretchImage', but then the image is > deformed.
>
> "Cor Ligthert" <no**********@planet.nl> wrote in message > news:On**************@TK2MSFTNGP15.phx.gbl...
> > Dick,
> >
> > The picturebox has in my opinion although it derives from control the most
> > special properties, one of them is
> >
> > sizemode
> >
>

http://msdn.microsoft.com/library/default.asp?

url=/library/en-
us/cpref/html/frlrfsystemwindowsformspictureboxclasssizemo
detopic.asp
> >
> > I hope this helps?
> >
> > Cor
> >
> > >
> > > In my application I have a picturebox that must contain previews of > > picture
> > > files. The picturebox must always have the same size. For small images
> > > that fit, everything is ok.
> > >
> > > How can I fit in larger pictures?
> > > (Ideally would be that the picture is centered and fit in the box) > > >
> > > Is this possible with the standard control?
> > > (if not, are there other controls who can do it out there?) > > >
> > > Tia
> > >
> > >
> >
> >
>
>

.

Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.