473,461 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Custom control borders/WM_NCPAINT

I have create a Panel subclass that I can resize at runtime. I want to
draw resizing handles that accurately track the panel frame.
So far I have tried drawing them in the wm_sizing handler, the wm_paint
handler and the overriden OnPaint event and cannot get an accurate
rectangle to use to paint the handles. The handles sort of follow the
border but not exactly. It seems that it might work to do it at the same
time the border is drawn with the WM_NCPAINT but I don't know how to get
the frame rectangle from the hrgn. Anyone able to point me in the right
direction?

Jim Margarit
Nov 17 '05 #1
1 6349
You're going about it the wrong way. It's not the frame that should size the
handles but the handles that should resize the frame. It needs to be a
seperate control using reflection or a specialized window that sits on top
of the object you're resizing.

If you're interested in a commercial solution check out the RectTracker on
XRay Tools.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Jim Margarit" <ma**@drmargaritDOT.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have create a Panel subclass that I can resize at runtime. I want to draw
resizing handles that accurately track the panel frame.
So far I have tried drawing them in the wm_sizing handler, the wm_paint
handler and the overriden OnPaint event and cannot get an accurate
rectangle to use to paint the handles. The handles sort of follow the
border but not exactly. It seems that it might work to do it at the same
time the border is drawn with the WM_NCPAINT but I don't know how to get
the frame rectangle from the hrgn. Anyone able to point me in the right
direction?

Jim Margarit

Nov 17 '05 #2

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

Similar topics

0
by: Mike Pierson | last post by:
Hello all: I have a C# windows application that needs a custom calendar. I need this calendar displayed as a month view. I also need the ability to insert/manipulate images and text into each...
3
by: Nick Haines | last post by:
I need to write my own custom text edit control.. but I'm not sure where to start - I've never written a custom control... the features I want are somewhat similar to the VS .Net text editor - text...
1
by: Barguast | last post by:
Is there any way to restrict the area in a control that can be painted? For example, if I wanted to enforce a three-pixel wide border around my control, how would I go about it? Thanks
2
by: Benny Raymond | last post by:
How would you go about custom drawing the title bar of a form? I'd like to change it so that I can add different colors to my title and also change how the close button works (since I override it...
3
by: Kyle Fitzgerald | last post by:
I've started a web control library project and can build my own controls to add to the toolbox in the .NET environment. The problem I'm having is I want to create a control just like the HTML...
3
by: M O J O | last post by:
(using VB.net) Hi, I've created my own component inheriting from the RichTextBox. I override the WndProc's WM_NCPAINT so I can draw my own border (color). When I set my BorderColor...
31
by: jcrouse | last post by:
Is there a quick and easy way to change the color of a label controls border from the default black to white? Thank you, John
0
by: diatom | last post by:
Hello, In a windows application, I just created a new custom user control. This custom user control is simply a dialog that I want to re-use. When my dialog opens, by default it is located in...
0
by: evan | last post by:
Hi, Is anyone able to give me an example on how to scroll the contents of a ListBox without forcing the user to click on the scroll up/down internal buttons? ============================== I...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.