By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

How to set the size of the "Client Area" of a Custom control ?

P: n/a
Hi,

I've made a CustomPanel derived from the Panel class.

How can I set my own size of the "client area" of that CustomPanel ?

("client area" = Size of the rectangle in which one can drop controls from
the toolbox, or place a control by code)

Because of the large border, some control too close of the border are on
top the border. I would like to prevent user to drop control where the
border is drawn.

Thanks for help !

Steph.
Jul 24 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You would have to override the WndProc method in your derived class and
handle the WM_NCCALCSIZE (0x83) message.

I haven't evaluated the entire code base; but, the CodeProject project
Themed RichTextBox (http://www.codeproject.com/cs/miscct...hTextBoxEx.asp)
is an example of doing this.

--
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"TheSteph" wrote:
Hi,

I've made a CustomPanel derived from the Panel class.

How can I set my own size of the "client area" of that CustomPanel ?

("client area" = Size of the rectangle in which one can drop controls from
the toolbox, or place a control by code)

Because of the large border, some control too close of the border are on
top the border. I would like to prevent user to drop control where the
border is drawn.

Thanks for help !

Steph.
Jul 24 '06 #2

P: n/a
Thanks for your reply and the Link !

I have another question :

Except very simple controls like aggregate of existing controls and
"client area painting", what is the best way to make CustomControl to be
used in .NET ? Is it to make it in C++ and then write a wrapper class in
..NET ?

Steph.


"Peter Ritchie [MVP]" <PR****@newsgroups.nospamwrote in message
news:76**********************************@microsof t.com...
You would have to override the WndProc method in your derived class and
handle the WM_NCCALCSIZE (0x83) message.

I haven't evaluated the entire code base; but, the CodeProject project
Themed RichTextBox
(http://www.codeproject.com/cs/miscct...hTextBoxEx.asp)
is an example of doing this.

--
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"TheSteph" wrote:
Hi,

I've made a CustomPanel derived from the Panel class.

How can I set my own size of the "client area" of that CustomPanel ?

("client area" = Size of the rectangle in which one can drop controls
from
the toolbox, or place a control by code)

Because of the large border, some control too close of the border are
on
top the border. I would like to prevent user to drop control where the
border is drawn.

Thanks for help !

Steph.


Jul 24 '06 #3

P: n/a
You can write custom controls in any .NET language you like--which is what
I'd recommend if you want to consume then in a .NET application.

If you want to aggregate one or more existing controls then I suggest
deriving from UserControl.

If you want to create a control that performs painting entirely itself, I
suggest deriving from Control. Or Button, if you want to handle mouse
clicks--it makes life a little easier.

--
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"TheSteph" wrote:
Thanks for your reply and the Link !

I have another question :

Except very simple controls like aggregate of existing controls and
"client area painting", what is the best way to make CustomControl to be
used in .NET ? Is it to make it in C++ and then write a wrapper class in
..NET ?

Steph.


"Peter Ritchie [MVP]" <PR****@newsgroups.nospamwrote in message
news:76**********************************@microsof t.com...
You would have to override the WndProc method in your derived class and
handle the WM_NCCALCSIZE (0x83) message.

I haven't evaluated the entire code base; but, the CodeProject project
Themed RichTextBox
(http://www.codeproject.com/cs/miscct...hTextBoxEx.asp)
is an example of doing this.

--
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"TheSteph" wrote:
Hi,
>
I've made a CustomPanel derived from the Panel class.
>
How can I set my own size of the "client area" of that CustomPanel ?
>
("client area" = Size of the rectangle in which one can drop controls
from
the toolbox, or place a control by code)
>
Because of the large border, some control too close of the border are
on
top the border. I would like to prevent user to drop control where the
border is drawn.
>
Thanks for help !
>
Steph.
>
>
>


Jul 24 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.