実行時にテキストを浮かべるように、テキストを実行時に挿入しようとしています。私はフローターを使用しようとしましたが、最終結果は画像の隣に1行しか設定できず、コンテンツの残りの部分が下に移動することです。テキスト間にテキストが移動するように、実行時に画像をWPF RichTextBoxに挿入するにはどうすればいいですか?
これは私が画像を挿入するために、これまで持っているコードです:
private Image SelectImage()
{
CommonDialog dialog = new CommonDialog();
dialog.InitialDirectory = System.Environment.SpecialFolder.MyDocuments.ToString();
dialog.Filter.Add(new FilterEntry(Properties.Resources.StrImageFormats, "*.jpg;*.jpeg;*.gif;*.png"));
dialog.Title = Properties.Resources.StrSelectImage;
if (dialog.ShowOpen())
{
string filePath = dialog.FileName;
BitmapImage bitmap = new BitmapImage(new Uri(filePath, UriKind.Absolute));
Image image = new Image();
image.Source = bitmap;
image.Width = bitmap.Width;
image.Height = bitmap.Height;
return image;
}
return null;
}
private void ButtonInsertImage_Click(object sender, RoutedEventArgs e)
{
Image image = SelectImage();
if (image != null)
{
TextPointer tp = RTB.CaretPosition.GetInsertionPosition(LogicalDirection.Forward);
Floater floater = new Floater(new BlockUIContainer(image), tp);
}
}
しかし、私はテキストの間に私のカーソルを設定すると、前のコードは、新しい行の残りの部分に画像を挿入テキストは画像の後に来る。このような少し:。
は「Loremのイプサム悲しみはeiusmod incididunt UT laboreらdoloreマグナaliquaユタenim広告ミニムveniam、QUISのnostrud exercitationのullamco laborisのNiSiのUTのaliquipの元をtemporんsedは、consectetur adipisicing ELIT、AMET座りますEAのcommodoのconsequat。
でreprehenderitでDuis auteのirureの悲しみ
[IMAGEはここCOMES] [IMAGEはここCOMES] [画像がHERE COMES] [IMAGEはここCOMES]
voluptate velit ESSE cillum dolore EUのfugiatのNULLAのpariatur例外的な症候群の患者は、 icia deserunt mollit anim id est laborum。 "テキストはイメージ(複数ラインオフ、右画像の左側にテキストを)の周りに浮かぶよう
はどうやって画像を挿入することができますか?
誰かがそれを行う方法の概念を持っているなら、私はここにそれを愛するでしょう。どうもありがとうございました。
あなたのソリューションはどれですか? –