Click here to Skip to main content
15,909,941 members
Home / Discussions / C#
   

C#

 
GeneralRe: Sorting DataGrid from DataView Problems Pin
sreejith ss nair28-Oct-04 22:57
sreejith ss nair28-Oct-04 22:57 
GeneralRe: Sorting DataGrid from DataView Problems Pin
Rebecca Gao29-Oct-04 4:02
Rebecca Gao29-Oct-04 4:02 
Generalforms maximize and minimum Pin
webhay28-Oct-04 16:05
webhay28-Oct-04 16:05 
GeneralRe: forms maximize and minimum Pin
Heath Stewart28-Oct-04 16:16
protectorHeath Stewart28-Oct-04 16:16 
GeneralGDI+ usercontrol problem Pin
bobrad28-Oct-04 15:44
bobrad28-Oct-04 15:44 
GeneralRe: GDI+ usercontrol problem Pin
Heath Stewart28-Oct-04 16:32
protectorHeath Stewart28-Oct-04 16:32 
GeneralRe: GDI+ usercontrol problem Pin
bobrad28-Oct-04 17:10
bobrad28-Oct-04 17:10 
GeneralRe: GDI+ usercontrol problem Pin
Heath Stewart29-Oct-04 5:37
protectorHeath Stewart29-Oct-04 5:37 
bobrad wrote:
my coding is getting complicated

Welcome to the world of development. Smile | :)

The solution I presented to you is the correct way of doing this. When you have rather complex graphics you should use double-buffering (that's debatable, but most would agree) so that you don't tie up the control thread.

When you're moving your control, form, whatever, or minimizing it or even passing your mouse over it (in Windows 2000 and newer, the mouse part isn't exactly true thanks to layered windows) everything in the invalidated ("affected") area is repainted. Efficient drawing routines only repaint what they have to (the invalidated region - not the entire client area). So, your form's OnPaint is already being called. And actually, that's not what even paints the form or most of the other controls in the BCL (base class library). Most controls merely encapsulate the Windows Common Controls (the same controls you see in most other applications and in Windows itself - they're native) and the Window APIs. Native code paints them using the WM_PAINT message, which in turn invokes the OnPaint method (from within WndProc - the window procedure encapsulated in managed code), which in turn fires the Paint event for a control.

The problem you're witnessing is something else. As I mentioned in my first reply, however, once you enable to those ControlStyles to get double-buffering, you're responsible for painting the background as well (the SystemColors class defines static properties to get you these colors).

As to why you're seeing two images, I'm not sure quite what you mean. Perhaps you could post a screenshot somewhere and paste the link here (you can take screenshots using the PrtScn keyboard button, or use Alt+PrtScn to take a screenshot of just the active window; then paste it into some graphics program or even Microsoft Paint (mspaint.exe) and save it).

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: GDI+ usercontrol problem Pin
bobrad29-Oct-04 6:07
bobrad29-Oct-04 6:07 
GeneralRe: GDI+ usercontrol problem Pin
Heath Stewart30-Oct-04 2:22
protectorHeath Stewart30-Oct-04 2:22 
Generalbind datagrid to a variable Pin
xiaowenjie28-Oct-04 15:29
xiaowenjie28-Oct-04 15:29 
GeneralRe: bind datagrid to a variable Pin
Heath Stewart28-Oct-04 16:13
protectorHeath Stewart28-Oct-04 16:13 
GeneralRe: bind datagrid to a variable Pin
xiaowenjie28-Oct-04 19:08
xiaowenjie28-Oct-04 19:08 
GeneralRe: bind datagrid to a variable Pin
Heath Stewart29-Oct-04 5:38
protectorHeath Stewart29-Oct-04 5:38 
GeneralRe: bind datagrid to a variable Pin
xiaowenjie29-Oct-04 6:15
xiaowenjie29-Oct-04 6:15 
GeneralRe: bind datagrid to a variable Pin
xiaowenjie29-Oct-04 6:29
xiaowenjie29-Oct-04 6:29 
GeneralRe: bind datagrid to a variable Pin
Heath Stewart30-Oct-04 2:58
protectorHeath Stewart30-Oct-04 2:58 
GeneralCOM Interopability problem Pin
iliyang28-Oct-04 10:57
iliyang28-Oct-04 10:57 
GeneralRe: COM Interopability problem Pin
Heath Stewart28-Oct-04 16:04
protectorHeath Stewart28-Oct-04 16:04 
QuestionKeeping context menu open even after clicking? Pin
Carl Mercier28-Oct-04 9:29
Carl Mercier28-Oct-04 9:29 
AnswerRe: Keeping context menu open even after clicking? Pin
Heath Stewart28-Oct-04 15:58
protectorHeath Stewart28-Oct-04 15:58 
GeneralRe: Keeping context menu open even after clicking? Pin
Carl Mercier29-Oct-04 3:50
Carl Mercier29-Oct-04 3:50 
GeneralRe: Keeping context menu open even after clicking? Pin
LongRange.Shooter29-Oct-04 6:50
LongRange.Shooter29-Oct-04 6:50 
AnswerRe: Keeping context menu open even after clicking? Pin
perlmunger29-Oct-04 9:09
perlmunger29-Oct-04 9:09 
Generalabout device instance enumeration Pin
momer28-Oct-04 9:07
momer28-Oct-04 9:07 

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.