Multilanguage support for images in .Net - c#

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

Related

PivotViewer: Trading Card Visibility

I'm developing a PivotViewer (Silverlight 5) control that makes use of Semantic Zoom. There are two trading card templates, a "small" template displaying a low-resolution image, and a "big" template displaying a higher-resolution version of the same image and some text.
The low-resolution images are bundled in the XAP file. I'd like to dynamically download and display a trading card's higher-resolution image when the high-res version of that template becomes visible. But the best I've been able to do thus far is downloading the image when the trading card is selected through SelectionChanged, as seen here:
http://www.beerolf.com/pivottest/SilverlightLoadTest.html
(When you click a trading card, you should see text saying "Big!!!" indicating that the high-res image is being used. If you zoom into a trading card before clicking it, the original image remains.)
This is okay, but I don't want to force users to click trading cards to see higher-resolution images. Is there any way to determine which trading cards are currently visible?
The trick with multiple templates is to get the sizing right.
In the example that you gave, the templates are loading fairly large since there are not that many of them. In a case like that, you are most likely going straight to the larger template.
I would put the source url of the high-res in your larger templates, so they will load automatically. Is there a reason you aren't doing this?

Visual C#, How to display a `Unicode Character` in a label?

I have a Label and I want it to display a musical note.
This Note.
The problem is, I dont have any of the fonts that can display this note.
The fonts with support are LastResort Quivira and Symbola.
How can I display this character and make it so the compiled program will be able to display this character on another computer?
Not sure what UI framework you're using (WPF? WinForms? Browser?), but could you use Graphics Software to make a PNG or GIF of the note and display it that way? If you include the image as an Embedded Resource it would be easy to deploy with you're app.
I also see from your link the image is available in SVG format. There are libraries available for rendering SVG in WPF and WinForms.

Minimal Images & XAML-Defined shapes?

Is it good practise to build my UI with minimal images and define things like shapes/paths etc in the XAML?
If so, what are the advantages of this approach and/or other approaches?
In my opinion, having been creating UIs in WPF for the past 7 years, yes it is good practice in general. However, it depends entirely on the aesthetic you want to provide. Static images add to your application size but can be easily cached making them performant. They're a little inflexible as an image will distort the second you try to stretch it's dimensions. Images are fine if you don't need it to be dynamically sized.
However, you'll find that defining your UI entirely with markup can be a lot more complicated and can stray from your pixel-perfect mockups at various sizes. Gradients produced in WPF are inferior quality, you'll see visible banding if the gradient spans too far.
Performance doesn't play much of a role unless you intend to use a lot of DropShadowEffects (do not use legacy BitmapEffects). Stick to the lightweight elements (such as FrameworkElement) when templating controls.
By the way, there's a fantastic and recently free icon studio called Syncfusion Metro Studio 1 which is a fairly extensive icon pack that allows you to customize the size, background, foreground, & padding, then it lets you choose if you'd like to save it as an image or export it as a XAML path. The benefit of using XAML paths are that they will be perfectly scalable and you can dynamically change the fill color, could be set by the user even. Something that is possible with images using a custom color overlay shader but very resource intensive.

Creating an image containing text with drop shadow using WPF, but inside a ASP.NET web app

Ok, I have a rather strange request.
Due to the inconsistency in how different browsers support text with drop shadow, I was thinking that the text I need with drop shadow (some headers), I could create dynamically on the server side of my web app, and then pass the image to the browser instead of text directly.
I want to use WPF for this, since WPF has a lot of text manipulation built in, and it should be significantly easier to make text with drop shadow in WPF compared to GDI+.
So what I need to do is inside my Web App, create a WPF text element with the drop shadow effect, and save it inside an image (either to disk, or better yes pass it directly to the browser since I actually do not need to store the image since it will be specific for that request only).
I'm hoping for at least some pointers in the right direction :)
I just want to say, since this is unanswered and I don't use WPF that much, GDI+ would actually be pretty easy:
Draw text on image using the desired color of the shadow.
Do a box blur (or Gaussian).
(optional) Create another bitmap and do basically a watermark style draw (this would allow you to set opacity and thus soften the shadow, etc.)
Draw text again using color desired for the text
With that you would have yourself text with a drop shadow. There's about 10 different image processing libraries that make it rather simple (I will sadly do some self promotion and just say that Craig's Utility Library has a draw text function and box blur function in the Utilities.Media.Image.Image class, but there's tons of other packages you could use).

Choosing the right image size in Compact Framework

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.

Categories