C# でRTFフォーマットリッチテキストファイルへテキストを出力するサンプル
private void DrawImage(string title, string filePath)
{
this.richTextBox1.AppendText(title);
//Bitmap bitmap = new Bitmap(lstrFile,);
Image image = Image.FromFile(filePath);
Bitmap bitmap = new Bitmap(image, 500, 500);
Clipboard.SetDataObject(bitmap);
//Clipboard.SetImage(bitmap);
// Get the format for the object type.
DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Bitmap);
// After verifying that the data can be pasted, paste
if (this.richTextBox1.CanPaste(myFormat))
{
this.richTextBox1.Paste(myFormat);
}
else
{
MessageBox.Show("The data format that you attempted site is not supportedby this control.");
}
this.richTextBox1.AppendText("\r\n--------------------------------\r\n");
this.richTextBox1.SaveFile(@"C:\temp\richText.rtf", RichTextBoxStreamType.RichText);
}
0 件のコメント:
コメントを投稿