draw a border for a derived control

  • Thread starter Thread starter gupta
  • Start date Start date
G

gupta

I have derived a control from Control class and I would like to draw a
border. If I draw a border using ClientSize or ClientRectangle then controls
inside of it hides it. I have to either draw it in NON-CLIENT area or modify
the client area so other controls can not hide it.

Does anyone know how to do this in .NETCF?

Anil
 
I haven't used CF by in normal .NET you would override
the CreateParams property and add 0x200 to ExStyle.
That would give you the normal 3D border that's
around textboxes, listboxes etc. There is no need to
draw anything and the ClientRectangle is still correct

In VB it looks like this:

Protected Overrides ReadOnly Property CreateParams() As
System.Windows.Forms.CreateParams
Get
Dim params As CreateParams = MyBase.CreateParams
params.ExStyle = params.ExStyle Or &H200
Return params
End Get
End Property
 
Rectangle rc = this.ClientRectangle;
rc.Width--;
rc.Height--;
gx.DrawRectangle(new Pen(Color.Black), rc);
 
Back
Top