Silverlight 4的上标在RichTextBox中的Web应用程序 [英] Silverlight 4 superscript in RichTextBox in Web Application

查看:121
本文介绍了Silverlight 4的上标在RichTextBox中的Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WPF标是:

        var currentAlignment = richTextBox.Selection.GetPropertyValue(Inline.BaselineAlignmentProperty);
        BaselineAlignment newAlignment = ((BaselineAlignment)currentAlignment == BaselineAlignment.Superscript) ? BaselineAlignment.Baseline : BaselineAlignment.Superscript;
        richTextBox.Selection.ApplyPropertyValue(Inline.BaselineAlignmentProperty, newAlignment);
        richTextBox.Selection.ApplyPropertyValue(Inline.FontSizeProperty, (double)8); 

但如何在Web应用程序实现Inline.BaselineAlignmentProperty?

But how to implement Inline.BaselineAlignmentProperty in Web Application ?

推荐答案

Silverlight不支持BaseLineAlignment,但你可以通过使用统一code ++实现标,只是把你的$ C $下面的C-落后,因此,将这样的伎俩。

Silverlight does not support BaseLineAlignment, however you could achieve superscript by using Unicode, just put the following in your code-behind and it will do the trick.

    string superscript = string.Empty;
    switch (SerialNo)
    {
        case 1:
            superscript = "\x00B9";
            break;
        case 2:
            superscript = "\x00B2";
            break;
        case 3:
            superscript = "\x00B3";
            break;
        case 4:
            superscript = "\x2074";
            break;
        case 5:
            superscript = "\x2075";
            break;
        case 6:
            superscript = "\x2076";
            break;
        case 7:
            superscript = "\x2077";
            break;
        case 8:
            superscript = "\x2078";
            break;
        case 9:
            superscript = "\x2079";
            break;
        default:
            superscript = "\x2070";
            break;
    }
    label.Content += superscript;

这篇关于Silverlight 4的上标在RichTextBox中的Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆