GrapeCity.Win.MultiRow Namespace > GcMultiRow Class > HitTest Method : HitTest(Point) Method |
Public Overloads Function HitTest( _ ByVal point As Point _ ) As HitTestInfo
Dim instance As GcMultiRow Dim point As Point Dim value As HitTestInfo value = instance.HitTest(point)
public HitTestInfo HitTest( Point point )
class HitTestDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); private FlowLayoutPanel panel = new FlowLayoutPanel(); private Label label = new Label(); public HitTestDemo() { this.Text = "HitTest Demo"; this.Size = new Size(700, 250); // Add MultiRow to Form this.gcMultiRow1.Dock = DockStyle.Fill; this.Controls.Add(this.gcMultiRow1); label.Height = 50; label.Dock = DockStyle.Bottom; label.BackColor = SystemColors.Info; label.Text = "Right Click the ColumnHeader, the clicked cell will be auto fitted."; this.Controls.Add(label); this.Load += new EventHandler(Form1_Load); this.StartPosition = FormStartPosition.CenterScreen; } private void Form1_Load(object sender, EventArgs e) { gcMultiRow1.Template = Template.CreateGridTemplate(10); gcMultiRow1.RowCount = 5; gcMultiRow1.MouseClick += new MouseEventHandler(gcMultiRow1_MouseClick); } void gcMultiRow1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { HitTestInfo info = gcMultiRow1.HitTest(e.Location); if (info.Type == HitTestType.ColumnHeader) { //If right click the ColumnHeader, the clicked cell will execute auto fit. this.gcMultiRow1.ColumnHeaders[info.SectionIndex].Cells[info.CellIndex].PerformHorizontalAutoFit(); } label.Text = info.ToString(); } }
Class HitTestDemo Inherits Form Friend WithEvents gcMultiRow1 As New GcMultiRow() Private panel As New FlowLayoutPanel() Private label As New Label() Public Sub New() Me.Text = "HitTest Demo" Me.Size = New Size(700, 250) ' Add MultiRow to Form Me.gcMultiRow1.Dock = DockStyle.Fill Me.Controls.Add(Me.gcMultiRow1) label.Height = 50 label.Dock = DockStyle.Bottom label.BackColor = SystemColors.Info label.Text = "Right Click the ColumnHeader, the clicked cell will be auto fitted." Me.Controls.Add(label) Me.StartPosition = FormStartPosition.CenterScreen End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load gcMultiRow1.Template = Template.CreateGridTemplate(10) gcMultiRow1.RowCount = 5 End Sub Private Sub gcMultiRow1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) Handles gcMultiRow1.MouseClick If e.Button = MouseButtons.Right Then Dim info As HitTestInfo = gcMultiRow1.HitTest(e.Location) If info.Type = HitTestType.ColumnHeader Then 'If right click the ColumnHeader, the clicked cell will execute auto fit. Me.gcMultiRow1.ColumnHeaders(info.SectionIndex).Cells(info.CellIndex).PerformHorizontalAutoFit() End If label.Text = info.ToString() End If End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2