Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

How to make a simple Window and show an Image from Art.mul

Post Reply
elemeNt X
Posts: 8
Joined: 04.05.2011 16:55

How to make a simple Window and show an Image from Art.mul

Post by elemeNt X »

Hey guys, with help of Vizit0r I will give you an example how to show an Item image from Art.mul :D

Code: Select all

Program New;
Var
MainForm : TSTForm;
Image : TSTImage;
Quit : Integer;

Procedure FormClose(Sender: TObject; var Action : TCloseAction);  
Begin
 a.Free();
 raiseException(erCustomError,'User Input on GUI. Script Stop!');
 Quit := 1;
End;
       
Begin

 Quit := 0;

 MainForm := TSTForm.Create;					// This will create the form to start work on it.
 MainForm.OnClose := @FormClose;					// This will be function called when you close then Form window
 MainForm.Width := 400;						// This will set the Form width
 MainForm.Height := 200;						// This will set the Form height
 MainForm.caption := 'Hello';						// This will be the name that will appear on top of Form, in the blue bar
 MainForm.Color := clBtnFace;					// This will set the color of the Window
 MainForm.BorderStyle := bsSingle;					// This will set the style of Window
 MainForm.Visible := True;						// This will make the Window be visible
 MainForm.Show;								// This will show the Window

// Now the part that get the item image from art.mul

 Image := TSTImage.Create(MainForm);			// This will create the image on the 'MainForm' Form
 Image.Left := 50;						// This will set the position from left of 'MainForm' Window
 Image.Top := 50;						// This will set the position from top of 'MainForm' Window
 Image.AutoSize := True;					// This will make the image autosize
 Image.Transparent := True;					// This will remove the white background from the image
 Image.Center := True;						// This will center the image

 Image.Picture.Bitmap := GetStaticArt($2F59,$0000);	// This will store and show the bitmap of item type $2F59 and color $0000, you can 'paint' the picture just changing the hue in the GetStaticArt function.

 While Quit <> 1 Do
  Wait(200);

End.
Attachments
gui for stealth.png
gui for stealth.png (4.83 KiB) Viewed 11020 times
Last edited by elemeNt X on 31.01.2013 0:05, edited 1 time in total.
Crome696
Novice
Novice
Posts: 67
Joined: 04.03.2012 18:57
Location: Germany
Contact:

Re: How to a simple Window (Form) and show an Image from Art

Post by Crome696 »

Thank you for the Snippet, i think a few people will love it :)
Stealth Development Team & Support
admir
Novice
Novice
Posts: 97
Joined: 28.10.2008 20:44

Re: How to make a simple Window and show an Image from Art.m

Post by admir »

Good. its usefull. Thx
MB can show an image from GUMP.mul?
For example show that is dressed on Char
Crome696
Novice
Novice
Posts: 67
Joined: 04.03.2012 18:57
Location: Germany
Contact:

Re: How to make a simple Window and show an Image from Art.m

Post by Crome696 »

admir wrote:Good. its usefull. Thx
MB can show an image from GUMP.mul?
For example show that is dressed on Char
Currently not Supported for Gumps when i saw it right..
Stealth Development Team & Support
Post Reply