473,785 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2654
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****@newsgro ups.nospamwrote in message
news:76******** *************** ***********@mic rosoft.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****@newsgro ups.nospamwrote in message
news:76******** *************** ***********@mic rosoft.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
9484
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) conn, addr = s.accept() clientIP = addr
0
1355
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. Although there is an installation of the Visual Studio Whidbey I cannot install the client of SQL RPS on it. Any ideas ??? thanksalot
0
1463
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 clicks the submit button - a trip to the server is *not* made when using Internet Explorer. Validation works for the custom control, but only after a trip to the server. Does anyone know why this is the case and if there is a way to force...
2
1083
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 fixed.But it's kind of ugly since it will unnecessarily consume some of CPU cycles to process in the asp.net engine. I'm not sure if there is a way to get it work? Appreciate any help.
1
1328
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 windows form application that need to have a similar HTML Area that can input content or switch to view HTML code. I think this can make use of Rich Text Box, but are there any sample source code for using or any control available in market to buy??
0
1251
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 from fo:leader. It doesn't support leader-pattern-width either but this can be bypassed by using leader-pattern="use-content" as such: <fo:leader leader-pattern="use-content"> . </fo:leader>
0
1535
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 limit the size of the file at the client, and not check it once it gets to the server. Usha
0
3720
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 OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "Received an invalid column length from the bcp client for colid 54.". This has happened before also. Once I close the...
1
1802
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 an empty area, above the tab content: / Tab 1 caption \ / Tab 2 caption \ XXXX empty space XXXX
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10346
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.