problem with creating new control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have to create my own control which might be an extension for a standard
'panel' control. I called it 'SmartPanel'. This is specialized panel. It
consists of a title bar and a client area on which other controls can be
placed. Depends on its state, it can shrink into one of its borders so only
title bar is visible in shrinked state. Problem is as follows: I want to be a
title bar with name of panel (e.g "Tools") and I paint it in a OnPaint event.
It is all ok, but when I put on my panel some other control (e.g other Panel
or Button) and when I set its Docking style (e.g to DockStyle.Right) its
covering title bar of my SmartPanel! I tried to figure out what's going on. I
found ClientSize property. Fine, but I can't use in when my SmartPanel is in
state 'dock to left' or 'dock to bottom' because of title bar is at beginning
of client area. ClientRectangle property is read only and in MSDN is written
that "the coordinates of the upper-left corner of the rectangle returned by
this property are (0,0)", but I want to upper-left corner starts at (0, 20)
for example. Please help me to solve this setting me mad problem...

thanks for advance.
 
Hi Dariusz,

There is a "DockPadding" property of "ScrollableControl".
You can define it for dock offset.

Cheers!

Marcin
 
Thanks for Your answer, it realy workarounds my problem. Code is nice and
works but I still have a little question. In GDI API were functions
GetWindowOrg/SetWindowOrg (if my memory is well) which were setting a
particular window original position and help to prevent such as mine
situation. Is in GDI+/.NET platform any way do change window origin point?
Thanks for any ideas.
 
Hi,

I don't have any experiences with Windows GDI.
So, I'm not sure what you mean as "Origin point".

But you can look for: "Control.CreateParams"
& "Form.StartPosition".

Cheers/Pozdrowienia

Marcin
 
Back
Top