zoukankan      html  css  js  c++  java
  • UltraGrid WinForms下,进行双击的一个问题。

    正在状态下双击没有任何问题,如果用户在进行滚动条,滚动时,因引发双击事件,而影响用户操作。

    下面这段代码,是处理这个问题的。在官方网站上找到。

      'Cast the sender into an UltraGrid
    Dim grid As UltraGrid = DirectCast(sender, UltraGrid)

    'Get the last element that the mouse entered
    Dim lastElementEntered As UIElement = Me.UltraGrid1.DisplayLayout.UIElement.LastElementEntered

    'See if there's a RowUIElement in the chain.
    Dim rowElement As RowUIElement
    If TypeOf lastElementEntered Is RowUIElement Then
    rowElement = DirectCast(lastElementEntered, RowUIElement)
    Else
    rowElement = DirectCast(lastElementEntered.GetAncestor(GetType(RowUIElement)), RowUIElement)
    End If

    If rowElement Is Nothing Then Return

    'Try to get a row from the element
    Dim row As UltraGridRow = DirectCast(rowElement.GetContext(GetType(UltraGridRow)), UltraGridRow)

    'If no row was returned, then the mouse is not over a row. 
    If (row Is Nothing) Then Return

    'The mouse is over a row. 

    'This part is optional, but if the user double-clicks the line 
    'between Row selectors, the row is AutoSized by 
    'default. In that case, we probably don't want to do 
    'the double-click code.

    'Get the current mouse pointer location and convert it
    'to grid coords. 
    Dim MousePosition As Point = grid.PointToClient(Control.MousePosition)

    'See if the Point is on an AdjustableElement - meaning that
    'the user is clicking the line on the row selector
    If Not lastElementEntered.AdjustableElementFromPoint(MousePosition) Is Nothing Then Return

    'Everthing looks go, so display a message based on the row. 
    MessageBox.Show(Me, "The key of the row is:" + row.Cells(0).Value.ToString())

  • 相关阅读:
    如何学习go源码
    最近打仁王2
    如何在时间复杂度为O(n)空间复杂度为O(1)的情况下完成链表的逆置
    漏洞复现-shellshock-bash破壳
    漏洞复现-aria2-任意文件写入
    漏洞复现-apereo-cas-4.1-rce
    漏洞复现-cgi-httpoxy
    漏洞复现-weblogic_weak_password-getshell
    sqlserver2008安装教程
    mysql内一些可以延时注入的查询语句
  • 原文地址:https://www.cnblogs.com/zqonline/p/1221915.html
Copyright © 2011-2022 走看看