wpf richtext框图像移动和flowdocument内容作为电子邮件

时间:2012-04-22 13:40:22

标签: wpf image richtextbox flowdocument

我有3个问题:

  1. 有没有办法使用鼠标在wpf richtextbox中移动图像?

    我将图像添加到rtb如下:

    BitmapImage bitmap = new BitmapImage(new Uri(@"C:\daf\apple.png"));
    Image image = new Image();            
    image.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    image.Source = bitmap;
    image.Width = 60;
    image.Height = 70;
    myRTB.BeginChange();
    TextPointer tp = myRTB.CaretPosition.GetPositionAtOffset(0, LogicalDirection.Forward);
    InlineUIContainer imageContainer = new InlineUIContainer(image, tp);
    myRTB.CaretPosition = imageContainer.ElementEnd;
    myRTB.EndChange();
    myRTB.Focus();
    
  2. 将图像放入rtb并在其上写一些单词后,我将其保存为html格式,我从richtextbox flowdocument内容中获取了html代码。但是当我重新使用相同的保存的html代码回到(html到xaml转换器)流文档时,图像大小非常大。

    在html代码中:

    "IMG src=\"file:///C:\daf\apple.png\" STYLE=\"width:60;height:70;font-family:tahoma;font-size:11;\"
    

    当我将RTB内容保存到html时,这是相同的HTML代码部分。但是当使用这个保存的html渲染回来时,图像非常大。

    出于测试目的,我在html代码中将宽度和高度值更改为30并尝试了。但是图像仍然显示得非常大。

    有任何想法吗?

  3. 是否有将wpf richtextbox flowdocument(包含图片)的内容作为电子邮件发送?

  4. 非常感谢。

0 个答案:

没有答案