i'm developping an application in CF 3.5 for windows Mobile 6 Pro using C# and i have a little issue requiring the advice of someone that knows better.
Basically, i want my application to run and scale on multiple device sizes and resolutions. Eveything scales properly but the images.
Some images that are for example 16X16 will look very small on a high resolution screen, so I want to display a 32X32 image, but I don't know what's the best way to decide which image size to display.
I have the option to check the dpi and then manually choose which image to display, but it seems like dirty work.
Isn't there any way to do it otherwise or what's the best way to do it?
I recommend that you create a layer between your forms and the images. Create a new class that would be responsible for returning the correct sized image. The code in your forms will rely on that to get the image and would have to know nothing about the sizes. For example:
mypicturebox.Image = ImageFactory.Image01;
The good thing is that you can use any technique you want inside the ImageFactory without affecting the rest of the code. The easiest thing to do is to check the size of the screen (using Screen.PrimaryScreen.WorkingArea) and do a manual decision.
Related
In my WinRT app I need to draw about 3000 objects on a canvas, where I can translate and zoom the view. Unfortunatley, after adding about 1500 lines to my canvas my Windows 8 App always crashes. What could be the best practice to achieve this?
One solution could be rendering everything on an image (how do I do this?). But then I loose comfort of easy access and editing of every element.
Also my scale and translate is very slow. But since I also need a big overview, it makes no sense to put only the objects of the visible area in the canvas, since on minimum zoom it's still everything and zoomed it's still very laggy cause of add and remove operations.
There are a couple of different things you should employ to have a smooth UX:
Use a Quadtree, whenever you add a shape to your canvas you also put it on your Quadtree. This will be helpful when you will zoom on a portion of the image: you will know what objects are in this portion of the image; you will render them again (against using a cached/pixellated version).
To overcome the potentially lengthy drawing process you could do the following:
display the portion of the cached image overview at the right scale
use a progress indicator to let know the user that the program is working render this portion
when the faint rendering is done, blit it on the screen
A concrete example: Google Maps does that.
I am new to windows phone development. I have an issue regarding screen size variation and I successfully handle the UI according to resolution but problem is that I don't have any idea how to change the size of text for different resolutions, use different images for different resolution etc.
As in Android we have different asset folders. We just put our data in folders and it will use best option automatically according to the screen size . I did a lot of Googling but did not find a suitable solution for it. Any idea how I can achieve this?
You shouldn't pay attention to screen sizes at all, everything is scaled up automatically and applications look good on smaller and larger screens.
If you want to customize the design for your screen depending on the screen size, DPI or something else, take a look at the proposed solution here: http://developer.nokia.com/community/wiki/Advanced_Techniques_for_Big_UI.
I am creating a Windows Store app, using XAML and C#.
If for example I run my application on the Windows Simulator (tablet), the layout is perfect. When I run my application on my local machine, the layout does not at all look like what it looks on the simulator.
How do I design my application to fit both perfectly?
Should I have multiple designs, and with start up check screen resolution and choose the layout best suited for that resolution?
Basically, how do I make sure my app will always look its best, no matter on what screen size it my run out there in the real world?
I am currently making use of a Grid for the layout of the controls, 3 columns, and 3 rows, with the Width and Height set to "*". I understand that with larger screen sizes, the column width and row heights will increase, and the opposite for smaller screen sizes.
I am basically just looking for good design practices, as to always try best and avoid massive layout changes.
I attended a Microsoft seminar lastly for 2 days. I asked if ViewBox exist for Windows Store Apps. They said "I don't think so" :)
But it exist :D
I'm sure it will be easy with a ViewBox http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.controls.viewbox
Put your design in a view box. That's all. We use it for silverlight.
I have a desktop app build using .net. I want it to support multilanguages. I am able to do that using resources. Issue is what should I do for images which have text? Should I include all images for separate languages? If so then this will make it difficult and also will increase its size.
I just read that in Android there is "9 patch image", isn't there something similar?
I wish to add background image, and write text on top of that. This background image should resize without change in quality of the image automatically to the size of text in that language.
I couldn't think of any way to avoid separate images with WinForms. WPF, no problem. Web app, no problem. I played around with both text and image on a Button control, but that does not scale fully. I tried using a label over a PIctureBox, but it is impossible to achieve transparency with a Label control. I also tried this using a WebBrowser control--such a thing could possibly work, but would take some further research and would probably change your deployment dramatically (since you would need to make the localization available from some http server).
So I think there is no easy way to do this--I could find nothing easier than maintaining the images separately.
In one of my projects, i had text displayed on top of images. Since the site was multilingual, so no text was part of the images. Instead text was displayed on top of the images, using css properties for absolute position. This had to be tested in all browsers, with multiple languages, as the text size varies in each language, this might break the UI. so enough space has to be provided for text considering all supported languages
Okay, here's what I'm trying to do. First I'll explain the end result I'm trying to achieve in case there are other ideas on how to do this.
I'm making a screen capture utility that takes a screen shot of only one window... my window (which I have total programmatic control over). However, this window may be much larger than the desktop of the computer on which the utility will run. The height, in particular, may reach several thousand pixels on a computer with 1024x768 resolution.
So I'm trying to capture the full window even though it's much larger than the screen. That's the end result I'm trying to achieve.
One hypothetical solution to this is to render the form/control on a graphics or screen object of some sort, and take the screen shot off of that object, instead of taking a screen shot of the physical desktop.
Essentially I need to draw controls on an imaginary screen that exists only in code and memory and I don't even know what to search for, so even ideas on what to put into Google (the TRUE search engine) would be helpful.
Any ideas? Thanks in advance!
EDIT: I'm using WinForms.
You didn't mention which technology your C# application uses, I'm assuming it's either WinForms or WPF.
If your implementation uses WPF, you could simply render it to a DrawingImage with the right dimensions - or even use the printing capabilities of WPF to "print" the contents of the window to an image in memory. Here's a decent example of printing in WPF that you may be able to adapt (if you're using WPF).
With a WinForms application, it is a bit trickier, because WinForm controls don't always scale well under higher resolutions, and can exhibit alignment problems. Here's a link that describes printing a WinForm screen to an image. It demonstrates printing a UserControl, but you should be able to adapt the implementation for your purposes.
Hmm, that's very odd. Have you actually written this form yet? The Form class is extremely insistent that its Size can never be larger than the screen. I've never found a workaround for this and have never seen one posted in a WF related forum.
Anyhoo, you can't make a screen shot because you don't have enough screen. The only other option is Control.DrawToBitmap().
"Several thousands of pixels" is liable to get you into trouble with OutOfMemory exceptions on 32-bit operating systems when you try to create the bitmap. Not because you don't have enough memory but because there isn't an empty hole left in the virtual memory address space that is large enough to fit the bitmap The only good workaround for that is a 64-bit operating system.