ユーザーが行 (または列) フィールドをクリックしたときにクリップボード内にコピーする方法を探しています。例: ユーザーが行 (または列) の「hello world」をクリックして ctrl+c を押すと、クリップボードに「hello world」が入力されます。
前もって感謝します!
ユーザーが行 (または列) フィールドをクリックしたときにクリップボード内にコピーする方法を探しています。例: ユーザーが行 (または列) の「hello world」をクリックして ctrl+c を押すと、クリップボードに「hello world」が入力されます。
前もって感謝します!
Ctrl + C
コピーのショートカットを実装しました。私がしていることはKeyDown
、WinForm コントロールのイベントを処理することです。
private static void OnKeyDown(object sender, KeyEventArgs e)
{
// Retrieve sender + view here
if (e.Control && e.KeyCode == Keys.C)
{
Clipboard.SetText(view.GetFocusedDisplayText());
e.Handled = true;
}
}
それが役立つことを願っています!
私はそれを行う方法を見つけました。PivotGridControl での MouseClick のイベント時。
Dim _point As Point = Nothing
Private Sub PivotGridControl1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles PivotGridControl1.KeyDown
If _point.IsEmpty Then
Else
If e.KeyCode = Keys.C AndAlso e.Control Then
Dim field As DevExpress.XtraPivotGrid.PivotFieldValueHitInfo = PivotGridControl1.CalcHitInfo(_point).ValueInfo
Clipboard.SetText(field.Value.ToString())
e.Handled = True
End If
End If
End Sub
Private Sub PivotGridControl1_MouseClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles PivotGridControl1.MouseClick
PivotGridControl1.OptionsBehavior.CopyToClipboardWithFieldValues = True
Dim pt As Point = New Point(e.X, e.Y)
If PivotGridControl1.CalcHitInfo(pt).HitTest = DevExpress.XtraPivotGrid.PivotGridHitTest.Value Then
_point = pt
Else
_point = Nothing
End If
End Sub
みんな助けてくれてありがとう