首页 > 解决方案 > 加载到富文本框中时,富文本文件中的 C# 图像不居中

问题描述

我在 OpenOffice Writer 中创建了一个富文本文件,其中包含一个居中对齐的图像,并尝试将文件加载到我的 C# WinForms 应用程序中的富文本框中。问题是图像左对齐而不是居中。这是我的代码:

private void DisplayStartPage()
{
    rtbMain.ReadOnly = false;
    using (MemoryStream ms = new MemoryStream(OurProject.MainPage.StartPageContent, 0, OurProject.MainPage.StartPageContent.Length))
    {
        ms.Write(OurProject.MainPage.StartPageContent, 0, OurProject.MainPage.StartPageContent.Length);
        ms.Position = 0;
        rtbMain.LoadFile(ms, RichTextBoxStreamType.RichText);
    }
    rtbMain.ReadOnly = true;
}

这个问题是由上面的代码引起的,还是我用来创建富文本文件的应用程序?

标签: c#winformsrichtextbox

解决方案


推荐阅读