Solved

Saving text printed (.print) on a form?

Posted on 2002-06-28
13
264 Views
Last Modified: 2010-05-02
I made a program whose output is in another form, maximized and no bordered so it's full screen. The output is made using the form.print function using different forecolors for the form.
What I need to do is to be able to either:
 1. Print the text into a picture box which will hold it the way the form displayed the text, it will not crop it and will be able to be saved.
 or:
 2. find some other way to turn the colored text into an image which could be bigger than the screen resolution(not using autodraw)

If you need any additional details ask freely
thanks alot in advance
nur
0
Comment
Question by:lan_nur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +2
13 Comments
 
LVL 18

Expert Comment

by:Crash2100
ID: 7117698
why don't you just use a textbox or a label?
0
 
LVL 4

Expert Comment

by:mcoop
ID: 7117726
If I'm understanding your problem...
What I do in that case is as follows...

Dim outputObj as Object
dim previewMode as boolean

'
' set previewMode as appropriate
'

'you may also like to set different scaleModes for each possible output context so that the display doesn't fall off the screen/page

if previewMode then
  set outputObj = myForm (thescreen object you are using)
else
  set outputObj = Printer  (or other target context)
endif

' do my printing stuff
'
'
'

' finally
if outputObj = printer then outputobj.enddoc


0
 

Author Comment

by:lan_nur
ID: 7118314
What I meant was:
I have a form\picture box which I print into using the .Print method which prints simple text. All I want to do is to be able to handle this picture as if it was a regular picture, ie: To be able to print into it even if it's outside of the screen boundries.

Mccoop, your post would help if I were using a regular picture box without using .Point(x,y) to get pixel colors (which forces the picture to be in screen boundries) and without using the .Print method.
Is it possible to directly write to a graphic file?

Hope this helps.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:mcoop
ID: 7118450
You can make a picturebox larger than the screen area - and I have certainly drawn into one like that (although not with the point() function).  I also used the print() function to draw to the picturebos...

Although I did have issues and had to manipulate the picturebox's .AutoRedraw property.

Does the point() function not work outside the screen dimensions... ?  (Never tried that)

You could do it with very short line() calls... (well it's not nice - but I haven't had problems with the line() function being persistent outside screen area)

But I still had to work with the .autoredraw setting.

My application has a scrolling picturebox - which can be many times the screen area, and I draw text, lines, and even place activeX controls into it.

These are all persistent when managed properly - although I agree that it is one of the areas most dependent on video cards and drivers.

Some machines don't handle it at all well (lines and text get forgotten when scrolling etc) , others require a reboot after the app is installed, while the majority work straight off.

0
 
LVL 4

Expert Comment

by:mcoop
ID: 7118457
Sorry - back to my earlier post...

It requires a substantial rewrite, but if you plan your scaling correctly, changing the target context does work - and allows you to 'see' what you're going to get (+/- 1 twip)

Then you can also manipulate the numbers if you want to print the form into into a single page, or tile across multiple sheets of paper to keep the sixe of objects etc
0
 

Author Comment

by:lan_nur
ID: 7118859
All the years I've been working with VB, I didn't quite get the scaling thing and Twips and making an application work on all resolutions. Can you maybe explain how to scale the picture? Perhaps that's the answer.
And how did you make the picture scroll? That may be the answer too.
Thanks
0
 
LVL 2

Expert Comment

by:egsemsem
ID: 7119169
 You may use a large hidden picture box with autoredraw property, so that you print the text in both of them. And when you want to save or print the text, you can use the hidden picturebox.
  In case this solution didn't satisfy you, could you tell us why you don't want to use autodraw? It will save a lot of time and effort.

Osama
0
 
LVL 4

Expert Comment

by:mcoop
ID: 7119365
To make a scrolling picturebox, you need to place one picturebox (your drawing target) inside another (the container.

If you use scrollbars, then these would also be placed in the container (a tthe bottoma nd right edges.

You need to place the target and scroll bars programmatically (.move) if the container is going to be resizable.

Once the positioning is done (assuming the target is larger than the container) - you need to develop a relationship between the scrollbars and the target-to-container width & height,

By moving the top and left values of the target, you effectively move the vviewport into the target window.

If the target-tocontainer relationship is not constant (i.e window sizes may be different) The scaling of the scrollbars is also a variable, thus you need to manage  the min & max values in realtime.

Ths sounds complicated - but is not really, and once you've done it - it all makes sense and is easy to manipulate.

Here is a KB article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q186429
0
 
LVL 6

Expert Comment

by:pierrecampe
ID: 7120152
i dont quete understand what you are trying to do
but try this:
start a new exe project
form1 is created
make form1 a mdi-child
make autoredraw true
give form1 a single line border
give form1 no control box and no caption
the code in form1:

Private Sub Form_Load()
    Me.Move 90, 90, Screen.Width * 5, Screen.Height * 5
End Sub

add an mdi form to the project

now run the project and you will have a scrollable form that's as wide as 5 times the screen and as height as 5 times the screen

with this form you can do anything you can do with a 'normal' form
even reading the pixel color of a pixel that is not visible

and if you dont want the autoredraw=true,just place all the graphics methods in the paint event(but then you wont be able to read a hidden pixel)


0
 

Author Comment

by:lan_nur
ID: 7120543
I never said I didn't want to use Autodraw, it helps me alot.
I'll try the MDI Child later, but what I need to do is save the picture that was printed over. Even with autodraw it doesn't save it with the text.
Anyone advice?
thanks
0
 
LVL 2

Accepted Solution

by:
egsemsem earned 350 total points
ID: 7120573
Do u use:
SavePicture Picture1.Image, "c:\tmp.bmp"
or
SavePicture Picture1.Picture, "c:\tmp.bmp"
?

the first one should save the picture with the text drawn over it.

Osama
0
 
LVL 6

Expert Comment

by:pierrecampe
ID: 7120659
i dont want to sound patronising, but why do you want to save an image of a form/picturebox,if at anytime you can recreate what you have done
if by chance it is to send that image to the printer, you are better of using the system mcoop gave you
that way it does not matter if you are printing to a form or picturebox or the printer, the output will be exactly the same
if you send the saved image of the form/picturebox to the printer the quality will be no good, it will be screen quality
if you use mcoop's method the printer output will be the best the printer can do
0
 

Author Comment

by:lan_nur
ID: 7122950
THANKS ALL OF YOU GUYS!
In the end egsemsem's post about the image/picture solved the saving problem and pierrecampe's solution with the mdi child solved the size matter.
so thanks.
I'll give the points to egsemsem and pierre, if u want ill post another question so u get points too.

mcoop, thanks ALOT for your help too!

Thank you all
Nur
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

691 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