Search:
Namespaces
Discussions
.NET v1.1
Feedback
Fit large picture in PictureBox
Messages
Related Types
This message was discovered on
microsoft.public.dotnet.languages.vb
.
Post a new message to this list...
Dick
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
Reply to this message...
Cor Ligthert
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/frlrfsystemwindowsformspictureboxclasssizemodetopic.asp
I hope this helps?
Cor
[Original message clipped]
Reply to this message...
Dick
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" <
Click here to reveal e-mail address
> wrote in message
news:
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Cor Ligthert
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
[Original message clipped]
Reply to this message...
Dick
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" <
Click here to reveal e-mail address
> wrote in message
news:
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
Jorge
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 clipped]
us/cpref/html/frlrfsystemwindowsformspictureboxclasssizemo
detopic.asp
[Original message clipped]
Reply to this message...
Dick
I will try it.
Thanks.
"Jorge" <
Click here to reveal e-mail address
> wrote in message
news:8dd901c4966e$5de8e6d0$
Click here to reveal e-mail address
...
[Original message clipped]
Reply to this message...
System.Drawing.Image
System.IntPtr
System.Web.UI.MobileControls.Image
System.Windows.Forms.MessageBox
System.Windows.Forms.MessageBoxButtons
System.Windows.Forms.MessageBoxDefaultButton
System.Windows.Forms.MessageBoxIcon
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com