Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello guys,

i am stored product price value in ms access text format. Now i am going to print all product name and price using print document but in my result price not correct order

for example

Computer          45000.00
mouse             250.00
keyboard          300.00
computer table    1500.00



but i want the following order

computer          45000.00
mouse               250.00
keyboard            300.00
computer table     1500.00



i want to match digits position (example one's position, ten's postion equal to each other product price). can any one tell the g.grawstring() function to align product price as above mention order.i hope any one help me.

sorry my english because i am not english man

Thanks

[edit]Code blocks added - OriginalGriff[/edit]
Posted
Updated 28-May-20 19:36pm
v2

You will have to use two DrawStrings: one for the label ("computer table") and one for the price ("1500.00")

You can then use the same rectangle:
C#
RectangleF rect = new RectangleF(10.0F, 10.0F, 200.0F, 30.0F);
StringFormat format = new StringFormat(StringFormatFlags.DirectionRightToLeft);
g.DrawString("Computer table", font, brush, rect);
g.DrawString("1500.00", font, brush, rect, format);
 
Share this answer
 
Comments
Member 14846952 29-May-20 1:47am    
displaying in following order is okey when using following code

RectangleF rect = new RectangleF(10.0F, 10.0F, 200.0F, 30.0F);
StringFormat format = new StringFormat(StringFormatFlags.DirectionRightToLeft);
g.DrawString("Computer table", font, brush, rect);
g.DrawString("1500.00", font, brush, rect, format);

computer 45000.00
mouse 250.00
keyboard 300.00
computer table 1500.00

but problem if amount is negative i.e -45000.00 , -250
then it display like this , negative sign display behind the amount

computer 45000.00-
mouse 250.00-
keyboard 300.00
computer table 1500.00
displaying in following order is okey when using following code

RectangleF rect = new RectangleF(10.0F, 10.0F, 200.0F, 30.0F);
StringFormat format = new StringFormat(StringFormatFlags.DirectionRightToLeft);
g.DrawString("Computer table", font, brush, rect);
g.DrawString("1500.00", font, brush, rect, format);

computer 45000.00
mouse 250.00
keyboard 300.00
computer table 1500.00

but problem if amount is negative i.e -45000.00 , -250
then it display like this , negative sign display behind the amount

computer 45000.00-
mouse 250.00-
keyboard 300.00
computer table 1500.00
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900