DataGridViewClipboardCopyMode 列挙体とは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewClipboardCopyMode 列挙体の意味・解説 

DataGridViewClipboardCopyMode 列挙体

メモ : この列挙体は、.NET Framework version 2.0新しく追加されたものです。

DataGridView コントロールかクリップボード内容コピーするかどうかを示す定数定義します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Enumeration DataGridViewClipboardCopyMode
Dim instance As DataGridViewClipboardCopyMode
public enum DataGridViewClipboardCopyMode
public enum class DataGridViewClipboardCopyMode
public enum DataGridViewClipboardCopyMode
public enum DataGridViewClipboardCopyMode
メンバメンバ
 メンバ説明
Disableクリップボードへのコピー無効です。 
EnableAlwaysIncludeHeaderText選択されセルテキスト値をクリップボードコピーできます選択されセルを含む行および列のヘッダー テキスト含まれます。  
EnableWithAutoHeaderText選択されセルテキスト値をクリップボードコピーできます選択されセルを含む行または列の行ヘッダーまたは列ヘッダー テキストは、DataGridView.SelectionMode プロパティが RowHeaderSelect または ColumnHeaderSelect に設定されており、1 つ上のヘッダー選択されている場合にのみ含まれます。  
EnableWithoutHeaderText選択されセルテキスト値をクリップボードコピーできますヘッダー テキスト含まれません。 
解説解説
使用例使用例

DataGridView コントロールコピー有効にする方法次のコード例示しますコード例全体については、「方法 : ユーザーが、Windows フォーム DataGridView コントロールかクリップボード複数セルコピーできるようにする」を参照してください

Private Sub Form1_Load(ByVal
 sender As Object, _
    ByVal e As System.EventArgs) Handles
 Me.Load

    ' Initialize the DataGridView control.
    Me.DataGridView1.ColumnCount = 5
    Me.DataGridView1.Rows.Add(New String()
 {"A", "B", "C",
 "D", "E"})
    Me.DataGridView1.Rows.Add(New String()
 {"F", "G", "H",
 "I", "J"})
    Me.DataGridView1.Rows.Add(New String()
 {"K", "L", "M",
 "N", "O"})
    Me.DataGridView1.Rows.Add(New String()
 {"P", "Q", "R",
 "S", "T"})
    Me.DataGridView1.Rows.Add(New String()
 {"U", "V", "W",
 "X", "Y"})
    Me.DataGridView1.AutoResizeColumns()
    Me.DataGridView1.ClipboardCopyMode = _
        DataGridViewClipboardCopyMode.EnableWithoutHeaderText

End Sub

Private Sub PasteButton_Click(ByVal
 sender As Object, _
    ByVal e As System.EventArgs) Handles
 PasteButton.Click

    If Me.DataGridView1.GetCellCount( _
        DataGridViewElementStates.Selected) > 0 Then

        Try

            ' Add the selection to the clipboard.
            Clipboard.SetDataObject( _
                Me.DataGridView1.GetClipboardContent())

            ' Replace the text box contents with the clipboard text.
            Me.TextBox1.Text = Clipboard.GetText()

        Catch ex As System.Runtime.InteropServices.ExternalException
            Me.TextBox1.Text = _
                "The Clipboard could not be accessed. Please try
 again."
        End Try

    End If

End Sub
private void Form1_Load(object sender, System.EventArgs
 e)
{
    // Initialize the DataGridView control.
    this.DataGridView1.ColumnCount = 5;
    this.DataGridView1.Rows.Add(new string[]
 { "A", "B", "C", "D", "E" });
    this.DataGridView1.Rows.Add(new string[]
 { "F", "G", "H", "I", "J" });
    this.DataGridView1.Rows.Add(new string[]
 { "K", "L", "M", "N", "O" });
    this.DataGridView1.Rows.Add(new string[]
 { "P", "Q", "R", "S", "T" });
    this.DataGridView1.Rows.Add(new string[]
 { "U", "V", "W", "X", "Y" });
    this.DataGridView1.AutoResizeColumns();
    this.DataGridView1.ClipboardCopyMode = 
        DataGridViewClipboardCopyMode.EnableWithoutHeaderText;
}

private void PasteButton_Click(object sender,
 System.EventArgs e)
{
    if (this.DataGridView1
        .GetCellCount(DataGridViewElementStates.Selected) > 0)
    {
        try
        {
            // Add the selection to the clipboard.
            Clipboard.SetDataObject(
                this.DataGridView1.GetClipboardContent());
            
            // Replace the text box contents with the clipboard text.
            this.TextBox1.Text = Clipboard.GetText();
        }
        catch (System.Runtime.InteropServices.ExternalException)
        {
            this.TextBox1.Text = 
                "The Clipboard could not be accessed. Please try
 again.";
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からDataGridViewClipboardCopyMode 列挙体を検索した結果を表示しています。
Weblioに収録されているすべての辞書からDataGridViewClipboardCopyMode 列挙体を検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDataGridViewClipboardCopyMode 列挙体 を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataGridViewClipboardCopyMode 列挙体」の関連用語

DataGridViewClipboardCopyMode 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridViewClipboardCopyMode 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS