0

How can i draw a picture on a TPanel? I also want to determine X,Y to define exact position on the Panel.

Kromster
  • 7,181
  • 7
  • 63
  • 111
Kermia
  • 4,171
  • 13
  • 64
  • 105
  • Yes I have. but still doesn't work and now i want to draw the picture using Windows API. – Kermia Aug 18 '11 at 10:30
  • Would you help me to draw the picture using Windows API? (canvas) – Kermia Aug 18 '11 at 10:46
  • Maybe you should ask a new question and *specificly* ask for a TCanvas solution. Or don't you even want that and want to do it winapi style? This one is answered. – Lars Truijens Aug 18 '11 at 11:21
  • @Lars - it relates to the [previous question](http://stackoverflow.com/questions/7090783/problem-with-tdxcomponentprinter-delphi) when the JPG file (without transparency) on a panel is printed [this way](http://i.stack.imgur.com/ewOER.jpg). These comments are the garbage from our previous conversation, but still I have no clue why this happens. –  Aug 18 '11 at 11:27

1 Answers1

8

Here is a simple code

var
  eu:TImage;
begin
  eu:=TImage.Create(Panel1);
  eu.Parent:=Panel1;
  eu.Top:=30; // You can adjust the position by using these coordinates
  eu.Left:=50;
  eu.Picture.LoadFromFile('D:\usb.ico'); // Load any supported image
  eu.Visible:=True;
end;
opc0de
  • 11,557
  • 14
  • 94
  • 187