Link to home
Start Free TrialLog in
Avatar of majala
majala

asked on

forms width property

I try to put forms widht property value 20000 but it takes only values up to 18000. Is there some kind of limit to this value or setting which puts limit to that value??

Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of wsh2
wsh2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcrider
mcrider

Yes, it has to do with your screen resolution size. Forms can only be as big as the Screen.Width + about 180 twips.

If you change your screen resolution, the maximum form width will change.


Cheers!®©
Now, for a more advanced technique, if you would like a little more performance out of the above example, use the Move method to save the program from having to execute extra Resize events.. (the parameters in the Move method are Left, Top, Width, Height)

Me.Move _
    (Screen.Width * .1, _
    Screen.Height * .1, _
    Screen.Width * .8, _
    Screen.Height * .8)

Avatar of Ark
Hi
It means that you have good display with 1200 pixels (18000/15) horizontal screen resolution.
Cheers
Avatar of majala

ASKER

I did it like this (I wanna my form to fill whole screen):

    Left = 0
    Top = 0
    Width = Screen.Width
    Height = Screen.Height

but somehow my forms width isn't even near to screens width? Height worked OK.
After the Form_Load.. are you changing Form.Width anywhere else? Perhaps in your Form_Resize procedure? Call up your Code Window, and then do a Find on the word Width.. because somewhere else in your program (after Form_Load) you are changing it.

Trust me on this.. Screen.Width works.. <smile> and a <wink>.
Avatar of majala

ASKER

I don't have any problems to trust you on this :) and normally this has worked OK but I don't know why it isn't working now like it has before.
Even if I'm on forms design window I can't stretch my form more than width 17700. My screen resolution is 1280x1024.
I checked that I don't set that forms width property anywhere else than forms load procedure.
Avatar of majala

ASKER

If I change my screen resolution to 1600x1200 and reboot my machine and then tretch form, it works OK
mcrider --
You say forms can only be about as big as your screen resolution, plus about 180 twips. Is this a design-time limitation, or a run-time limitation?

I have good eyes, so I tend to keep my screen resolution pretty high.

I'm writing a program that calls up a form that then prints on 8.5 by 11-inch paper. (I've got a routine that prints it landscape, thanks to an earlier post here.) The form pretty much fills the paper (form size ~ 9.5 by 7.5 inches), and I haven't had a problem getting it to work on my computer. I've also had it work on two other computers it's been tested on, but they were both set to pretty high screen resolution, too.

If I get someone running a 640 by 480 screen, is this going to not work?

The form is not resized at run-time. Nor is it ever rendered for the screen. Its form load event loads data into about 200 fields, executes the print routine, and unloads the form.

You've got me worried now...

Thanks
You said:

  "You say forms can only be about as big as your screen resolution, plus about 180 twips. Is this a design-time limitation, or a run-time limitation?"

The answer is BOTH!

A form can only be as wide as the screen.width property + 180 twips in both design and runtime.... HOWEVER...

Pictureboxes can be as wide as you want.  What you can do is put everything in a picturebox and use scrollbars to move the image around.

Normally this requires 2 pictureboxes. One is the "View Port" and the other contains the image and is a child of the first picturebox.  You then use the scrollbar to adjust the top and left of the image...

If this helps you, please reject the current answer and select this comment as the answer....


Cheers!®©
majala -- sorry to piggyback on your question like this, but hopefully the answers I'm getting will be helpful to you, too.

mcrider --

If I have all my stuff in pictureboxes, wouldn't my whole form print _as a picture_? This wouldn't do for me, because I have some fairly small type on the form (as small as 7 point), which doesn't render well as a graphic.

That's why I chose to go with a pain-in-the-tush routine for printing my forms landscape (courtesy of roverm) rather than the Micro$oft-recommended method of dumping things into a picturebox in the first place.

(It will cost you 20 points in PAQ to read through the exchange I had with roverm, but here's the link: https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10265730 
I can save you some points, if you don't need to see all the text but want his answer. We exchanged e-mails and he sent a project to me that had the code in it. The code from the project is *NOT* listed in the above question, but my e-mail address is, and I'll gladly forward the project to anyone who asks for it. Just ask at barrytice@hotmail.com.)

Unfortunately, I'm fairly new to VB, and self-taught (though I used to be about as good as anyone at Applesoft, on my Apple ][+, in the early '80s). So there's a heck of a lot I don't understand about how what roverm sent me works.

Is there no means around this size limitation that doesn't require rendering the form as a picturebox, mcrider?

b.r.t.

p.s. Come up with one and I'll post you some points, too.
BarryTice,

I didn't realize that you didn't ask the question... Piggybacking... UUgh!

Sorry majala, but here goes the answer to Barry's question:

I am assuming that you are using:

   Form.Print "some text"

to build your screen.  If you are, you can use the same routine you used to print on the form to print to the printer... With a few minor adjustments.  For example, lets say you have the following subroutine to print:

'-------------------------------------------------------------------------------
    Sub PrintTheScreen(lObject As Object)
        Dim IsPrinter As Boolean
        'SEE IF THE PASSED OBJECT IS THE PRINTER
        If lObject.hDC = Printer.hDC Then
            IsPrinter = True
            'SET YOUR PRINTER ATTRIBUTES HERE
            'LIKE:  Printer.Orientation = vbPRORLandscape
        End If
        'PRINT YOUR STUFF TO THE OBJECT
        With lObject
            .CurrentX = 200
            .CurrentY = 200
            .FontSize = 12
            lObject.Print "Hello World"
            .FontSize = 7
            .CurrentX = 200
            lObject.Print "This is a test"
           
            'If the object is the printer, do the EndDoc
            If IsPrinter = True Then .EndDoc
        End With
    End Sub
'-------------------------------------------------------------------------------


You can then call the subroutine like this to print to the form:

   PrintTheScreen Form1
 
You can call the same subroutine to print to a picturebox that is scrolled:

   PrintTheScreen Picture1

AND... You can send the stuff to the printer like this:

   PrintTheScreen Printer


That should be worth some points! ;-)



Cheers!®©
mcrider --

Normally I'm not keen on piggybacking, but I felt my question relates to majala's as well.

I'm about to post a new question in the VB area wherein we can continue this, if you would be so kind.


majala -- Thanks for the hospitality! Sorry to barge in!

-- b.r.t.
mcrider -- I've posted this in its own thread at the following address:
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10308833 

I added a lot of background about the code provided by roverm for printing forms landscape, so it's a doozy to read through. Thanks for any help!
majala -- Erick37 posted a solution for me that will probably work for you, too. Here's the beginning of his text:

<====Start copy====>
You can make the form any size you want.  Windows has a MINMAXINFO structure which holds info regarding a window's minimum and maximum sizes.  By subclassing your form, you can intercept the WM_GETMINMAXINFO message and then set the max size to whatever you like.  Then you will be able to set the form's width and height beyond the screen.

Example:

"HOWTO: Limit a Window's Minimum and Maximum Size"
                     http://support.microsoft.com/support/kb/articles/Q185/7/33.ASP
<====End copy====>

There are additional comments posted about how this is used later in the thread of my question. Click the link above to follow it all.

If his answer works for you, you might consider throwing a few points his way, in addition to whatever you award to the people who have responded here!

-- b.r.t.