|
-
May 30th, 2002, 10:46 AM
#1
Thread Starter
New Member
Another Newbie Question
Using image/picture boxes to display simple BMPs I have had the following problem:
The picture will look fine on my machine, but when the software is transfered to a different machine the size of the image (with respect to the rest of the form) has changed. This is unacceptable, but I'll be derned if I can find the fix....
Help?
-
May 30th, 2002, 11:18 AM
#2
Fanatic Member
hmmm
u could have it resize the picture at startup, like so:
'use an image and set stretch to true
[Highlight=VB]
private sub form1_load
image1.left = (form1.width / (enter frm1.width on ur comp here) )_
* (enter image1.left on ur comp here)
end sub
do same theing for top, replacing width with height
this is also good if u dont know what sfcreen resoultion will be.
Don't pay attention to this signature, it's contradictory.
-
May 30th, 2002, 03:07 PM
#3
Thread Starter
New Member
image1.left = (form1.width / (enter frm1.width on ur comp here) )_
* (enter image1.left on ur comp here)
Can you explain what this line of code does? I mean, it appears to me that the quantity in parenthesis would always evaluate to 1, so image1.left would remain unchanged. I'm not saying you're wrong, I'm saying I don't get it.....
-
May 30th, 2002, 03:19 PM
#4
Good Ol' Platypus
If you want to have the Form always the exact size of the bitmap, you'd use an Image control.
VB Code:
Private Sub Form_Load()
Me.ScaleMode = vbPixels
If Me.ScaleWidth < Image1.Width Then
Do
Me.Width = Me.Width + Screen.TwipsPerPixelX
Loop Until Me.ScaleWidth = Image1.Width
Else
Do
Me.Width = Me.Width - Screen.TwipsPerPixelX
Loop Until Me.ScaleWidth = Image1.Width
End If
If Me.ScaleHeight < Image1.Height Then
Do
Me.Height = Me.Height + Screen.TwipsPerPixelY
Loop Until Me.ScaleHeight = Image1.Height
Else
Do
Me.Height = Me.Height - Screen.TwipsPerPixelY
Loop Until Me.ScaleHeight = Image1.Height
End If
Image1.Left = 0
Image1.Top = 0
End Sub
It's a bit of a roundabout way of doing it, but I don't know how the borders of the form factor into the width/height.
Enjoy!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 31st, 2002, 07:00 AM
#5
A different way:
A slightly different way, something LIKE this:
VB Code:
'only pseudo-code
Private Sub Form_Load()
ScreenX = Screen.Width
ScreenY = Screen.Height
image1.left = 1/5 * ScreenX
image1.top = 1/4 * ScreenY
image1.width = 1/2 * ScreenX
image1.height = 1/3 * ScreenY
End Sub
The top-left corner *SHOULD* be 1/5 in and 1/4 down from the top-left of the screen.
The bottom-right corner *SHOULD* be (1/5+1/2) in and (1/4 + 1/3) up from the bottom-left of the screen.
You could do this, or just resize the screen (it is possible, just don't ask me how)
-
Jun 3rd, 2002, 05:00 PM
#6
Frenzied Member
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
|