{"id":52,"date":"2007-05-08T15:43:36","date_gmt":"2007-05-08T13:43:36","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/graphic-timage-flickering\/"},"modified":"2007-05-11T19:39:00","modified_gmt":"2007-05-11T17:39:00","slug":"graphic-timage-flickering","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/graphic-timage-flickering\/","title":{"rendered":"Graphic: TImage flickering"},"content":{"rendered":"<p><strong>i&#8217;ve found this in a Newsgroup:<\/strong><\/p>\n<p>&#8212;&#8211;8<-----snip-----8<----snap-----\nIt is a Delphi 6 bug\n\nI have post the reason why Timgae is  flickering  to the newsgroup after\nexamine\nthe VCL source code of Delphi 5 and Delphi 6.\nIn Delphi 6  the Timage always redraw  the background except if stretch is\ntrue\n\nIn Delphi 5 if the bitmap covers all the array of the Timage (bitmap greater\nor equal image size) then the background is not redrawn.\nYou can change this in the Delphi 6 vlc source code its just one line . !!!\n\nHere is the listing of the TImage.PictureChanged in delphi 6 vcl\n\n\nDelphi 6\n\n[code lang=\"delphi\"]procedure TImage.PictureChanged(Sender: TObject);\nvar\n  G: TGraphic;\nbegin\n  if AutoSize and (Picture.Width > 0) and (Picture.Height > 0) then<br \/>\n SetBounds(Left, Top, Picture.Width, Picture.Height);<br \/>\n  G := Picture.Graphic;<br \/>\n  if G <> nil then<br \/>\n  begin<br \/>\n if not ((G is TMetaFile) or (G is TIcon)) then<br \/>\n   G.Transparent := FTransparent;<br \/>\n if (not G.Transparent) and Stretch and not Proportional then     \/\/ change<br \/>\nhere !!!!!<br \/>\n   ControlStyle := ControlStyle + [csOpaque]<br \/>\n else  \/\/ picture might not cover entire clientrect<br \/>\n   ControlStyle := ControlStyle &#8211; [csOpaque];<br \/>\n if DoPaletteChange and FDrawing then Update;<br \/>\n  end<br \/>\n  else ControlStyle := ControlStyle &#8211; [csOpaque];<br \/>\n  if not FDrawing then Invalidate;<br \/>\nend;<br \/>\n[\/code]<\/p>\n<p>The If-condition  should be changed to :<\/p>\n<p>[code lang=&#8221;delphi&#8221;] if (not G.Transparent) and (Stretch or  ((G.Width >= Width) and (G.Height<br \/>\n>= Height)))  and not Proportional  then<br \/>\n    ControlStyle := ControlStyle + [csOpaque]<br \/>\n[\/code]<\/p>\n<p> this adds to the condition  that if the bitmap covers the Timage then the<br \/>\nControlStyle is set to csOpaque and  so the  background is not redrawn every<br \/>\ntime the Image change.<br \/>\nGood Luck<\/p>\n<p>&#8212;&#8211;8<-----snip-----8<----snap-----\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>i&#8217;ve found this in a Newsgroup: &#8212;&#8211;8 0) then SetBounds(Left, Top, Picture.Width, Picture.Height); G := Picture.Graphic; if G nil then begin if not&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,83],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-Q","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/52"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=52"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/52\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}