set client area of control that inherits from panel

Hi everyone 

I have a control that inherits from the panel control, but I need to be able to do some custom drawing in the top 30 pixels of the control and add some controls, the rest of the control area is for controls to be added to at design time.

What I'm looking to happen is when a control is placed in my control at design time it will be added to the area below my custom drawing not over the top of it.

Any help would be much appreciated
Thanks in advance
Dan


Answer this question

set client area of control that inherits from panel

  • Josh Cochran

    Override OnLayout and move the controls down if they are dropped in the section you want to preserve.
  • johnlayer

    You have to define the client and non-client area of your control by overriding WndProc and handling the WM_NCCALCSIZE and WM_NCPAINT window messages.  See my inquiry with code <a href="http://groups-beta.google.com/group/microsoft.public.dotnet.framework.windowsforms.controls/browse_thread/thread/aa5a5a9ac6bf86d0/f0e77969a8a09196 q=non-client+area&_done=%2Fgroup%2Fmicrosoft.public.dotnet.framework.windowsforms.controls%2Fsearch%3Fgroup%3Dmicrosoft.public.dotnet.framework.windowsforms.controls%26q%3Dnon-client+area%26qt_g%3D1%26&_doneTitle=Back+to+Search&&d#f0e77969a8a09196">here</a> in google groups.
  • Shaik Abdullah K

    Thanks guys I will look into this, and thanks Joey I got your reply in the newsgroup as well I was just flat out yesterday and never got chance to reply.

    Cheers
    Dan

  • set client area of control that inherits from panel