public TextBox(int id, String text, String font, Vec2i position, Texture parent, ColorRGBA color, int resetKey, int startKey, int sendKey)
            : base(id, position)
        {
            this.parent = parent;

            //Creation:
            Process process = Process.ThisProcess();

            thisView = zCView.Create(Process.ThisProcess(), 0, 0, 0x2000, 0x2000);
            setFont(font);

            tB = new textBox(thisView, process);
            tB.setText(text);
            tB.resetKey        = resetKey;
            tB.startWritingKey = startKey;
            tB.sendKey         = sendKey;

            tB.vt.PosX    = this.position.X;
            tB.vt.PosY    = this.position.Y;
            tB.SendInput += new EventHandler <EventArgs>(tbSended);


            tB.Inputenabled = false;


            setColor(color);
        }
Beispiel #2
0
        public static bool ValidarForm(Control Objform, ErrorProvider gp)
        {
            bool corredor = false;

            foreach (Control item in Objform.Controls)
            {
                if (item.Controls.Count > 0)
                {
                    bool corredor2 = ValidarForm(item, gp);
                    if (corredor2)
                    {
                        corredor = true;
                    }
                }
                if (item is textBox)
                {
                    textBox obj = (textBox)item;
                    if (obj.Validar)
                    {
                        if (string.IsNullOrEmpty(obj.Text.Trim()))
                        {
                            gp.SetError(obj, "Campo obligatorio.");
                            corredor = true;
                        }
                        else
                        {
                            gp.SetError(obj, "");
                        }
                    }
                }
            }
            //  MessageBox.Show("REgggggTONRO: "+corredor);
            return(corredor);
        }
    public static int VisibleCharCount(this textBox textBox)
    {
        int count = 0;

        do
        {
            count++;
            var testString  = new string('X', count);
            var stringWidth = System.Drawing.Graphics.MeasureString(testString, textBox.Font);
        } while (stringWidth < textBox.Width);

        if (stringWidth == textBox.Width)
        {
            return(count);
        }
        else
        {
            return(count - 1);
        }
    }