
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 1.43 KB | hits: 16 | expires: Never
C# Graphics DrawString VerticalDirection start from the bottom
SizeF s = e.Graphics.MeasureString(str1, po.defaultF,la1, StringFormat.GenericTypographic);
RectangleF rec=new RectangleF();
StringFormat strF=new StringFormat();
strF.FormatFlags=StringFormatFlags.DirectionVertical;
rec.Height=s.Width+15;
rec.Width=s.Height+5;
rec.X =0;
rec.Y=0;
e.Graphics.DrawString(str1, po.defaultF, Brushes.Black, rec, strF);
strF.Alignment = StringAlignment.Far;
e.Graphics.TranslateTransform(rec.Right, rec.Bottom);
e.Graphics.RotateTransform(180);
e.Graphics.DrawString(str1, po.defaultF, Brushes.Black, rec, strF);
SizeF s = e.Graphics.MeasureString(str1, po.defaultF,la1,
StringFormat.GenericTypographic);
RectangleF rec=new RectangleF();
StringFormat strF=new StringFormat();
strF.FormatFlags=StringFormatFlags.DirectionVertical;
rec.Height=s.Width+15;
rec.Width=s.Height+5;
rec.X =0;
rec.Y=0;
string[] strRightToLeft = str1.Split('n');
Array.Reverse(strRightToLeft);
e.Graphics.DrawString(String.Concat(str1), po.defaultF, Brushes.Black, rec, strF);
Rectangle rec = new Rectangle();
rec.Height = 2 * po.medF.Height;
rec.Width=100;
rec.X = 0;
rec.Y = 0;
SizeF s;
String str = "your Text";
StringFormat strf = new StringFormat();
strf.Alignment = StringAlignment.Center;
rec.X = 0;
rec.Y = 0;
e.Graphics.TranslateTransform(X1, Y1);
e.Graphics.RotateTransform(90);
e.Graphics.DrawString(str, po.medF, Brushes.Black, rec, strf);
e.Graphics.ResetTransform();