如何将图像添加到文本中?我使用AvalonEdit。
必须是这样的:
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;
}
}
它收到了图像的名称。
下一步做什么?