L
Lee Gillie
I'm making a custom control. It draws a bitmap in OnPaint, then draws text
over it. This worked fine until I started embellishing the application which
uses the control. At times the image is shown with inverted colors.
Typically it happens when some other form is involved. For example, when I
use the print dialog, after the printing is done, it repaints the area the
print dialogs were shown, and the image is suddenly inverted. Another time
is in implementing a FIND function to search text, which is displayed over
the bitmap. When my FIND dialog closes, the image is shown inverted.
Sometimes I can do something that causes a repaint, and get it returned to
normal, but sometimes the inverted colors stick.
I am disposing every resource created with "New" in my OnPaint prior to exit
of the routine, and doing so in reverse order of creation. All of this is
bracketed within BeginContainer and EndContainer. I am using something I
found for flicker-free display in my NEW() sub for the control:
SetStyle(ControlStyles.DoubleBuffer, True)
SetStyle(ControlStyles.AllPaintingInWmPaint, True)
What could be causing the inverted colors?
over it. This worked fine until I started embellishing the application which
uses the control. At times the image is shown with inverted colors.
Typically it happens when some other form is involved. For example, when I
use the print dialog, after the printing is done, it repaints the area the
print dialogs were shown, and the image is suddenly inverted. Another time
is in implementing a FIND function to search text, which is displayed over
the bitmap. When my FIND dialog closes, the image is shown inverted.
Sometimes I can do something that causes a repaint, and get it returned to
normal, but sometimes the inverted colors stick.
I am disposing every resource created with "New" in my OnPaint prior to exit
of the routine, and doing so in reverse order of creation. All of this is
bracketed within BeginContainer and EndContainer. I am using something I
found for flicker-free display in my NEW() sub for the control:
SetStyle(ControlStyles.DoubleBuffer, True)
SetStyle(ControlStyles.AllPaintingInWmPaint, True)
What could be causing the inverted colors?