17

My C# application includes grids with both simple text boxes and richtext boxes. Often the richtext boxes contain rich text copied and pasted from elsewhere, and often the rtf markup includes hardcoded font size (\fsXX, XX in half points). In most cases the rich text font size is the same or close to the simple text font size.

When the DPI scaling is set to anything other than the default 96 the rich text is distorted as follows:

a) When the application is NOT set to be DPI aware the richtext is shown smaller than the simple text and is blurry.

b) When the application is set to be DPI aware the rich text is larger than the simple text.

Is there a means to allow or force the richtext to scale with the simple text, short of editing the markup directly?

4

5 回答 5

0

尝试将其属性WordWrap设置为true

于 2015-02-04T12:09:53.400 回答
0

可能解决问题的一件事是在表单上设置 RichTextBox 并将表单的AutoScaleMode属性设置为NoneAutoScaleMode 枚举文档)

于 2015-05-01T16:23:37.453 回答
0
<script type="text/javascript">
tinyMCE.init({
        mode: "textareas",
        theme: "advanced",
        plugins: "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",
        theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_resizing: false,
        template_external_list_url: "js/template_list.js",
        external_link_list_url: "js/link_list.js",
        external_image_list_url: "js/image_list.js",
        media_external_list_url: "js/media_list.js"
    });
</script>


<td class="textboxmain" style="height:300px; "><asp:TextBox id="textbox1" TextMode="MultiLine" Height="100%" runat="server" placeholder="test............"></asp:TextBox></td>
于 2017-09-03T04:00:54.750 回答
-1

请尝试以下方法,它仅在 .NET Framework 4.5.2 及更高版本中受支持。Microsoft 已经涵盖了更多用于 HighDpiAutoresizing 的控件。

<appSettings>
   <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>
于 2014-06-25T15:49:16.133 回答
-1

也许你可以使用WPF表单,这样你就不用担心不同屏幕的de DPI了

于 2017-04-14T05:59:15.727 回答