|
-
Jun 16th, 2004, 10:49 AM
#1
Thread Starter
PowerPoster
Resize, scale width/height [re4solved]
VB Code:
FrmSplitted.pic.ScaleMode = 3
FrmSplitted.pic.ScaleWidth = xWidth
FrmSplitted.pic.ScaleHeight = yWidth
why does this code give me an error 'invalid property value? i need to resize a picture box how can this be done? what is the best method?
Last edited by Pino; Jun 16th, 2004 at 02:15 PM.
-
Jun 16th, 2004, 10:54 AM
#2
Ex-Super Mod'rater
Which line is the error on?
You can't do it like that....ScaleWidth & ScaleHieght are for reading from....In the Design time propertys if you change these values you will notice the ScaleMode changes to "User" which means you are setting a user defined scale. What you need to use is the frm.Width & frm.Height Propertys and the Screen.TwipsPerPixelX & Screen.TwipsPerPixelY
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jun 16th, 2004, 12:02 PM
#3
VB Code:
With FrmSplitted
.ScaleMode = vbPixels
.pic.Move .pic.Left, .pic.Top, xWidth, yWidth
End With
Scalewidth and scaleheight for pic returns the inner part of pic. So if you change the scalemode of pic, you change how values are displayed in pic's inner sizes. So instead of changing pic's scalemode, we change pic's host's scalemode and then resize pic according to this. There is an alternative method though...
VB Code:
With FrmSplitted
.pic.Move .pic.Left, .pic.Top, .ScaleX(xWidth, vbPixels, .ScaleMode), .ScaleY(yWidth, vbPixels, .ScaleMode)
End With
Above code will convert pixels to the current used Scalemode of pic's host. Hope this helps
-
Jun 16th, 2004, 12:11 PM
#4
Ex-Super Mod'rater
I'm sure just using the TwipsPerPixel is just as easy though 
VB Code:
frmMain.Width = iWidth *Screen.TwipsPerPixelX
frmMain.Height = iHeight *Screen.TwipsPerPixelY
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jun 16th, 2004, 12:12 PM
#5
But it doesn't work if ScaleMode is set to something else than vbTwips Move command is also two times faster than doing Width and Height calls separately.
-
Jun 16th, 2004, 12:24 PM
#6
Ex-Super Mod'rater
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jun 16th, 2004, 12:28 PM
#7
He is clearly using a picturebox on a form here, so you're kind of talking about the wrong thing I do know this and I also know Scales are not supported by Screen and that you need to use TwipsPerPixel to place form correctly to the screen (though I've rarely had any use for this).
-
Jun 16th, 2004, 12:36 PM
#8
Ex-Super Mod'rater
Doh!!!, I didn't see the .pic. part .
In that case shouldn't this work:
VB Code:
FrmSplitted.ScaleMode = 3
FrmSplitted.pic.Width = xWidth
FrmSplitted.pic.Height = yWidth
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jun 16th, 2004, 12:36 PM
#9
Thread Starter
PowerPoster
Thanks Fellers
[Resolved]
Before these two start arguing
-
Jun 16th, 2004, 12:37 PM
#10
Thread Starter
PowerPoster
Originally posted by Electroman
Doh!!!, I didn't see the .pic. part .
In that case shouldn't this work:
VB Code:
FrmSplitted.ScaleMode = 3
FrmSplitted.pic.Width = xWidth
FrmSplitted.pic.Height = yWidth
nope that doesnt work thats why i posted
-
Jun 16th, 2004, 12:41 PM
#11
It does work, and that's my first suggestion (vbPixels = 3, but you should always use these predeclared variables to keep code more readable).
-
Jun 16th, 2004, 12:44 PM
#12
Ex-Super Mod'rater
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

-
Jun 16th, 2004, 12:46 PM
#13
Ex-Super Mod'rater
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|