problem with creating new control

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.
 
G

Guest

Hi Dariusz,

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

Cheers!

Marcin
 
G

Guest

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top