Andromo - Start Making Apps - Free Signup

Announcement

Collapse

New Forum Software

If you're here, you've found the new home for our forums. There will be some bugs to iron out, so thanks for your patience...
See more
See less

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