It is currently May 3rd, 2024, 8:17 pm

Image Scaling and positioning depending on screen resolution

Get help with creating, editing & fixing problems with skins
User avatar
kami
Posts: 39
Joined: July 3rd, 2010, 10:47 am
Location: Canosa di Puglia, Italy

Image Scaling and positioning depending on screen resolution

Post by kami »

Hi everyone!
I want to create a particular image meter which have to adapt itself to any screen resolution.
I tried to do this and it almost always works!
Here it is my .ini file's code:

Code: Select all

;~~~~~~~~~~~~~~~~~~~~~
;Object - Main Leaf
;~~~~~~~~~~~~~~~~~~~~~

[Rainmeter]
Author=My Name

[Leaf]
Meter=IMAGE
ImageName=...imagepath...\Leaf.png
W=#SCREENAREAWIDTH#
H=#SCREENAREAHEIGHT#

Well, the image Leaf.png has a resolution of 1920 x 1200 and it represents a black leaf which should appear on the screen at a precise position.
If the screen resolution is 1920 x 1200 the leaf matches perfectly with the background and it doesn't need scaling.
The built-in variables within the last two lines work perfect if i try to change my screen resolution and the image resizes and moves itself to the correct position of the background after refreshing the skin. I had no problems with my PC but when a friend tried this on his PC he told me that the positioning of the image didn't work.
I immediately thought that perhaps the differences between my screen and my friend's one are that mine is a widescreen, my friend's screen is not widescreen.
I linked the image to make this problem more simple to who will read and to who will have the patience to read this and to help me!
Thank you and sorry for bad english if i made any mistakes!

Link to the image: http://img683.imageshack.us/img683/5885/leafd.png
Last edited by kami on July 10th, 2010, 6:13 pm, edited 1 time in total.
User avatar
kami
Posts: 39
Joined: July 3rd, 2010, 10:47 am
Location: Canosa di Puglia, Italy

Re: Image Scaling and positioning depending on screen resolution

Post by kami »

Problem solved!
Sorry for the redundant topic!

Anyway the image moves correctly at any change in screen's resolution if you set in windows, the wallpaper as "extended" wallpaper.
It is unnecessary any change to the ini code.