Handling size of image after orientation change WP7 - image

I've got an Image with an overlay Canvas with some rectangles whose position is relative to image's size. The problem comes when I change the phone orientation, because image size changes (or at least, the renderization) but I can't manage to re-distribute the rectangles according to the new size, and the OrientationChanged event doesn't help me because it's fired before rendering the image (so all the rectangles go to (0,0))
Anyone can help me finding the correct event?

I'd either not use percentage widths or save them as exact values when first rendered/measured for one orientation. You can then adjust the dimensions relative to the orientation.
Update
If you can't get the exact values passed to you then you coudl load the image where teh user can't see it to measure it.
If you're getting the image and positions from an external source which always assumes a portrait orientation then why not just always display it as such in your app.

Finally got it!
The event I was looking for was the SizeChanged, I can't imagine how I didn't see it before...

Related

Get Image clicked position on DIfferent Resolution when the coordinates will be changed on different devices

I have a responsive Image which is working on different mobile resolution.
I want to Ask you, when I clicked on image at any place like top-left, left-botton etc, I want to get its(image) position.Means On which position it is being clicked. I tried the following scenario While Implementation of my Source Code, I get a coordinate on particular place on which The image is clicked.
Problem: Each of Mobile device has different resolution, So, For the same scenario, the coordinate will be differed. I required the implementation like the place of clicked image should be same on every resolution.
please tell me how can I resolve my Issues, And which one is best technology, tell me if anyone has knowledge to resolve this.
There have been some previous posts that try to achieve what you want, the basic logic can be achieved by calculating ratio:
var xratio=225/420; // 420-mouse-x-coord divided by 420
var yratio=38/38; // mouse-y-coord/element height
var x=320*xratio;
var y=38*yratio;
Please see the following references:
How to convert click coordinates of different dimensions into 320 dimension size?
https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect

how to make a bitmap to fit to the static picture control of a property sheet?

I am having a property sheet and added three pages.In the first page I added a picture control and in the properties of that picture control for "Image" property I am setting a bitmap.And was able to load very successfully.But,the problem here I faced when I run my exe then I am getting bitmap on the page header(which is some kind of banner for the page.)But what I noticed is there is some gap between the banner bitmap and the frame edge (which is occurring at the right top corner). And when I ran my xxx.exe on a Japanese machine then I had observed like the sheet is somewhat stretched and banner bitmap is not stretched completely till the edge of the sheet (top right corner)for Instance if we take a dialog on load a bitmap on it then we can observe that it is entirely got stretched till the edge.
So how can we avoid this issue like whatever the operating system it is and whatever the resolution it might be that banner should get stretched till the edge of the sheet.The gap has to be removed.
I am not loading the bitmap dynamically (setting in the properties.)
Can anyone please help me ti achieve this
The reason you get different results on different systems is that dialogs and controls are sized using "dialog units" which are based on the average size of the font, rather than an absolute number of pixels.
By default a static image control will resize itself to the size of the bitmap it's displaying. So if the dialog itself ends up bigger than normal (because the font is physically bigger), the picture control will appear to have shrunk, leaving a gap.
You could try setting the SS_REALSIZECONTROL style on the static control. The normal behavior of the static control (when displaying a picture) is to resize itself to the size of the bitmap, however the SS_REALSIZECONTROL style overrides that behavior and instead causes the bitmap to be resized to the size of the control. However the results of that may be less than optimal (e.g. the aspect ratio will probably be wrong), so instead you may want to look into scaling the bitmap yourself.

Geoserver ExternalGraphic draw icon incorrect

I run into a problem with Geoserver.
I'm drawing multiple icons which each represent a place all over my map using ExternalGraphic.
But geoserver didn't draw them correctly as they are. I attach an image as the result of geoserver drawing:
As you can see, the 2 car icon, both got cut off around 1 pixel comapre to its original size (1 got cut off from top down while another from bottom up). It make same icon look differentfrom place to place. And i think because of this cutting, after lose some pixel, they resize the image back to its original size, which make the $ on top left look blurry compare to the one next to it.
Also as in External graphic document mention, i didn't use any Size attribute so they won't get resize or anything. So i'm not sure why the image got cut off like that.
Any1 can help me about this case ? Thank you in advance.
I suggest you open a report at http://jira.codehaus.org/browse/GEOS attaching one of the images and your style document.

Center image horizontally & vertically on page with % margins and be resizable with window

It seemed so simple just a day ago, but I can't figure it out:
How do I center an image on a page, giving it fixed % margins (10% on all sides) and still have it scale with the window on resize?
It's very important that the page and the image display well on all platforms, without scrollers (!).
The page itself is very simple and only contains the image (which on different versions of the page has different dimensions), and a bar on the top with a link to send it to another page.
The max size of the image would be 1500x1000px, no minimum size.
I wholeheartedly hope someone can help me out with this, thanks so much!
Best way to do that is using JavaScript. Get the window size, subscribe for window.onresize event and update the image size and position accordingly.
Using CSS only will NOT work, because any position properties depend on the container. In your case the container is the window, which will size itself based on the content. This creates a sort of circular dependency (window size depends on the image, the image size and position depend on the window size).
For information about getting the exact available window size in cross-browser way you could check this post: Get the size of the screen, current web page and browser window - haven't done that in a while to provide you with exact code.
Also note that you don't mention keeping the aspect ratio of the image. If it should not be maintained there is no way to do it HTML/CSS only, because all operations with them do maintain AR of images.

cocoa mac osx grid display of images of different sizes

what i'm trying to do is displaying a set of images in a grid like fashion but with different sizes as for images in landscape or portrait position, this excludes using the NSCollectionView because the item prototype's size can only be set once...
i'd go and add subviews programmatically to a scrollView but this yet again when the window's size changes and the scrollView get a bigger width, there will be just blank spaces on the right side...
you can checkout the image below for a better understanding...
http://i.stack.imgur.com/NVJjP.png
thanks in advance you guys...
what i ended up doing was implementing a purely mathematic algorithm where i calculated the (x,y) position for every new added photo depending on the previously added photos and it did a pretty good job... the container holding the photos was embedded in a scrollView, needless to say that i had to calculate the height of this container as well.

Resources