2012-11-08 67 views
16

我的C#應用​​程序包含具有簡單文本框和richtext框的網格。通常富文本框包含從其他地方複製和粘貼的富文本文件,並且通常rtf標記包括硬編碼字體大小(\ fsXX,XX爲半個點)。在大多數情況下,富文本字體大小與簡單文本字體大小相同或接近。在高DPI設置下調整RichTextBox字體大小

當DPI縮放設置爲默認的96富文本被扭曲爲其他任何如下:

a)當應用沒有被設置爲DPI知道富文本顯示比簡單的文字較小並且模糊。

b)當應用程序設置爲DPI意識時,富文本大於簡單文本。

是否有方法允許或強制richtext用簡單文本進行縮放,而不是直接編輯標記?

+0

你試過richtextbox v5嗎? – Jerry

+0

你可以添加一些截圖嗎?它可能會更容易幫助你... –

+0

爲簡單文本框定義的字體是如何處理點大小或像素的? –

回答

-1

請嘗試以下操作,它僅在.NET Framework 4.5.2及更高版本中受支持。微軟已經爲HighDpiAutoresizing覆蓋了更多的控制。

<appSettings> 
    <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" /> 
</appSettings> 
+0

此功能是在4.5.1中引入的,但仍不支持將Richtextbox升級到4.6.1。更多信息https://msdn.microsoft.com/en-us/library/ms171868%28v=vs.110%29.aspx –

0

嘗試其財產自動換行設置爲。可能解決問題

0

也許你可以使用一個WPF的形​​式,所以你不不用擔心de不同屏幕的DPI

1
<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> 
+0

下載tinymce 3派對工具也 –