[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

Saving text printed (.print) on a form?

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
lan_nur
Asked:
lan_nur
  • 4
  • 4
  • 2
  • +2
1 Solution
 
Crash2100Commented:
why don't you just use a textbox or a label?
0
 
mcoopCommented:
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
 
lan_nurAuthor Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
mcoopCommented:
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
 
mcoopCommented:
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
 
lan_nurAuthor Commented:
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
 
egsemsemCommented:
 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
 
mcoopCommented:
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
 
pierrecampeCommented:
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
 
lan_nurAuthor Commented:
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
 
egsemsemCommented:
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
 
pierrecampeCommented:
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
 
lan_nurAuthor Commented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now