Exemple #1
0
        public void DrawStringCentered(string Text, QPoint Location, QPen Pen, QFont Font)
        {
#if WPF
            PendingText.Add(new Tuple <string, QPoint, QPen, QFont, bool>(Text, Location, Pen, Font, true));
#else
            var size = MeasureText(Text, Font);
            DrawingTarget.DrawString(Text, Font.Font, Pen.Brush, Location.X - size.Width / 2, Location.Y - size.Height / 2);
#endif
        }
Exemple #2
0
        public QSize MeasureText(string Text, QFont Font)
        {
#if WPF
            System.Windows.Controls.TextBlock tb = new System.Windows.Controls.TextBlock();
            tb.FontFamily = Font.FontFamily;
            tb.FontStyle  = Font.IsItalic ? System.Windows.FontStyles.Italic : System.Windows.FontStyles.Normal;
            tb.Text       = Text;
            tb.Measure(new System.Windows.Size(double.PositiveInfinity, double.PositiveInfinity));
            return(new QSize(tb.DesiredSize.Width + 6, tb.DesiredSize.Height + 4)); // roughly equivalent with GDI+ version
#else
            var size = DrawingTarget.MeasureString(Text, Font.Font);
            return(new QSize(size.Width, size.Height));
#endif
        }
Exemple #3
0
 public void DrawString(string Text, QRectangle Rectangle, QPen Pen, QFont Font)
 {
     System.Windows.Forms.TextRenderer.DrawText(DrawingTarget, Text, Font.Font, Rectangle.ToRectangle(), Pen.Color, System.Windows.Forms.TextFormatFlags.WordBreak);
 }
Exemple #4
0
 private void addToHelpList(string Text, ref QPoint Point, float YOffset, QFont Font, QPen Pen)
 {
     Point.Y += YOffset;
     renderList.Add(new Tuple <string, QPoint, QPen, QFont>(Text, Point, Pen, Font));
 }