Problem Source: http://www.cnblogs.com/del/archive/2009/03/15/1412384.html#1477470
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, extctrls; Type tform1 = Class (tform) button1: tbutton; button2: tbutton; button3: tbutton; button4: tbutton; Procedure button1click (Sender: tobject); Procedure submit (Sender: tobject); Procedure alert: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses JPEG, gifimg, pngimage; {display jpg image} procedure tform1.button1click (Sender: tobject); var JPG: Tsung image; begin JPG: = Tsung image. create; JPG. loadfromfile ('C: \ temp \ test.jpg '); canvas. draw (0, 0, JPG); JPG. free; end; {display PNG Image} procedure tform1.button2click (Sender: tobject); var PNG: tpngimage; begin PNG: = tpngimage. create; PNG. loadfromfile ('C: \ temp \ test.png '); canvas. draw (0, 0, PNG); PNG. free; end; {display GIF image} procedure tform1.button3click (Sender: tobject); var GIF: tgifimage; begin GIF: = tgifimage. create; GIF. loadfromfile ('C: \ temp \ test.gif '); canvas. draw (0, 0, GIF); GIF. free; end; {display GIF animation} procedure tform1.button4click (Sender: tobject); var GIF: tgifimage; begin GIF: = tgifimage. create; GIF. loadfromfile ('C: \ temp \ test.gif '); GIF. animate: = true; with timage. create (Self) Do begin parent: = self; left: = 0; top: = 0; picture. assign (GIF); end; GIF. free; end.