FrontPage

 Rich Text Format (RTF, リッチテキストフォーマット) はWindows デフォルトインストールされているワープロソフトです。ここでは、C# で RTFファイルの扱う例を示します。

/// <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);
}


(画像の文字列を入力して下さい)

トップ   編集 凍結解除 差分 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019/12/02 (月) 12:47:18 (1632d)

e[NȂECir Yahoo yV LINEf[^[Ōz500~`I
z[y[W ̃NWbgJ[h COiq@COsیI COze