Exemplo n.º 1
0
        static public CustomLabel CreateLabel(double x, double y, double w, double h, String t, bool bigText, bool pixels, CustomLabel.LabelType type)
        {
            int top, left, width, height;

            if (pixels)
            {
                top    = (int)y;
                left   = (int)x;
                width  = (int)w;
                height = (int)h;
            }
            else
            {
                width  = (int)Math.Ceiling((w * form.pxPrChar));
                height = (int)Math.Ceiling(h * form.pxPrLine);
                top    = (int)(Math.Ceiling(y * form.pxPrLine) + form.padding_top);
                left   = (int)(Math.Ceiling(x * form.pxPrChar) + form.padding_left);
            }



            CustomLabel label = new CustomLabel();

            label.setCharWidth(form.pxPrChar);
            label.setlineHeight(form.pxPrLine);
            label.setcharOffset(form.charOffset);
            label.setlineOffset(form.lineOffset);
            label.Font      = form.font;
            label.AutoSize  = false;
            label.Location  = new Point(left, top);
            label.Size      = new Size(width, height);
            label.Text      = t;
            label.Padding   = new Padding(0);
            label.Margin    = new Padding(0);
            label.ForeColor = form.foreColor;
            label.bigText   = bigText;
            label.type      = type;

            if (type == CustomLabel.LabelType.CRT)
            {
                left  = (int)Math.Round(x * (2f / 3f * form.pxPrLine));
                width = (int)Math.Ceiling((w * (2f / 3f * form.pxPrLine)));

                label.setCharWidth((2f / 3f * form.pxPrLine));
                label.Location = new Point(left, top);
                label.Size     = new Size(width, height);
            }

            form.Controls.Add(label);
            return(label);
        }
Exemplo n.º 2
0
 static public CustomLabel CreateLabel(double x, double y, double w, double h, String t, CustomLabel.LabelType type)
 {
     return(CreateLabel(x, y, w, h, t, true, false, type));
 }