Andromo - Start Making Apps - Free Signup

Announcement

Collapse
No announcement yet.

Function: Resize an Image to Fit your Project Window

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Function: Resize an Image to Fit your Project Window

    This function will make an Image Object resize to the size of your project. The function accepts 2 arguments: The first argument is the name of the image object that you would like to resize and the second is a string that represents the type of window you are using. The valid arguments are:
    • Standard (default)
    • Bordered
    • Flat

    Here is the function code:

    Code:
    function ResizeImageToWindow (ObjectName,Titled)
    	-- Titled can equal:
    	-- Standard (default)
    	-- Bordered
    	-- Flat
    
    	-- Get the size of that Image
    	size = Window.GetSize(Application.GetWndHandle());
    	-- If the window is Flat
    	if Titled == "Flat" then
    		Image.SetSize(ObjectName, size.Width, size.Height);
    	
    	-- If the window is Bordered 
    	elseif Titled == "Bordered" then
    		Image.SetSize(ObjectName, size.Width - 6, size.Height - 6);
    	
    	--Titled == "Standard" 
    	else 
    		Image.SetSize(ObjectName, size.Width - 10, size.Height - 36);
    	end
    Image.SetPos(ObjectName, 0, 0);
    end
    To call this function for an Image Object name "Image1" with the window type as "Flat":

    Code:
    ResizeImageToWindow("Image1","Flat");
Working...
X