Board index » delphi » TGraphicControl screen corruption win95

TGraphicControl screen corruption win95

I am having a problem with a class descended from the TGraphicControl class.
The program will correctly display our TGraphicControl classes until we
page-down for about the third time, at this point the controls are drawn all
over the place.  (If we scroll down, the problem does not occur.)
This problem only shows itself when running under windows 95, there's no
problem under NT.

Help

Mike Durham.

The problem has been seen before, note the following from 1995.
Hi fellow Delphi users.

As part of my research, I have wrote a embedded system design tool using
Delphi 2.01. I have developed it under NT4.0, and have experienced no
problems :-)  However, when I run the application under Win95, I get
strange screen corruption problems.

I have derived the "design element" (TGUIComponent) on the screen from the
TGraphicControl component, and I have overridden the Paint procedure to
render the relevant image within the TGraphicControl canvas. To me that
should ensure that any draw operations within the Paint procedure (with
Canvas do .... end) are constrained within the Bounds() of that
TGraphicControl?

When I have up to 3 of these TGUIComponents on a form, there are no
problems. However, when the fourth is drawn, then strange things happen. It
appears as if the components draw themselves relative to the absolute
(top,left) of the screen, rather than from the (top,left) of the parent
form.

I've checked that the Parent property is set (code will barf with an
assertion exception in the paint method if it isn't set to the parent
form).

Best part of it - under NT4.0, I've never got it to fail. Just seeing if
any fellow Delphi-nauts out there have experienced similar problems and got
any ideas for work-arounds or possible solutions?

 

Re:TGraphicControl screen corruption win95


The problem is the fact that some where there are tomany "GETDC" or
"GetWindowDC" with
now ReleasDC in the order..
 you can only have up to 5 generally...
 ..
Quote
mikedurham wrote:
> I am having a problem with a class descended from the TGraphicControl class.
> The program will correctly display our TGraphicControl classes until we
> page-down for about the third time, at this point the controls are drawn all
> over the place.  (If we scroll down, the problem does not occur.)
> This problem only shows itself when running under windows 95, there's no
> problem under NT.

> Help

> Mike Durham.

> The problem has been seen before, note the following from 1995.
> Hi fellow Delphi users.

> As part of my research, I have wrote a embedded system design tool using
> Delphi 2.01. I have developed it under NT4.0, and have experienced no
> problems :-)  However, when I run the application under Win95, I get
> strange screen corruption problems.

> I have derived the "design element" (TGUIComponent) on the screen from the
> TGraphicControl component, and I have overridden the Paint procedure to
> render the relevant image within the TGraphicControl canvas. To me that
> should ensure that any draw operations within the Paint procedure (with
> Canvas do .... end) are constrained within the Bounds() of that
> TGraphicControl?

> When I have up to 3 of these TGUIComponents on a form, there are no
> problems. However, when the fourth is drawn, then strange things happen. It
> appears as if the components draw themselves relative to the absolute
> (top,left) of the screen, rather than from the (top,left) of the parent
> form.

> I've checked that the Parent property is set (code will barf with an
> assertion exception in the paint method if it isn't set to the parent
> form).

> Best part of it - under NT4.0, I've never got it to fail. Just seeing if
> any fellow Delphi-nauts out there have experienced similar problems and got
> any ideas for work-arounds or possible solutions?

Re:TGraphicControl screen corruption win95


On Sat, 6 May 2000 01:12:20 +0100, "mikedurham"

Quote
<mikedur...@breathemail.net> wrote:
>I am having a problem with a class descended from the TGraphicControl class.
>The program will correctly display our TGraphicControl classes until we
>page-down for about the third time, at this point the controls are drawn all
>over the place.  (If we scroll down, the problem does not occur.)
>This problem only shows itself when running under windows 95, there's no
>problem under NT.

I've seen this happen if you mix API function calls with TCanvas
method calls, and neglect to take into account the fact that
TCanvas.Handle can change.

In other words, you shouldn't access TCanvas.Handle, store the value
in a variable, and then expect the value to be valid later.

-Steve

Other Threads