Board index » delphi » HELP: My Component Flickers

HELP: My Component Flickers

Below is the source code of a demo and the source of the
component.  If you'd like to try and help...I'd really
appreciate it.  I'm still looking at the problem, but
can't figure it out.  I'm using repaint, which is supposed
to paint the image without erasing the previous.  I've used
this before in non-components and it works fine.  I've even
downloaded animation components to look at their code.
I can't see what I'm doing wrong.

One other side note:  If you get rid of the OnBmpChanged
function, the bmp does not show up at run-time.  Why??

This is my first component.  The demo should explain
(or show) what is happening.  The code should be
pretty much self-explanatory...I'm drawing gauges and text
on an offscreen bitmap, then blitting to the component
canvas.

--
Michael Heacock         "Hail hail the lucky ones,
Praxis Technical Group   I refer to those in love"
Nanaimo BC Canada                -- Eddie Vedder

  components.zip
< 1K Download
 

Re:HELP: My Component Flickers


Quote
Mike Heacock wrote:

> Below is the source code of a demo and the source of the
> component.  If you'd like to try and help...I'd really
> appreciate it.  I'm still looking at the problem, but
> can't figure it out.  I'm using repaint, which is supposed
> to paint the image without erasing the previous.  I've used
> this before in non-components and it works fine.  I've even
> downloaded animation components to look at their code.
> I can't see what I'm doing wrong.

> One other side note:  If you get rid of the OnBmpChanged
> function, the bmp does not show up at run-time.  Why??

> This is my first component.  The demo should explain
> (or show) what is happening.  The code should be
> pretty much self-explanatory...I'm drawing gauges and text
> on an offscreen bitmap, then blitting to the component
> canvas.

Flickering: Add this line at end of CSimDevice.Create
  ControlStyle := ControlStyle + [csOpaque];

OnBmpChanged: Can't see the the bmpBuff gets its Width and Height set
unless you explicitly set the property BGBitmap, or BmpChanged is
called. (Just a quick look through, I've probably missed something)

--
|----------------------------------------------------------------------------|
|Need a custom component? Late on a project? Could use an
util?              |
|DOS Device driver? A VxD? NT drivers or services? Applications of any
kind? |
|Low rates, fast
delivery!                                                   |
|----------------------------------------------------------------------------|
Erik Sperling Johansen <e...@info-pro.no>

Re:HELP: My Component Flickers


I had a similar problem but the method below won't compile as ControlStyle
is read only, I am inherting from TCustomControl, I did manage to improve
things by trapping the erase background message...

Erik Sperling Johansen <e...@info-pro.no> wrote in article
<330D647C....@info-pro.no>...

Quote
> Mike Heacock wrote:

> Flickering: Add this line at end of CSimDevice.Create
>   ControlStyle := ControlStyle + [csOpaque];

Re:HELP: My Component Flickers


ControlStyle := ControlStyle + [csOpaque];

This will compile withing a component, which is where I'm
adding the code...in the Create event of a component I
created.

It wouldn't compile within a project (.exe).  I've tried
and it works like a charm.

--
Michael Heacock         "Hail hail the lucky ones,
Praxis Technical Group   I refer to those in love"
Nanaimo BC Canada                -- Eddie Vedder

Re:HELP: My Component Flickers


Mike

Change your redraw procedure to:

procedure CSimDevice.Redraw;
begin
  paint;
end; {procedure CSimDevice.Redraw}

HTH
Allan Carlton

Quote

> Below is the source code of a demo and the source of the
> component.  If you'd like to try and help...I'd really
> appreciate it.  I'm still looking at the problem, but
> can't figure it out.  I'm using repaint, which is supposed
> to paint the image without erasing the previous.  I've used
> this before in non-components and it works fine.  I've even
> downloaded animation components to look at their code.
> I can't see what I'm doing wrong.

> One other side note:  If you get rid of the OnBmpChanged
> function, the bmp does not show up at run-time.  Why??

> This is my first component.  The demo should explain
> (or show) what is happening.  The code should be
> pretty much self-explanatory...I'm drawing gauges and text
> on an offscreen bitmap, then blitting to the component
> canvas.

> --
> Michael Heacock         "Hail hail the lucky ones,
> Praxis Technical Group   I refer to those in love"
> Nanaimo BC Canada                -- Eddie Vedder

>     ---------------------------------------------------------------

>                   Name: components.zip
>    Part 1.2       Type: Zip Compressed Data
>                         (application/x-zip-compressed)
>               Encoding: base64

Other Threads