Recent

Author Topic: flickering main window  (Read 12366 times)

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: flickering main window
« Reply #15 on: October 28, 2014, 09:19:06 am »
@taazz: I am at a 7-year old notebook now (Win7 again). Still no flicker, even without Doublebuffering.

No difference here when the gradient is in the EraseBackground (after assigning the DC parameter of EraseBackground to the Canvas.Handle - without that the panel is black). (I'll test with the i5 in den evening)

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: flickering main window
« Reply #16 on: October 29, 2014, 09:23:55 pm »
the use of  TVisueel.Canvas.GradientFill() is much easier then the procedure i use. But with canvas.gradientfill the panel also flickers.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: flickering main window
« Reply #17 on: October 29, 2014, 09:57:32 pm »
Please post here a small and simple project which shows the flickering and gives us something to play with (just pas, lfm, lpr, and lpi, packed into a zip). What is your hardware and operating system?

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: flickering main window
« Reply #18 on: October 30, 2014, 09:09:35 pm »
Here is a project that i am starting with the panel.

The operating system is Windows 7 64 bit
Lazarus 1.2.4
The pc is a Dell M6800

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: flickering main window
« Reply #19 on: October 30, 2014, 09:37:16 pm »
I am willing to help you with your problem, but I am not willing to debug a full foreign program which I do not understand: The debugger crashes, some components are missing in my Lazarus, etc.

Please strip down everything not needed to a single form which shows the flickering
« Last Edit: October 30, 2014, 10:17:24 pm by wp »

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: flickering main window
« Reply #20 on: October 30, 2014, 10:17:35 pm »
Ok. I've downloaded your project. I see that "Panel1" is flickering.

Code: [Select]
procedure TFrm_main.FormPaint(Sender: TObject);
var
  r : trect;
begin
  Visueel.GradVertical(Frm_Main.Canvas,Frm_Main.ClientRect, clSkyBlue, clBlue);

  //Visueel.GradVertical(Panel1.Canvas,Panel1.ClientRect, clSkyBlue, clBlue);

    SetRect(R, 0, 0, Panel1.Width, Panel1.Height);
  panel1.Canvas.GradientFill(R,clskyblue,clblue,gdvertical);
end; 

Why in the world you don't create a custom component like wp explained and forget to use the paint event because: it's wrong to use it this way.

Here: http://forum.lazarus.freepascal.org/index.php/topic,26262.msg161227.html#msg161227
« Last Edit: October 30, 2014, 10:19:24 pm by 007 »

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: flickering main window
« Reply #21 on: October 30, 2014, 10:30:04 pm »
a complete empty project.
But i see a new post. I will try that in the weekend

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: flickering main window
« Reply #22 on: October 30, 2014, 10:54:42 pm »
Try the attached project. It has the gradient in the OnPaint event of the panel, not of the form - as 007 suggested. Since all panel painting is done by this procedure, the bevel and the caption are not drawn. If you need them you could look at the source of TCustomPanel.Paint and copy whatever you need.

Hansvb

  • Hero Member
  • *****
  • Posts: 618
Re: flickering main window
« Reply #23 on: November 01, 2014, 06:18:52 pm »
Great, it works verry good. Thanks.

lagprogramming

  • Sr. Member
  • ****
  • Posts: 406
Re: flickering main window
« Reply #24 on: November 01, 2014, 08:02:11 pm »

 

TinyPortal © 2005-2018