473,320 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
3 2631
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: polarpolar | last post by:
Hi, All : I wrote a simple server in Python, and I can get the client IP by following script: s = socket.socket( socket.AF_INET, socket.SOCK_STREAM ) s.bind( (HOST, PORT) ) s.listen(1)...
0
by: Cave | last post by:
Is there a way to install the SQL Reporting Services Client on Whidbey ? The installer searches the system for an installation of Visual Studio 2003 in order to install the client part of SQL RPS....
0
by: Ron | last post by:
I've an aspx page with a custom (composite) server control and a TextBox, both with RequiredFieldValidators. I'd like the custom control to behave the same way the default TextBox does when one...
2
by: walter | last post by:
Hi , when I apply expression on a pure HTML control , like<img src=<%$ resources:...% > , I got a compilation error and said this is not allowed ,after I add "runat=server", the problem is...
1
by: Jason Ho | last post by:
Hi All, In web page, we can make a HTML Area text box for user to input content (e.g. text, font size, picture) and switch to HTML code with some WYSIWYG control. I am writing a VB.NET...
0
by: Jean-François Michaud | last post by:
Hello, I was wondering if there was a way around leader-alignment. XSF V3.4 from Antenna House seems to be a very powerful FO -> PDF converter, but it doesn't support this particular attribute...
0
by: Usha | last post by:
Using the Input control form for uploading a file to an IIS/ASP.net server. How can I check the file size on the client using javascript prior to posting the form and file for upload? I want to...
0
by: gelangov | last post by:
I am trying to bulk load a flat file into a SQL server table (2005) using the integration services. I got the following error: ] Error: An OLE DB error has occurred. Error code: 0x80004005. An...
1
by: \(O\)enone | last post by:
I've added a TabControl to my WinForms app, and added a couple of tabs to the control. The result is that the top strip of the TabControl contains the two tabs, and then to the right of them is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.