473,473 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

print document

I trying to print my App form by printDocument,
i trying to draw the text box, but i don't know how to
draw the the text in the right alignment.

// print edit box control contents
if (Controls[i].GetType() == this.textBox1.GetType())
{
TextBox theText = (TextBox)Controls[i];
g.DrawString(theText.Text, theText.Font, Brushes.Black,
theText.Bounds.Left*scalex, theText.Bounds.Top * scaley,
new StringFormat());
}

the result of this is. the text print in left align how
to to make it to be on the right align
Nov 15 '05 #1
1 7338
You want to use
You want to use the DrawString overload that takes a
System.Drawing.StringFormat, and you want to set the StringFormat's
alignment property to Far

Do something like this (Replace the font, brush, text, and rectangle with
your own):

System.Drawing.StringFormat Text3Format = new
System.Drawing.StringFormat(System.Drawing.StringF ormat.GenericTypographic);
Text3Format.Alignment = System.Drawing.StringAlignment.Far;
e.Graphics.DrawString(this.Text3, this.Text3Font, this.Text3Brush,
this.Text3Rect, Text3Format);

--
Justin Weinberg

Designing a PrintDocument? Drawing to forms?
Check out GDI+ Architect at www.mrgsoft.com


"[Yosi]" <yo*****@taux01.nsc.com> wrote in message
news:06****************************@phx.gbl...
I trying to print my App form by printDocument,
i trying to draw the text box, but i don't know how to
draw the the text in the right alignment.

// print edit box control contents
if (Controls[i].GetType() == this.textBox1.GetType())
{
TextBox theText = (TextBox)Controls[i];
g.DrawString(theText.Text, theText.Font, Brushes.Black,
theText.Bounds.Left*scalex, theText.Bounds.Top * scaley,
new StringFormat());
}

the result of this is. the text print in left align how
to to make it to be on the right align

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: dan | last post by:
This works in mozilla but I can't figure out why this won't work in IE. Say I have this html <html> header goes here header goes here
4
by: Julie Siebel | last post by:
Apologies...I'm sure this has been asked before, but I can't seem to come up with the correct Google search terms. While my problem is with stylesheets, the errors are being caused by my...
3
by: Craig | last post by:
First of all, this one is driving me crazy, so thanks in advance for any help!! I've got a javascript function in a parent document that generates an HTML document on the fly when a button is...
21
by: Steel | last post by:
Hi at all, I have a very long html page with many photo. Therefore the best to print this page is to print the some page as PDF. Therefore I maked a PDF file like my page to print best. I'ld want...
2
by: Asad | last post by:
I have a main window that creates a new window called printWin (which contains the printable format of the page). From the main window I embed a javascript in the printWin window that calls the...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
10
by: jon | last post by:
I'm trying to use a hidden iframe to print the contents of one div seamlessly. Currently I can create the hidden iframe, copy the contents of the div to the iframe, and print it. I even have a...
2
by: Brad Pears | last post by:
I have some sample code that uses the print dialog, print preview and a print direct options. If I select print preview and then click the printer icon from that, the document prints. If I...
10
by: S_K | last post by:
Hi, I have a directory full of a number of .PDF files that I need to print. Is there any simple way to do this? Using PdfReader purhaps? Thanks in advance. Steve
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.