473,770 Members | 4,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Non Client Area

How do you access the non-client area of a control for painting or resizing
the client area.

Thanks any help would do.
Nov 17 '05 #1
3 6703

Patrick Blackman wrote:
How do you access the non-client area of a control for painting or resizing
the client area.

Thanks any help would do.
You handle the WM_NCPAINT message in your windows processing handler.From a previous post from a microsoftie:


protected override void WndProc(ref Message msg)
{
// Call the base paint FIRST.
base.WndProc(re f msg);
const int WM_NCPAINT = 0x85;
if (msg.Msg == WM_NCPAINT)
{
// Do your painting here.
}

}

matt

Nov 17 '05 #2
Thanks for the info, what I want to do is to access the non client area of a richtextbox so I can paint line numbers at the side, therefore I need to reduce the client rectangle/area, any ideas on this.

I was trying this bit of code but got errors memory:

[DllImport("kern el32", CharSet = CharSet.Auto)]

internal static extern void CopyMemory (WINDOWPOS pDst , IntPtr pSrc , int ByteLen);

[DllImport("kern el32", CharSet = CharSet.Auto)]

internal static extern void CopyMemory(NCCA LCSIZE_PARAMS pDst, IntPtr pSrc, int ByteLen);
[DllImport("kern el32", CharSet = CharSet.Auto)]

internal static extern void CopyMemory(IntP tr pSrc, NCCALCSIZE_PARA MS pDst, int ByteLen);

[StructLayout(La youtKind.Sequen tial)]

internal class NCCALCSIZE_PARA MS

{

[MarshalAs(Unman agedType.ByValA rray, SizeConst = 3)]

public RECT[] rgxRects;

public IntPtr lppos ;

public NCCALCSIZE_PARA MS()

{

}

}

[StructLayout(La youtKind.Sequen tial)]

internal class WINDOWPOS

{

public IntPtr hwnd;

public IntPtr hWndInsertAfter ;

public int x;

public int y;

public int cx;

public int cy;

public int flags;

public WINDOWPOS() { }

}
//WinProc override
protected override void WndProc(ref Message m)

{

case WM_NCCALCSIZE :

NCCALCSIZE_PARA MS aNCCS = new NCCALCSIZE_PARA MS();

Marshal.PtrToSt ructure(m.LPara m, aNCCS);

WINDOWPOS aWinPos = new WINDOWPOS();

// Get the non-client calc size rectangle and window position

CopyMemory( aNCCS, m.LParam, Marshal.SizeOf( aNCCS));

//CopyMemory( aWinPos, aNCCS.lppos, Marshal.SizeOf( aWinPos));

//Populate the non-client rectangle UDT information

aNCCS.rgxRects[0].Left =aWinPos.x;

aNCCS.rgxRects[0].Top = aWinPos.y;

aNCCS.rgxRects[0].Right =75;// aWinPos.x + aWinPos.cx;

aNCCS.rgxRects[0].Bottom = 75;// aWinPos.y + aWinPos.cy;
//Make an adjustment for our line numbers

aNCCS.rgxRects[0].Left = aNCCS.rgxRects[0].Left + 75;

//Duplicate these values in the other rectangle

aNCCS.rgxRects[1] = aNCCS.rgxRects[0];

//copy it back to the lParam pointer address so the process uses the information.

CopyMemory(m.LP aram, aNCCS, Marshal.SizeOf( aNCCS));

base.WndProc(re f m);

}

"Matt" <ma********@spr ynet.com> wrote in message news:11******** **************@ g49g2000cwa.goo glegroups.com.. .

Patrick Blackman wrote:
How do you access the non-client area of a control for painting or resizing
the client area.

Thanks any help would do.


You handle the WM_NCPAINT message in your windows processing handler.
From a previous post from a microsoftie:


protected override void WndProc(ref Message msg)
{
// Call the base paint FIRST.
base.WndProc(re f msg);
const int WM_NCPAINT = 0x85;
if (msg.Msg == WM_NCPAINT)
{
// Do your painting here.
}

}

matt

Nov 17 '05 #3

Patrick Blackman wrote:
Thanks for the info, what I want to do is to access the non client area of a richtextbox so I can paint line numbers at the side, therefore I need to reduce the client rectangle/area, any ideas on this.


NcCalcSize is the message to catch. What error did you get and what
line?

Matt

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3094
by: subash | last post by:
Hi All how to create controls in non-client area of forms or usercontrol.Can any one help in getting information on this or solution for this. regards subash
0
1327
by: Ken Seier | last post by:
Hello, I'm trying to create a fairly standard custom container control by using the ScrollableControlDesigner attribute. My control has a title bar at the top, and I would like to exclude the title bar area from the container client area in both the designer and at run time so that adding contained controls or using docking does not overlap/underlap the title bar. I have been unable to find anyplace to edit the client area in the...
0
1563
by: Harry_Crow | last post by:
I'm painting in the Non Client area of the control. I'm facing some flicker problem. Is it possible to achive Double buffer painting in Non Client area. The SetStyle with ControlStyles.DoubleBuffer and ControlStyles.AllPaintinginWmPaint set to true only works for Client area painting, Please Help me if any one has some Idea. Thank you,
10
4118
by: Woody Splawn | last post by:
I have been developing a ClientServer application on one machine at my office but the time has come to transfer it to the customer. The customer is running a Windows 2000 local area network. I will keep a copy of the applicaiton and all it's code on one of the client machines connected to the local area network at the customers. This machine has a full blown copy of Visual Studio 2003. SQL Server 2000 is the back-end, both at my office...
3
1713
by: ljlevend | last post by:
I know that Invalidate allows you to invalidate only part of the client area and Refresh allows you to force the entire client area to update right now, but is there any way to force part of the client area (e.g., only the invalidated regions) to update right now (without using DoEvents)? Thanks, Lance
0
1943
by: helldiversafe-news | last post by:
Hi all, I will use a apache soap service with an .net c# client and have a problem with an complex array: <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body>
3
2654
by: TheSteph | last post by:
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
3
4180
by: Harry_Crow | last post by:
I wanted to change the Non client area height. This was not possible in the existing Form TitleBar. So I set the FormBorderStyle= None and I calculated and introduced the Non Client area myself. So the height and width of the Non Client area is 15 and 4 pixels border respectively. Also the Nonclient area has been painted as per our need. Now all is fine but in design time when the controls in the form are anchored other than top, left. Now...
2
2245
by: steve | last post by:
I have a configuration file where I save the size of the client area when my application last run. I would like to be able to set the size of the form's client area at start up to this value but if I use VS's designer tool I have to set a value in efffect for the client area which it uses to initially draw the control. Can I force the designer to use the value I have in my configuration file. I realize I can fix up the code the designer...
0
9602
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
9439
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
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10017
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
9882
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
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.