Windows手机模拟器和真实设备上的特殊字符不一样

时间:2014-02-20 20:54:26

标签: windows-phone special-characters windows-phone-8-emulator writablebitmap

我的问题有点奇怪!!我将为Windows Phone 8创建一个带有可写位图的日历磁贴。所以我正在使用这个字符“”。 我正在使用下面的代码,一切正常,就像我在模拟器上所期望的那样。但是当我在真实设备上测试我的应用时,日历字符会出现不同

private void RenderText9()
    {
        int width = 159;
        int height = 159;
        string imagename = "SmallBackground";

        WriteableBitmap b = new WriteableBitmap(width, height);

        var canvas = new Grid();
        canvas.Width = b.PixelWidth;
        canvas.Height = b.PixelHeight;

        var background = new Canvas();
        background.Height = b.PixelHeight;
        background.Width = b.PixelWidth;

        SolidColorBrush backColor = new SolidColorBrush((Color)Application.Current.Resources["PhoneAccentColor"]);
        background.Background = backColor;

        var textBlock = new TextBlock();
        textBlock.Text = "25";
        textBlock.TextAlignment = TextAlignment.Center;
        textBlock.Margin = new Thickness(0, 72, 0, 0);
        textBlock.Width = 159;
        textBlock.TextWrapping = TextWrapping.Wrap;
        textBlock.Foreground = new SolidColorBrush(Colors.White);
        textBlock.FontSize = 35;

        var textBlock2 = new TextBlock();
        textBlock2.Text = "";
        textBlock2.TextAlignment = TextAlignment.Center;
        textBlock2.Margin = new Thickness(0, 40, 0, 0);
        textBlock2.Width = 159;
        textBlock2.TextWrapping = TextWrapping.Wrap;
        textBlock2.Foreground = new SolidColorBrush(Colors.White); //color of the text on the Tile    
        textBlock2.FontSize = 75;

        canvas.Children.Add(textBlock);
        canvas.Children.Add(textBlock2);

        b.Render(background, null);
        b.Render(canvas, null);
        b.Invalidate(); //Draw bitmap

        //Save bitmap as jpeg file in Isolated Storage    
        using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
        {
            using (IsolatedStorageFileStream imageStream = new IsolatedStorageFileStream("/Shared/ShellContent/" + imagename + ".jpg", System.IO.FileMode.Create, isf))
            {
                b.SaveJpeg(imageStream, b.PixelWidth, b.PixelHeight, 0, 100);
            }
        }
    }

这是模拟器和真实设备上的磁贴(注意区别)。 有谁知道任何解决方案???我不明白原因!! enter image description here

0 个答案:

没有答案