protected void RaiseCustomEditSize(EventArgsEditCustomSize e) { if (CustomEditSize != null) { CustomEditSize(this, e); } }
protected virtual void OnPaintEditItem(System.Windows.Forms.PaintEventArgs pevent) { Graphics g = pevent.Graphics; //Rectangle rc = pevent.ClipRectangle; Rectangle rc = ClientRectangle; // if control not shown to user then change text centering int yPos = ClientRectangle.Y + (ClientRectangle.Height - m_editbox.Height) / 2; if (m_bOwnValuePaint == true) { yPos = ClientRectangle.Y + 2; } int xPos = ClientRectangle.X + 2; int iWidth = ClientRectangle.Width - 20; int iHeight = ClientRectangle.Height - 4; EventArgsEditCustomSize ev = new EventArgsEditCustomSize(xPos, yPos, iWidth, iHeight); RaiseCustomEditSize(ev); m_editbox.Location = new Point(ev.xPos, ev.yPos); m_editbox.Size = new Size(ev.Width, ev.Height); if (m_bOwnValuePaint == true) { Rectangle rcOut = new Rectangle(ev.xPos, ev.yPos, ev.Width, ev.Height); SolidBrush brush = new SolidBrush(ForeColor); g.DrawString(Value, Font, brush, rcOut, m_strFormat); brush.Dispose(); } }
protected void RaiseCustomEditSize( EventArgsEditCustomSize e ) { if( CustomEditSize != null ) { CustomEditSize( this, e ); } }
protected virtual void OnPaintEditItem( System.Windows.Forms.PaintEventArgs pevent ) { Graphics g = pevent.Graphics; //Rectangle rc = pevent.ClipRectangle; Rectangle rc = ClientRectangle; // if control not shown to user then change text centering int yPos = ClientRectangle.Y + ( ClientRectangle.Height - m_editbox.Height ) / 2; if( m_bOwnValuePaint == true ) yPos = ClientRectangle.Y + 2; int xPos = ClientRectangle.X + 2; int iWidth = ClientRectangle.Width - 20; int iHeight = ClientRectangle.Height - 4; EventArgsEditCustomSize ev = new EventArgsEditCustomSize( xPos, yPos, iWidth, iHeight ); RaiseCustomEditSize( ev ); m_editbox.Location = new Point( ev.xPos, ev.yPos ); m_editbox.Size = new Size( ev.Width, ev.Height ); if( m_bOwnValuePaint == true ) { Rectangle rcOut = new Rectangle( ev.xPos, ev.yPos, ev.Width, ev.Height ); SolidBrush brush = new SolidBrush( ( Enabled ) ? ForeColor : SystemColors.GrayText ); g.DrawString( Value, Font, brush, rcOut, m_strFormat ); brush.Dispose(); } }