ScriptSpot home

Forum topic · General Scripting

scale big picture on a label

By artrender · 2013-04-03

Description

How to scale a picture (001.jpg) which has its own dimensions to display on a label


dotNetControl dropbtn "System.Windows.Forms.Label" pos:[50,4] width:155 height:121 

This code:


dropbtn.image = (dotNetclass "System.Drawing.image").fromfile "d:\folder\001.jpg"

is displaying a portion of the image inside 155x121px

Comments (12)
artrender

""

artrender

""

artrender

thx

It seams .ImageAlign works only with dropbtn.image not with dropbtn.BackgroundImage
But .image does not have ImageLayout property

:(

artrender

OH YESSSS

This is a GREAT Tool to use! I was working just like a stupid without knowing this!

artrender

COOOOOOOOOOOOOOL

THX! Its new for me!
I see .ImageAlign
but how to use it?
and .Left

Reply to artrender
Branko Živković

:)

when you find props then you need to go again but with props


showproperties dropbtn.ImageAlign

end you will end up with this

dropbtn.ImageAlign = dropbtn.ImageAlign.Left

Branko Živković

try by yourself this in the listener


dropbtn = dotNetobject "Label"
showproperties dropbtn -- to show all properties
showmethods dropbtn -- to show all methods
showevents dropbtn -- to show all events

I can't remeber if there "align" properties for bgimage but for image is there for sure, you can try to find

artrender

position

is it possible to align it to the left?
If I use zoom then it positions it in the center!

artrender

Thx barigazy! SOLVED

the only thing is


dropbtn.BackgroundImage = (dotNetclass "System.Drawing.image").fromfile...

but your suggestion is WONDERFUL!

Branko Živković

BackgroundImageLayout properties : Stretch ; None ; Center ; Zoom ; Tile

dotNetControl dropbtn "System.Windows.Forms.Label" pos:[50,4] width:155 height:121
dropbtn.BackgroundImage = dropbtn.BackgroundImage.fromfile "d:\folder\001.jpg"
dropbtn.BackgroundImageLayout = dropbtn.BackgroundImageLayout.Stretch