Пример #1
0
        protected override void WndProc(ref Message m)
        {
            bool flag1 = true;

            switch (m.Msg)
            {
            case 0x7b:
            {
                Point point1 = Win32Util.GetPointFromLPARAM((int)m.LParam);
                point1 = base.PointToClient(point1);
                break;
            }

            case 0x31a:
                if (_tema != IntPtr.Zero)
                {
                    XPTheme.CloseThemeData(_tema);
                    _tema = IntPtr.Zero;
                }
                base.Invalidate();
                break;
            }
            if (flag1)
            {
                base.WndProc(ref m);
            }
        }
Пример #2
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
            Rectangle rectangle1 = base.ClientRectangle;

            ControlPaint.DrawBorder3D(pe.Graphics, rectangle1, Border3DStyle.Sunken);
            if ((esSOCompatible && (XPTheme.IsThemeActive() == 1)) &&
                ((_tema == IntPtr.Zero)))
            {
                _tema = XPTheme.OpenThemeData(IntPtr.Zero, "Edit");
            }
            IntPtr ptr1 = Font.ToHfont();
            IntPtr ptr2 = pe.Graphics.GetHdc();

            Win32Util.SetBkMode(ptr2, 1);
            Win32Util.SelectObject(ptr2, ptr1);
            if (!base.Enabled)
            {
                Win32Util.SetTextColor(ptr2, Color.FromName("ControlDarkDark"));
            }
            else if (textDisplay.IndexOf("-") != -1)
            {
                Win32Util.SetTextColor(ptr2, _ColorNegativo);
            }
            else
            {
                Win32Util.SetTextColor(ptr2, ForeColor);
            }
            if (_tema != IntPtr.Zero)
            {
                RECT   rect1 = new RECT(base.ClientRectangle);
                IntPtr ptr3  = ptr2;
                XPTheme.DrawThemeBackground(_tema, ptr3, 1, base.Enabled ? 1 : 4, ref rect1, ref rect1);
                Rectangle rectangle2 = base.ClientRectangle;
                rectangle2.Inflate(-1, -1);
                Win32Util.FillRect(ptr2, rectangle2, BackColor);
            }
            Size size1 = Win32Util.GetTextExtent(ptr2, textDisplay);

            Win32Util.ExtTextOut(ptr2, (rectangle1.Width - size1.Width) - nShiftLeft, rectangle1.Y + 3, rectangle1,
                                 textDisplay);
            if (_DigitosDecimales > 0)
            {
                for (int num1 = 1; num1 <= (_DigitosDecimales + 2); num1++)
                {
                    if (cambioPosision[num1])
                    {
                        Point point1 = new Point();
                        point1.Y = 3;
                        if (num1 < (_DigitosDecimales + 2) && textDisplay.Length > ((_DigitosDecimales + 2) - num1))
                        {
                            string text1 =
                                textDisplay.Substring(textDisplay.Length - ((_DigitosDecimales + 2) - num1),
                                                      (_DigitosDecimales + 2) - num1);
                            Size size2 = Win32Util.GetTextExtent(ptr2, text1);
                            point1.X = (rectangle1.Width - size2.Width) - nShiftLeft;
                        }
                        else
                        {
                            point1.X = rectangle1.Width - nShiftLeft;
                        }
                        Posicion = point1;
                        if (Focused)
                        {
                            SetCaretPos(Posicion.X, Posicion.Y);
                        }
                    }
                }
            }
            else
            {
                Point point2 = new Point();
                point2.Y = 3;
                point2.X = rectangle1.Width - nShiftLeft;
                Posicion = point2;
                if (Focused)
                {
                    SetCaretPos(Posicion.X, Posicion.Y);
                }
            }
            pe.Graphics.ReleaseHdc(ptr2);
            if (textCambiar != textDisplay)
            {
                textCambiar = textDisplay;
                OnTextChanged(EventArgs.Empty);
            }
        }