Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to print the rupees with Indian currency sign...
I print the rupees with this code:-
e.Graphics.DrawString(textBox14.Text, new Font("Arial", 11, FontStyle.Bold), Brushes.Black, 790, Ypos, new StringFormat(StringFormatFlags.DirectionRightToLeft));

and Symbol is :-
e.Graphics.DrawString("`", new Font("Rupee Foradian", 11, FontStyle.Bold), Brushes.Black, 730, Ypos);


the right result would be first Rupees sign and the rupees amount(like $100,$1000,$10000)...

How to merge two different types of font(one is "Arial" and another is "Rupee Foradian") in one drawString method and it will print with right alignment??

thanks in advance..

Regards
Jayanta.
Posted

No you can't put two font parameters in one drawstring.
What you can do is create a custom method which takes in value to print as one parameter

so the call would be like
XML
yourCustomMethod(txtBox14.Text);

and your method could be like
XML
void yourCustomMethod(string str)
{
   e.Graphics.DrawString(str, new Font("Arial", 11, FontStyle.Bold), Brushes.Black, 790, Ypos, new StringFormat(StringFormatFlags.DirectionRightToLeft));
    e.Graphics.DrawString("`", new Font("Rupee Foradian", 11, FontStyle.Bold), Brushes.Black, 730, Ypos);
}
 
Share this answer
 
There's no quick way to do this. The correct approach for requires a bit of effort.
1) Compute the size for each of your text snippets
(Maybe there's a working version of Graphics.MeasureString()[^] now?)
2) Compute x- and y- coordinates so that every snippet will appear at its desired place
3) Graphics.DrawString()[^] each text snippet to the previously investigated coordinates.
 
Share this answer
 
Comments
JayantaChatterjee 2-Aug-13 8:56am    
thanks..
I will try it with Graphics..MeasureString()...
JayantaChatterjee 2-Aug-13 9:09am    
Thanks again I solve it with our suggestion(Graphics.MeasureString()).... :-)

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