Jump to content

Delphi image and form components


Recommended Posts

Hi all.

Question 1

I'm in the middle of creating a simple Delphi game, and am having a little trouble with the TImage component. Can't its shape be changed? I don't want to see a silhuette surrounding my character when he moves about on the screen. (E.g. when he moves onto a green surrounding, you can make out the rectangle black surounding him.)

My character's a little bitmap image.

Is there no component that can solve this problem? I.e. surround itself around the bitmap?

Question 2:

HOw do I load an image onto the form?

Link to comment
Share on other sites


Well, I happened to stumble upon this code on the internet:

Declare a TBitmap variable, initialise it during the form's creation, then set its parameters with the X, and YCoORds in the Form, and the name of the file I want.

private

Bmp: TBitmap;

public

{ public declarations }

end;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);

begin

Bmp := Bitmap.Create;

end;

// The rest deals with HInstance, handles, etc. which I dont understand..

// Needless to say, the code isn't working on my computer... Hmm, this is

// Windows API programming apparently

Link to comment
Share on other sites

I've finally managed to get the image on the form.

Anyway, here's how I did it:

Instead of directly loading the image on the form, I first saved it as a .res file in the Image editor, then used it in the program code...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...