Esempio n. 1
0
        internal static void CreateDLabel(DObject parent, Microsoft.Msagl.Drawing.Label label, out double width, out double height)
        {
            DLabel dLabel = new DLabel(parent, label);

            dLabel.Font = new Font(label.FontName, label.FontSize);
            StringMeasure.MeasureWithFont(label.Text, dLabel.Font, out width, out height);
            label.Width  = width;
            label.Height = height;
        }
Esempio n. 2
0
        internal static void CreateDLabel(DObject parent, Drawing.Label label, out double width, out double height,
                                          GViewer viewer)
        {
            var dLabel = new DLabel(parent, label, viewer)
            {
                Font = new Font(label.FontName, (int)label.FontSize, (System.Drawing.FontStyle)(int) label.FontStyle)
            };

            StringMeasure.MeasureWithFont(label.Text, dLabel.Font, out width, out height);

            if (width <= 0)
            {
                //this is a temporary fix for win7 where Measure fonts return negative lenght for the string " "
                StringMeasure.MeasureWithFont("a", dLabel.Font, out width, out height);
            }

            label.Width  = width;
            label.Height = height;
        }