0

Using VB6

My Default Software display setting as "800 x 600"

Clients having different display setting like "800 x 600", "1366 x 768", "1280 x 768"

Client using the software more than "800 x 600" display setting means software is not fitted with full screen. Software is displaying 75% width of the monitor size.

When i manually resize the software according to the display, the images are displaying very large.

How to display the software in a full screen according to the monitor display size.

Need Code Help

Gopal
  • 11,712
  • 52
  • 154
  • 229
  • 2
    Users buy expensive large monitors to see more windows, not to see more of yours. Make your main window resizable so it works well with any size that the user prefers. Look at the way other programs do it. – Hans Passant Mar 02 '11 at 07:24
  • What do you mean by "the images are displaying very large"? Yes, when you make your application's window larger, the things it displays will become larger as well. That's the expected behavior; all the other software on your computer works the same way. Can you please explain what is *different* about your application, and what you'd like to see *instead*? – Cody Gray - on strike Mar 02 '11 at 07:47

3 Answers3

5

The simple option is to allow the users the ability to maximize your form, which will cause it to fill the entire screen, regardless of their computer's current resolution settings.

The only problem with this approach is that it won't stretch/resize the controls on your form to match its new size. The layout will look the same as it did before, but now it will be crammed into the upper-left corner, with a vast expanse of empty space below and to the right of it. So the trick is dynamically resizing the controls on your form whenever the form itself changes size.

Unfortunately, VB 6 doesn't have any built-in support for this. You have no choice but to write the code to handle resizing all of your controls yourself. The best place to do this is your form's Resize event. You can determine the current size of your form by checking its ScaleWidth and ScaleHeight properties. Each of your controls expose a similar Width and Height property that you can use to set their sizes, relative to the size of their container form. You'll need to devise some rudimentary mathematical logic to determine the sizes. A quick Google search should turn up several examples of how others have done this, but there's no shining model available.

One example can be found in e-mail programs like Microsoft Outlook. You might have a TreeView that takes up 100% of the form's height, but only 50% of its width; a ListView that takes up 50% of the form's height and 50% of its width; and a TextBox positioned under that taking up 50% of the form's height and 50% of its width. That would produce a fluid layout similar to that shown below:

--------------------------------
|              |               |
|              |               |
|              |   ListView    |
|              |               |
|              |               |
|   TreeView   |---------------|
|              |               |
|              |               |
|              |    TextBox    |
|              |               |
|              |               |
--------------------------------
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • 1
    + but use the form's `ScaleWidth` and `ScaleHeight` properties, not `Width` and `Height` – MarkJ Mar 03 '11 at 03:57
0

Just change your main form to be maximized (set the property window state to 2 - Maximized) and then make sure that any controls it contains resizes or moves as needed.

Hans Olsson
  • 54,199
  • 15
  • 94
  • 116
  • When i manually resize the software according to the display, the images are displaying very large. – Gopal Mar 02 '11 at 07:36
  • @gopal: I think you'll have to give more details about how you're displaying the images for someone to be able to advise you on how to avoid that. However, I probably won't know the answer so I'd suggest creating a new question for that specific question. – Hans Olsson Mar 02 '11 at 08:31
0

You can use the move method to resize the controls. Make use of scalewidth,scaleheight,scalemode,twipsperpixel properties while resizing.

But move method wont work correctly when resizing controls in an SSTab which needs some more effort overcome that.You can refer this

Other way is to design the forms in the least resolution (i.e 800X600) so that form will be displayed in all other resolutions.

ramu
  • 1,019
  • 3
  • 15
  • 41
  • Why would anyone still be using an `SSTab` control? Microsoft has provided their own version of this control for years, and it's a *much* better choice. (Also, since that's the only thing you've added to my answer, this should have been a comment to my answer like MarkJ's.) – Cody Gray - on strike Mar 06 '11 at 10:52
  • @Cody gray,can you please tell me what is the microsoft's version of SSTab? – ramu Mar 07 '11 at 05:40
  • It's called `TabStrip`, and provided as part of the Windows Common Controls (`MSCOMCTL.OCX`). – Cody Gray - on strike Mar 07 '11 at 06:07