Hello,
I have a form with multiple controls on it. The text control is scrollable field which contains 10 or more lines of data . Currently when I print (WYSIWUG format) , I can only view 4 lines of 10 (since the other lines are not visible unless the user scrolls the text area ). I would like to extend the print functionality (to see more than WYSIWU) so that I can resize the control at runtime and accordingly resize all the other controls for printpreview.
I have attached a detailed image from our main project. If you notice the image, the description field does not contain all of the data.
I am looking for ways to extending the printing so that it would pull all the data from the controls without any overlap for print.
Any new approach for achieving this will also help.
Thanks
Hi,
I'm not sure I understand your question.
There are a couple of ways you could acheive what you want. One way would be to use the Infragistics.Documents engine to create a report that contains all of the data you want to print.
Another option is to handle the printing yourself by handling the PrintPage method on the UltraPrintDocument class.
But both of these methods require you to write some code. There's no way that any of the components in NetAdvantage can print the contents of all controls on a form for you, since there are too many unknowns.
Thanks Mike for the quick reply. I appreciate your help. I look forward to hear from you again.Let me rephrase my question.
Consider a form consisting of horizontal split control.
The top panel contains information like Name, ROll no, Description etc.
The bottom panel contains tab controls.
The first tab contains a grid , clicking on second tab diplays other information ( having text box, labels etc) , third tab and so on.
When I print the form , the user is given the option to print the entire form along with tab controls or just print the top panel alone.
If the user opts for printpreview ( and later print) for top panel alone, then the print preview should pull the information from the top panel only.
Normally the print option generally displays the content that is currently visible to the user. If the user sees only some part of the description ,then only
that is available in printing as well.
But what I would like to do is , extend the printing so that the entire contents of all the controls are seen (even though they are not visible on screen by
that I mean that information is seen only when the user scrolls the text box). Similarly if there is a combo box and the width is set to 80px , certain items
in the combo box may be cut off on the screen and not visible unless the user clicks that icon and sees the tool tip to see the content of the text box.
But during print preview, the width of the combo box needs to increase , so that it accomodates the full content of the selected item of the combo box.
Right now for trial purpose, I had overriden the print page event and resized the controls width and height for drawing. In my test application , I can take
the controls shown on the screen , capture its screen width and height and then recreate a rectangular control with the same width and height, entire content and pass it to graphics for drawing that image.
Thus I would have to write generic code to achieve resizing of the control depending on the content. Similary I would also need to find out if the control
needs to grow width wise or height wise. Since for the combo box , it would need to grow horizontally. And if it needs to grow horizontally,will it fit the
page size ?. Another consideration is if the controls are arranged in certain order and if I resize a particular control , what about the control that was
aligned along side it ? That needs to move too ..
Listed above are some of the considerations that I need to make before I print the form and its tab layout(s).
Is the approach of overriding print page and code it good ? . Are there any more parameters I need to be aware of before I develop the generic code for resizing the controls depending the contents.
How would UltraPrintDocument be useful , currently we have created our own printDocument control. If our printDOcument control inherits from
UltraPrintDocument are there immediate benefits (apart from setting header , footer etc ) for the above problem.
Also how will Document engine help me . Can I create a report on the fly from the form and use for display purpose. How will I design the form for reporting engine since it needs to mimick the GUI form. Since the position of the layout needs to remain the same.
I need some examples , becuase I dont see much of documentation for this.
To summarize,
Any approach for printpage to handle the positioning of controls.
how will document engine help me in creating reports ? What about the layout , how will it mimick the GUI shown on the screen. Do I need to redesign entire form at runtime ? What about the position of the controls ?
Thank you so much for your help. I look forward to hear from you.
I am sorry the above content is not formatted correctly. Please consider the below formatted reply.
The bottom panel contains tab controls.The first tab contains a grid , clicking on second tab diplays other information ( having text box, labels etc) , third tab and so on.
When I print the form , the user is given the option to print the entire form along with tab controls or just print the top panel alone.If the user opts for printpreview ( and later print) for top panel alone, then the print preview should pull the information from the top panel only.
Normally the print option generally displays the content that is currently visible to the user. If the user sees only some part of the description ,then only that is available in printing as well.
But what I would like to do is , extend the printing so that the entire contents of all the controls are seen (even though they are not visible on screen by that I mean that information is seen only when the user scrolls the text box). Similarly if there is a combo box and the width is set to 80px , certain items in the combo box may be cut off on the screen and not visible unless the user clicks that icon and sees the tool tip to see the content of the text box.
Right now for trial purpose, I had overriden the print page event and resized the controls width and height for drawing. In my test application , I can take the controls shown on the screen , capture its screen width and height and then recreate a rectangular control with the same width and height, entire content and pass it to graphics for drawing that image.
Thus I would have to write generic code to achieve resizing of the control depending on the content. Similary I would also need to find out if the control needs to grow width wise or height wise. Since for the combo box , it would need to grow horizontally. And if it needs to grow horizontally,will it fit the page size ?. Another consideration is if the controls are arranged in certain order and if I resize a particular control , what about the control that was aligned along side it ? That needs to move too ..
How would UltraPrintDocument be useful , currently we have created our own printDocument control. If our printDOcument control inherits from UltraPrintDocument are there immediate benefits (apart from setting header , footer etc ) for the above problem.
I don't think UltraPrintDocument will give you anything other than the obvious benefits of the header and footer.
Regarding the printing itself, I'm afraid I'm really no expert on such things, and it doesn't really have much to do specifically with the Infragistics controls.
There are a number of approaches you can take.
You could use duplicate controls like you are doing and call DrawToBitmap and then draw those Bitmaps onto the printer graphics objects in the PrintPage event.
Or, you could use GDI+ code and the graphics object itself to draw text or lines or other objects onto the printed page manually.
If you are going to draw onto the printer page, then there's a lot of measuring code involved. You will need to know if what you are drawing fits on the page and if it does not, adjust accordingly.
Another option might be to create an UltraWinGrid with the data you want. You could use RowLayouts to create a layout that looks similar to your data on the form. Of course, this only works if you data lends itself toward displaying in a grid - which means you would be showing different data but repeating the same formatting for each row. Then you could simply print the grid.
The Documents engine allows you to create a PDF or XPS document and save of print it. So you could create Text area within the report. This would involve a lot of manual copying of the data on the form into the report object.
I'm not sure I understand the question. What part of this is giving you a problem?
Are you trying to use the grid's built-in printing capability? Or are you trying to write code to draw the data onto the printing surface yoursef?
If the former, then you can easily do this by simply setting FitWidthToPages = 1.
If the latter, then there's no easy way to handle this. You could have to either manipulate the data yourself and shrink it down or format it to a page or you would have to handle drawing onto the second page.
Thanks Mike . Can you please tell me how to print a grid containing 20 columns which might not fit on a page. Have you come across this ?
I think i would have to use a different format for displaying the data.