Re: Re-size Print Preview

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Jim Y" <j.s.yablonsky@xxxxxxxxxxxxxx> wrote in message
news:UYYYe.302042$5N3.18508@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

> I have a test program that permits display of the form (preview) at full
> size using a PictureBox on the screen. So far so good - it works. What
> must I do to permit the user to enlarge the display if something is too
> small to be read and they want enlarge it? What must I do to permit the
> user to reduce the display and view the entire page on the screen?

There are at least three (probably more than three) different ways of doing
this, and they all have their advantages and disadvantages. A simple
StretchBlt of your picture box image is one way that would enable you to
make the size anything you want, but I would definitely advise that you
should *not* use that method in your specific case (too much loss of detail
because of the very limited resolution of the original "image"). Of the
other two methods that I have in mind, one would permit very easy scrolling
of a "magnified or enlarged" image (in much the same way as you are
presumably currently crolling the full size page) and the other one would
make such scrolling more difficult (as far as the amount of code is
concerned) to accomplish. Much depends on how much magnification you wish to
provide. The "harder to implement" method would permit almost limitless
magnification, but if you are happy with up to two or three times the width
and two or three times the height then you can use the easier method. That's
quite a large magnification when you see it in practice, and it makes it
possible to fairly comfortably read text as small as 3 points in size. In
fact, even a 200 percent magnification makes it possible to read 4 point
text, and such a magnification (using the method I have in mind) would
require a contiguous block of memory of only about 13 megabytes for your
autoredraw picture box, an amount that is always available even on very low
end systems.

Basically what you do is create your picture box and set its ScaleWidth to
8.5 and its ScaleHeight to 11 and you use coordinates for your drawings and
text as though those units are inches (even though they are not). The actual
size of the picture box (Width and Height) does not matter. It can be almost
anything you wish. If you want it to display the page at "full size" (as you
currently seem to be doing) then you also set the Width and the Height to
8.5 and 11 respectively, first making sure that you set it's "container's"
Scalemode, at least temporarily, to vbInches. The "container" could either
be a Form or perhaps another Picture Box (I would suggest the latter). You
will of course need to maintain a variable of type Single (let's call it
"magnification") and in this case (full size page) you would set
"magnification = 1".

If instead you wanted a "200 per cent magnified page" you would set the
picture box Width and Height properties to 17 and 22 respectively, again
making sure that it's "container's" ScaleMode is vbInches when you do so but
you still set the ScaleWidth to 8.5 and the ScaleHeight to 11. Then you set
the variable "magnification" to 2. You will, of course, have to provide the
user with a facility to "scroll the very large page" within its container so
that he can see the various parts of it, but I notice that you already seem
to have provided such a facility for the vertical direction so it obviously
won't be any trouble for you to do the same for the horizontal direction as
well.

Alternatively, if you wanted a "smaller than full page" size (so that you
could fit the entire page onto the screen regardless of the user's display
size and resolution) you would set the picture box Width property to 8.5 *
0.7 and its Height property to 11 * 0.7 and you would set the variable
"magnification" to 0.7 also. Again, you would set the ScaleWidth to 8 and
the ScaleHeight to 11 (you never set these to values other than those).
Obviously I've chosen the value "0.7" at random. In practice you would
calculate that value such that the page would be displayed in full on
whatever size and resolution display is currently in use.

Because the ScaleWith is always 8.5 and the ScaleHeight is always 11 you can
draw your lines and circles and boxes and paint your pictures and metafiles
and things using those coordinates just as though they were real inches. The
only thing you need to do differently is the font size for whatever text you
write on the page (because the font size in VB is always set in "points",
and a point is a point, no matter what you set the ScaleWidth and
ScaleHeight to). So, when printing your text you should set the font size in
accordance with the current contents of the "magnification" variable (which
was set to 1, 2 or 0.7 in the above three examples). So, for example, if you
needed 12 point text you would use Obj.Font.Size = 12 * magnification.
There is a very slight catch to this (isn't there always!) because the
actual font sizes of True Type fonts are limited to "whole pixel" values,
and the size you get will be the size you ask for to the nearest whoole
pixel (which is very, very close to the desired size on a typical high
resolution printer and only "quite close" to the desired size of the rather
limited resolution of a typical monitor). However, unless you are printing
stuff that required clean and straight "fully justified text" you won't have
much problem with that. There are, of course, ways to achieve nice clean
fully justified text that justifies at exactly the same character on the
printer as it does on the screen, but I don't think you'll need to get into
that sort of stuff for your own specific application.

Anyway, that's the "bare bones" of it. I won't have time to write any actual
code for you (under orders to wash all the "green stuff" off the top of our
little motorhome today!) but I'm sure you will be able to code it yourself,
looking at the stuff you have already done.

Other people here may have other suggestions for you of course. This is just
one option for you to consider. The big advantage of this method is that the
print routines for your picture box and for your printer can be exactly the
same (obviously you would set the variable "magnification" to 1 when
printing to the printer). There may be a few points I've missed (in a bit of
a rush at the moment) but if there are I'm sure others here will point them
out for you.

Mike




.



Relevant Pages

  • Re: Will F1 be on BBC HD?
    ... video monitors used in video editing. ... display, so you have to scale the incoming video to fit the display ... On a CRT this will look fine. ... immediately have to stretch or squish the picture. ...
    (rec.autos.sport.f1)
  • Re: inserting Adobe Illustrator graphics, more experience
    ... Word's "picture editing" tools, they can work only with bitmaps. ... The 'shapes' group are all very similar to CGM (Computer Graphics Metafile) ... as a group, it can have a name, a hyperlink, display ... the import filter, which says "Is this something like CGM?" ...
    (microsoft.public.mac.office.word)
  • Re: VB Circle Method Seems to be Seriously Flawed
    ... The best display accuracy you can hope for is +- 1 Pixel. ... > small changes once you're close to the final design. ... > modeling and all are displayed at the same time in the picture box at the ... >> probably know, the underlying objects can be very accurate, and should ...
    (microsoft.public.vb.general.discussion)
  • Re: How to Move Panasonic Plasma Picture?
    ... case, the picture is clearly slightly decentered, and it is ... >> electrician's tape across the top of the panel (yes, ... Inserting a few of lines of video black at the top and bottom of each ... such as the display panel. ...
    (rec.video)
  • Re: PC cards with real RGB out?
    ... Hence, it is more useful to consider interlaced video, shot with an interlacing video camera, in terms of fields than in terms of "frames". ... If you combine two adjacent fields - an odd field and an even field - and try to display them both at the same time - as a single picture - you don't really get "a frame" in the film frame sense, but a weird mash-up of odd and even lines. ...
    (uk.tech.digital-tv)