Click here to Skip to main content
15,922,419 members
Home / Discussions / C#
   

C#

 
AnswerRe: Correct way to try-catch in foreach loop? Pin
James T. Johnson22-Jul-02 23:08
James T. Johnson22-Jul-02 23:08 
GeneralRe: Correct way to try-catch in foreach loop? Pin
leppie23-Jul-02 0:06
leppie23-Jul-02 0:06 
GeneralRe: Correct way to try-catch in foreach loop? Pin
James T. Johnson23-Jul-02 0:27
James T. Johnson23-Jul-02 0:27 
GeneralRe: Correct way to try-catch in foreach loop? Pin
leppie23-Jul-02 0:45
leppie23-Jul-02 0:45 
GeneralRe: Correct way to try-catch in foreach loop? Pin
James T. Johnson23-Jul-02 1:24
James T. Johnson23-Jul-02 1:24 
GeneralRe: Correct way to try-catch in foreach loop? Pin
jparsons23-Jul-02 1:46
jparsons23-Jul-02 1:46 
GeneralRe: Correct way to try-catch in foreach loop? Pin
leppie23-Jul-02 7:17
leppie23-Jul-02 7:17 
GeneralNon-client area of controls Pin
Kastro22-Jul-02 18:32
Kastro22-Jul-02 18:32 
I am creating a custom control called DropDownGroup that is similar to the functionality found in the main screen of Money 2002 (its basically a GroupBox that has a minimize and hide button in the header area).

I managed to create a functional version that inherits from Control that does all of its painting in OnPaint, and overrides DisplayRectangle so that a fully-docked child control will not cover the header area. However, just overriding DisplayRectangle doesn't disallow an undocked child control from being positioned on the header area (the GroupBox control has this unwanted feature as well).

To try and remedy this I decided to paint my header in the non-client area of the control. I overrode WndProc and intercepted WM_NCCALCSIZE, WM_HITTEST, WM_NCPAINT, and the WM_NC mouse messages. My WM_NCCALCSIZE handler modifies the client rectangle so that I have room for my header at the top. The WM_HITTEST handler returns a value for the caption or the client area. I paint my header in response to WM_NCPAINT, and I use the NC mouse messages in place of the OnMouse... handlers...

Everything was working fine (I have a custom designer class for the control, and when you try to drag a child to the header area it displays the 'no' icon just like with the title bar of a Form), except my buttons (not controls, just drawn ones) were not highlighting in response to the WM_NCMOUSEMOVE message when the cursor was over them. The functionality worked in that everything responded to the WM_NC button messages as expected. I just couldn't get the non-client area to redraw. I've tried a ton of things (sending WM_NCPAINTs, WM_PAINTs, and calling Invalidate, in various orders) but nothing seems to work.

Does anyone know how to get the non-client area of a Windows.Forms Control to repaint itself?

Why does sending WM_NCPAINT not actually cause a repaint of the non-client area (my WM_NCPAINT handler gets called and does its work, but nothing changes on the display)?

I have the ControlStyles AllPaintingInWmPaint, DoubleBuffer, and UserPaint all set. Could that be affecting it (by my testing it doesn't seem to since I've tried all combinations of the three)?

Thanks in advance for any help or guidance.
GeneralProperty Grid without an object Pin
Luis Alonso Ramos22-Jul-02 14:43
Luis Alonso Ramos22-Jul-02 14:43 
GeneralRe: Property Grid without an object Pin
James T. Johnson22-Jul-02 17:54
James T. Johnson22-Jul-02 17:54 
GeneralRe: Property Grid without an object Pin
Luis Alonso Ramos22-Jul-02 18:55
Luis Alonso Ramos22-Jul-02 18:55 
GeneralRe: Property Grid without an object Pin
James T. Johnson22-Jul-02 23:16
James T. Johnson22-Jul-02 23:16 
GeneralRe: Property Grid without an object Pin
leppie22-Jul-02 20:40
leppie22-Jul-02 20:40 
GeneralRe: Property Grid without an object Pin
Luis Alonso Ramos24-Jul-02 5:53
Luis Alonso Ramos24-Jul-02 5:53 
GeneralRe: Property Grid without an object Pin
Nathan Blomquist24-Jul-02 6:32
Nathan Blomquist24-Jul-02 6:32 
GeneralRe: Property Grid without an object Pin
Luis Alonso Ramos24-Jul-02 7:32
Luis Alonso Ramos24-Jul-02 7:32 
GeneralRe: Property Grid without an object Pin
Luis Alonso Ramos24-Jul-02 9:49
Luis Alonso Ramos24-Jul-02 9:49 
GeneralRe: Property Grid without an object Pin
Nathan Blomquist24-Jul-02 10:14
Nathan Blomquist24-Jul-02 10:14 
GeneralRe: Property Grid without an object Pin
Luis Alonso Ramos24-Jul-02 10:48
Luis Alonso Ramos24-Jul-02 10:48 
QuestionWhat override when the control is added? Pin
Zombies with Coffee, LLC22-Jul-02 11:04
professionalZombies with Coffee, LLC22-Jul-02 11:04 
AnswerRe: What override when the control is added? Pin
James T. Johnson22-Jul-02 13:35
James T. Johnson22-Jul-02 13:35 
GeneralRe: What override when the control is added? Pin
Zombies with Coffee, LLC23-Jul-02 5:18
professionalZombies with Coffee, LLC23-Jul-02 5:18 
GeneralCoping Files over the internet Pin
Orion Buttigieg22-Jul-02 5:53
Orion Buttigieg22-Jul-02 5:53 
GeneralRe: Coping Files over the internet Pin
jparsons22-Jul-02 6:44
jparsons22-Jul-02 6:44 
GeneralRe: Coping Files over the internet Pin
Orion Buttigieg22-Jul-02 7:16
Orion Buttigieg22-Jul-02 7:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.