Exemplo n.º 1
0
 public void ApplyInternalPadding()
 {
     WinApi.RECT rc = new WinApi.RECT(2, 2, ClientSize.Width - 4, ClientSize.Height - 3);
     WinApi.SendMessageRefRect(Handle, WinApi.EM_SETRECT, 0, ref rc);
 }
Exemplo n.º 2
0
        protected override void WndProc(ref Message m)
        {
            // Send WM_MOUSEWHEEL messages to the parent
            if (!MultiLines && m.Msg == 0x20a) WinApi.SendMessage(Parent.Handle, m.Msg, m.WParam, m.LParam);
            else base.WndProc(ref m);

            if ((m.Msg == WmPaint) || (m.Msg == OcmCommand)) {
                // Apply a padding INSIDE the textbox (so we can draw the border!)
                if (!_appliedPadding) {
                    WinApi.RECT rc = new WinApi.RECT(4, 2, ClientSize.Width - 8, ClientSize.Height - 3);
                    WinApi.SendMessageRefRect(Handle, WinApi.EM_SETRECT, 0, ref rc);

                    _appliedPadding = true;
                } else {
                    using (Graphics graphics = CreateGraphics()) {
                        CustomPaint(graphics);
                    }
                }

            }
        }