Learn how to a build a cloud-first strategyRegister Now



Posted on 2006-05-08
Medium Priority
Last Modified: 2010-05-18
Hi guys!

I have a form with a width of 15420. This form contains a Picturebox, which width is 865, but the problem is both window and Picturebox have almost the same width. Somehow they have a different scale.

I tried modifying the Scalemode property, but nothing changes.

What I need is the Picturebox to addapt its size every time the form is resized, but with these different scales I don't know how to do that.

Any ideas?

Question by:pvg1975
  • 2

Author Comment

ID: 16632201
Other controls as Shape, Texbox, etc have the right scale (as the form width): 14564, 8334, 2245, etc but the Pictureboxes!
LVL 13

Accepted Solution

rettiseert earned 2000 total points
ID: 16632598

Check that all your controls have the scalemode

Your picturebox may be inside another picturebox or inside a frame with a different scalemode than the one in the form
LVL 13

Expert Comment

ID: 16634520
Your form uses a unit called twip, where the picturebox is using the pixel unit. Usually 15 twip = 1 pixel.
There are several ways to solve this problem

- You can set the picturebox scalemode = twip so the unit used by the picturebox is the same as the one used by the form.
This sollution is simple in theory but if you have coded other functions that considers the picturebox unit is pixel you'll have to modify these functions. This mission may get you into a lot of mess, so if that is your situation consider the next sollution.

- You can set the form scalemode = pixel
to read the width property of the form:
    Dim PixWidth as integer
    PixWidth = Me.ScaleWidth

to set the form's width:
    Me.Width = 100 * Screen.TwipsPerPixelX ' this is equevelant to 100 pixels

NOTE: Parent scalemode property overrides child scalemode property

Author Comment

ID: 16636067
Thanks guys!

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question