Board index » delphi » D4: Misplacement of bitmaps in 16-bit color mode

D4: Misplacement of bitmaps in 16-bit color mode

Hello,

I got a bizarre problem for which I have no explanation.
Among all color depths available (ATI 8M AGP video card) only in 16-bit
mode sometimes (especially with 800x600 resolution) some of bitmaps
(TImage) are displayed in wrong positions - for example, instead of
proper location inside a form bitmap is displayed at top-left corner (0,
0) of physical screen, overlaying part of window caption bar. It happens
immediately after startup of a program in maximized state. If you
refresh window (for example, minimize and restore again) normal display
restores. When display is corrupted, all the controls underneath
misplaced bitmap (menus, buttons) are still active and react to the
mouse events, refreshing themselves after that.
What may be the problem?

Thank you very much in advance.
Dmitri Papichev.

 

Re:D4: Misplacement of bitmaps in 16-bit color mode


I think I've had a similar problem once. I remember to have written my own
button (the 100th time) and have called GetDC(0) - to get BitsPerColor of my
screen or something.

Because of that API-Call, sometimes things were drawn somewhere next to my
form (like at (0;0) of the screen) and other strange things happened, so I
decided to cut off the call again.

I think one shouldn't call GetDC() in a method like onPaint but in onCreate
and it worked for me. Maybe Delphi mixes some handles or something (might I
have found a real bug???) - btw, I'm using D 4.

Probably that's very far away form your problem but maybe it helps.

Ciao,
Stefan.

Re:D4: Misplacement of bitmaps in 16-bit color mode


Hello,

Still have the problem and no help... :-(

Quote
"Dmitri Papichev" <Dmitri.Papic...@iname.com> wrote in message

<news:38E2F5DF.5C1F06D2@iname.com>...
Quote
> If you refresh window (for example, minimize and restore again) normal
display
> restores.

I believe it is somehow related to bitmap cache (of the video driver?). What
I noticed is that this happens only once, when you start the program for the
first time during particular Windows session. Then, when you restore the
screen manually, it never comes back until you restart Windows (or possibly
after a long time of intensive work with other graphical applications).

Maybe somebody have some ideas?
May it be related to use of TJPEGImage instead of TBitmap?

Dmitri.

Re:D4: Misplacement of bitmaps in 16-bit color mode


Quote
"Dmitri Papichev" <Dmitri.Papic...@iname.com> wrote in message

news:8caim6$ae913@bornews.borland.com...

Quote
> Still have the problem and no help... :-(

Dmitri:

I hate to give an answer that has a low probability
of being correct, but here goes:

Do you have the latest video drivers?

Does the problem occur with various video drivers,
or just one machine?   If the problem occurs
on various machines, can you post a code
fragment that we could run to see the problem?

You could have a driver problem, which has
nothing to do with Delphi.

--
efg

Earl F. Glynn     E-Mail:  EarlGl...@att.net
Overland Park, KS  USA

efg's Computer Lab:  http://www.efg2.com/Lab

Re:D4: Misplacement of bitmaps in 16-bit color mode


Hello,

"Earl F. Glynn" <EarlGl...@att.net> wrote in message
news:8can08$dhe1@bornews.borland.com...

Quote
> Do you have the latest video drivers?

Yes I have.

Quote
> Does the problem occur with various video drivers,
> or just one machine?

Different machines with different flavour of ATI video cards.

Quote
> If the problem occurs
> on various machines, can you post a code
> fragment that we could run to see the problem?

Existing code - no. It is incorporated deeply in a huge (and
resource-consumtive - does it matter?) project. I am not sure will it happen
or not with a small project, I will try to reproduce it with some sample
code.

Quote
> You could have a driver problem, which has
> nothing to do with Delphi.

That's right, but the problem is definitely related to the Delphi tools
(components, etc.) used, so in this sense it has something to do with
Delphi. I cannot say for sure, but most likely problem was triggered by
using JPEG graphics instead of bitmaps on the forms. Why? I don't know.

Thanks,
Dmitri Papichev

Other Threads