/// <summary> /// RTFへ書き込む /// </summary> /// <param name="title"></param> /// <param name="filePath"></param> 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);
}