如何将图像添加到文本(AvalonEdit)?

时间:2017-01-24 23:41:23

标签: c# wpf avalonedit

如何将图像添加到文本中?我使用AvalonEdit。

必须是这样的:

enter image description here

XAML

<Button Click="ImageOpenDialog">/></Button>

<avalonEdit:TextEditor
            Name="textEditor"
            FontFamily="Consolas"
            FontSize="10pt"
            SyntaxHighlighting="C#"
        >Welcome to AvalonEdit!
        </avalonEdit:TextEditor>

C#

public void ImageOpenDialog(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = ""; // Default file name
            dlg.DefaultExt = ".jpg"; // Default file extension
            dlg.Filter = "Text documents|*.jpg"; // Filter files by extension

            // Show open file dialog box
            Nullable<bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                string filename = dlg.FileName;

            }
        }

它收到了图像的名称。

下一步做什么?

0 个答案:

没有答案