Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 1.43 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. C# Graphics DrawString VerticalDirection start from the bottom
  2. SizeF s = e.Graphics.MeasureString(str1, po.defaultF,la1, StringFormat.GenericTypographic);
  3. RectangleF rec=new RectangleF();
  4. StringFormat strF=new StringFormat();
  5. strF.FormatFlags=StringFormatFlags.DirectionVertical;
  6. rec.Height=s.Width+15;
  7. rec.Width=s.Height+5;
  8. rec.X =0;
  9. rec.Y=0;
  10. e.Graphics.DrawString(str1, po.defaultF, Brushes.Black, rec, strF);
  11.        
  12. strF.Alignment = StringAlignment.Far;
  13. e.Graphics.TranslateTransform(rec.Right, rec.Bottom);
  14. e.Graphics.RotateTransform(180);
  15. e.Graphics.DrawString(str1, po.defaultF, Brushes.Black, rec, strF);
  16.        
  17. SizeF s = e.Graphics.MeasureString(str1, po.defaultF,la1,
  18. StringFormat.GenericTypographic);
  19. RectangleF rec=new RectangleF();
  20. StringFormat strF=new StringFormat();
  21. strF.FormatFlags=StringFormatFlags.DirectionVertical;
  22. rec.Height=s.Width+15;
  23. rec.Width=s.Height+5;
  24. rec.X =0;
  25. rec.Y=0;
  26. string[] strRightToLeft = str1.Split('n');
  27. Array.Reverse(strRightToLeft);
  28. e.Graphics.DrawString(String.Concat(str1), po.defaultF, Brushes.Black, rec, strF);
  29.        
  30. Rectangle rec = new Rectangle();
  31. rec.Height = 2 * po.medF.Height;
  32. rec.Width=100;
  33. rec.X = 0;
  34. rec.Y = 0;
  35. SizeF s;
  36. String str = "your Text";
  37. StringFormat strf = new StringFormat();
  38. strf.Alignment = StringAlignment.Center;    
  39. rec.X = 0;
  40. rec.Y = 0;
  41. e.Graphics.TranslateTransform(X1, Y1);
  42. e.Graphics.RotateTransform(90);
  43. e.Graphics.DrawString(str, po.medF, Brushes.Black, rec, strf);
  44. e.Graphics.ResetTransform();