|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Picture Box QuestionI have bunch of pictures that I load and all are different sizes. Is there
a way to resize the picture box to the size of the picture? Thanks "Ron" <pleasespamme@spam.com> wrote: In the properties of the picture box, set the AutoSize property to True. Or,> I have bunch of pictures that I load and all are different sizes. Is there > a way to resize the picture box to the size of the picture? if you want to do it by code, Picture1.AutoSize = True > I have bunch of pictures that I load and all are different This code should do what you want and handle all possible> sizes. Is there a way to resize the picture box to the > size of the picture? combinations of the BorderStyle and Appearance properties... With Picture1 .Width = .ScaleX(.Picture.Width, vbHimetric, .ScaleMode) + _ .ScaleX(2 * (1 + .Appearance) * .BorderStyle * _ Screen.TwipsPerPixelX, vbTwips, .ScaleMode) .Height = .ScaleY(.Picture.Height, vbHimetric, .ScaleMode) + _ .ScaleY(2 * (1 + .Appearance) * .BorderStyle * _ Screen.TwipsPerPixelY, vbTwips, .ScaleMode) End With Rick ROTFLMAO... I have no idea where my head was when I posted this
"solution". AutoSize... How could I have not remembered of that? Rick "Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message Show quoteHide quote news:u0zPzw2zFHA.720@TK2MSFTNGP15.phx.gbl... > > I have bunch of pictures that I load and all are different > > sizes. Is there a way to resize the picture box to the > > size of the picture? > > This code should do what you want and handle all possible > combinations of the BorderStyle and Appearance properties... > > With Picture1 > .Width = .ScaleX(.Picture.Width, vbHimetric, .ScaleMode) + _ > .ScaleX(2 * (1 + .Appearance) * .BorderStyle * _ > Screen.TwipsPerPixelX, vbTwips, .ScaleMode) > .Height = .ScaleY(.Picture.Height, vbHimetric, .ScaleMode) + _ > .ScaleY(2 * (1 + .Appearance) * .BorderStyle * _ > Screen.TwipsPerPixelY, vbTwips, .ScaleMode) > End With > > Rick > > On Wed, 12 Oct 2005 16:45:24 -0400, "Rick Rothstein [MVP - Visual
Basic]" <rickNOSPAMnews@NOSPAMcomcast.net> wrote: >ROTFLMAO... I have no idea where my head was when I posted this Maybe because (like me) you been doing this since before the picbox>"solution". > >AutoSize... How could I have not remembered of that? had that prop <g> ? -Tom MVP - Visual Basic (please post replies to the newsgroup) "Tom Esh" <tjeshGibber***@suscom.net> wrote in message I admit guilt too. I did a double-take when I just opened VB, added a news:ehuqk1lhtgh9pdil08qkbor9vocdgplcm5@4ax.com... > On Wed, 12 Oct 2005 16:45:24 -0400, "Rick Rothstein [MVP - Visual > Basic]" <rickNOSPAMnews@NOSPAMcomcast.net> wrote: > >>ROTFLMAO... I have no idea where my head was when I posted this >>"solution". >> >>AutoSize... How could I have not remembered of that? > > Maybe because (like me) you been doing this since before the picbox > had that prop <g> ? picbox, and checked its properties. I thought only an Image control could resize based on the graphic (via a property setting). Just goes to show there's always more to learn. -- Mike Microsoft MVP Visual Basic
Show quote
Hide quote
"MikeD" <nob***@nowhere.edu> wrote in message Image controls have the stretch property which make the image adjust tonews:uA7TX03zFHA.1640@TK2MSFTNGP12.phx.gbl > "Tom Esh" <tjeshGibber***@suscom.net> wrote in message > news:ehuqk1lhtgh9pdil08qkbor9vocdgplcm5@4ax.com... >> On Wed, 12 Oct 2005 16:45:24 -0400, "Rick Rothstein [MVP - Visual >> Basic]" <rickNOSPAMnews@NOSPAMcomcast.net> wrote: >> >>> ROTFLMAO... I have no idea where my head was when I posted this >>> "solution". >>> >>> AutoSize... How could I have not remembered of that? >> >> Maybe because (like me) you been doing this since before the picbox >> had that prop <g> ? > > I admit guilt too. I did a double-take when I just opened VB, added a > picbox, and checked its properties. I thought only an Image control > could resize based on the graphic (via a property setting). match the control. The picturebox has the autosize which makes the control adjust to match the picture. Why they both don't have a single 'autosize' property with 0=none, 1=image to control, 2=control to image is beyond me. A little consistency woudl be nice! -- Reply to the group so all can participate VB.Net: "Fool me once..." On Wed, 12 Oct 2005 15:43:20 -0700, "Bob Butler"
<tiredofit@nospam.com> wrote: >A little consistency woudl be nice! Too late. <g>-Tom MVP - Visual Basic (please post replies to the newsgroup) "Ron" <pleasespamme@spam.com> wrote in message Yes.news:OwU4dk2zFHA.3300@TK2MSFTNGP15.phx.gbl... >I have bunch of pictures that I load and all are different sizes. >Is there a way to resize the picture box to the size of the picture? Mike "Mike Williams" <M***@WhiskyAndCoke.com> wrote in message Now THAT was helpful! I nominate you for posting the best answer of the news:dijs0h$48o$1@news8.svr.pol.co.uk... > "Ron" <pleasespamme@spam.com> wrote in message > news:OwU4dk2zFHA.3300@TK2MSFTNGP15.phx.gbl... > >>I have bunch of pictures that I load and all are different sizes. >>Is there a way to resize the picture box to the size of the picture? > > Yes. month, even the entire year! Hell, you should be an MVP based on that answer! Sarcasm aside, I suppose you did answer the question. But sheesh. You could have been more helpful than that. Why did you even bother to reply? -- Mike Microsoft MVP Visual Basic "MikeD" <nob***@nowhere.edu> wrote in message Often I write extremely long and replies, so I decided it was time for anews:eVzXV43zFHA.3180@TK2MSFTNGP14.phx.gbl... > Sarcasm aside, I suppose you did answer the question. > But sheesh. You could have been more helpful than that. > Why did you even bother to reply? short one :-) Actually, the question had already been answered and I was already on my fourth can of Bud! Mike "Mike Williams" <M***@WhiskyandCoke.com> wrote in message Bud? CAN? news:dil3tc$398$1@newsg4.svr.pol.co.uk > my fourth can of Bud! Philistine! <g> -- Reply to the group so all can participate VB.Net: "Fool me once..." "Ron" <pleasespamme@spam.com> wrote in message Picturebox controls have an AutoResize property. Problem is, there's really news:OwU4dk2zFHA.3300@TK2MSFTNGP15.phx.gbl... >I have bunch of pictures that I load and all are different sizes. Is there >a way to resize the picture box to the size of the picture? > > Thanks no control. If the picture's very large or very small, you'll have a hard time getting things to look right. If you trade the picturebox for an Image control (and set the border style to Fixed Single to make it look like a picturebox), you gain a bit of control over how things look and what size they are. Resize Image? http://groups.google.com.my/group/microsoft.public.vb.controls/browse_frm/thread/de3561568c4e26b8 -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups..
excel versions in Vb 6
Application error "Permission Denied" only under WinXP-SP2 Compile, Save, Exit, ReStart, big trouble VB6 Variable Name as String format number again Activex EXE help Dependency walker and custom ocx. Lexical analysis VB IDE Not Integrating Visual SourceSafe Problem creating dll's, using in other projects... problem when recompile dll... help please!!! |
|||||||||||||||||||||||