知识大全 捕捉DataGrid的双击事件
Posted 事件
篇首语:倘若心中愿意,道路千千条。倘若心中不愿意,理由万万个。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 捕捉DataGrid的双击事件相关的知识,希望对你有一定的参考价值。
捕捉DataGrid的双击事件 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
<! StartFragment >Option Strict OffOption Explicit On Imports Microsoft VisualBasicImports SystemImports System ComponentModelImports System DataImports System DrawingImports System <a _blank >Windows</a> FormsNamespace <a _blank >DataGrid</a>DoubleClick Public Class Form Inherits Form Private WithEvents dataGrid As DataGrid Private WithEvents myDataSet As DataSet Private gridMouseDownTime As DateTime Private ponents As Container Public Sub New() MyBase New() InitializeComponent() gridMouseDownTime = DateTime Now SetUp() End Sub Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If (Not (ponents) Is Nothing) Then ponents Dispose() End If End If MyBase Dispose(disposing) End Sub Private Sub SetUp() MakeDataSet() dataGrid SetDataBinding(myDataSet Customers ) AddCustomDataTableStyle() End Sub Private Sub MakeDataSet() myDataSet = New DataSet( myDataSet ) Dim tCust As DataTable tCust = New DataTable( Customers ) Dim cCustID As DataColumn cCustID = New DataColumn( custID ) Dim cCustName As DataColumn cCustName = New DataColumn( custName ) Dim cCurrent As DataColumn cCurrent = New DataColumn( custCity ) tCust Columns Add(cCustID) tCust Columns Add(cCustName) tCust Columns Add(cCurrent) myDataSet Tables Add(tCust) Dim newRow As DataRow Dim i As Integer i = Do While (i < ) newRow = tCust NewRow newRow ( custID ) = i ToString() tCust Rows Add(newRow ) i = (i + ) Loop tCust Rows( )( custName ) = 【孟宪会之精彩世界】 tCust Rows( )( custName ) = net_lover tCust Rows( )( custName ) = //<a _blank >XML</a> sz luohuedu<a _blank &</a>/ tCust Rows( )( custCity ) = 北京 tCust Rows( )( custCity ) = 上海 tCust Rows( )( custCity ) = 河南 End Sub Private Sub AddCustomDataTableStyle() Dim ts As DataGridTableStyle ts = New DataGridTableStyle() ts MappingName = Customers ts AlternatingBackColor = Color LightGray Dim TextCol As DataGridTextBoxColumn TextCol = New DataGridTextBoxColumn() TextCol MappingName = custID TextCol HeaderText = 序号 TextCol Width = AddHandler TextCol TextBox MouseDown New MouseEventHandler(AddressOf TextBoxMouseDownHandler) AddHandler TextCol TextBox DoubleClick New EventHandler(AddressOf TextBoxDoubleClickHandler) ts GridColumnStyles Add(TextCol) TextCol = New DataGridTextBoxColumn() TextCol MappingName = custName TextCol HeaderText = 姓名 TextCol Width = AddHandler TextCol TextBox MouseDown New MouseEventHandler(AddressOf TextBoxMouseDownHandler) AddHandler TextCol TextBox DoubleClick New EventHandler(AddressOf TextBoxDoubleClickHandler) ts GridColumnStyles Add(TextCol) TextCol = New DataGridTextBoxColumn() TextCol MappingName = custCity TextCol HeaderText = 地址 TextCol Width = AddHandler TextCol TextBox MouseDown New MouseEventHandler(AddressOf TextBoxMouseDownHandler) AddHandler TextCol TextBox DoubleClick New EventHandler(AddressOf TextBoxDoubleClickHandler) ts GridColumnStyles Add(TextCol) dataGrid TableStyles Add(ts ) End Sub Friend WithEvents Label As System Windows Forms Label Private Sub InitializeComponent() Me dataGrid = New System Windows Forms DataGrid() Me Label = New System Windows Forms Label() CType(Me dataGrid System ComponentModel ISupportInitialize) BeginInit() Me SuspendLayout() dataGrid Me dataGrid CaptionVisible = False Me dataGrid DataMember = Me dataGrid HeaderForeColor = System Drawing SystemColors ControlText Me dataGrid Location = New System Drawing Point( ) Me dataGrid Name = dataGrid Me dataGrid Size = New System Drawing Size( ) Me dataGrid TabIndex = Label Me Label Location = New System Drawing Point( ) Me Label Name = Label Me Label Size = New System Drawing Size( ) Me Label TabIndex = Me Label TextAlign = System Drawing ContentAlignment MiddleCenter Form Me AutoScaleBaseSize = New System Drawing Size( ) Me ClientSize = New System Drawing Size( ) Me Controls AddRange(New System Windows Forms Control() Me Label Me dataGrid ) Me Name = Form Me Text = 鼠标双击事件的例子 CType(Me dataGrid System ComponentModel ISupportInitialize) EndInit() Me ResumeLayout(False) End Sub <STAThread()> _ Public Shared Sub Main() Application Run(New Form ()) End Sub Private Sub TextBoxDoubleClickHandler(ByVal sender As Object ByVal e As EventArgs) MessageBox Show( TrueDoubleClick ) End Sub Private Sub TextBoxMouseDownHandler(ByVal sender As Object ByVal e As MouseEventArgs) If (DateTime Now < gridMouseDownTime AddMilliseconds(SystemInformation DoubleClickTime)) Then MessageBox Show( GridDoubleClick + CType(sender TextBox) Text) End If Label Text = TextBoxMouseDownHandler End Sub Private Sub dataGrid _MouseDown(ByVal sender As System Object _ ByVal e As System Windows Forms MouseEventArgs) Handles dataGrid MouseDown gridMouseDownTime = DateTime Now Label Text = dataGrid _MouseDown End Sub Private Sub Label _Click(ByVal sender As System Object ByVal e As System EventArgs) _ Handles Label Click Label Text = End Sub Private Sub Form _Click(ByVal sender As System Object ByVal e As System EventArgs) _ Handles MyBase Click Label Text = End Sub End ClassEnd Namespace cha138/Article/program/net/201311/11554相关参考
小技巧:JavaSwing中使用双击事件 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 直接在J
为.net中的ListBox控件添加双击事件 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 我在
如何捕捉控制台程序的关闭事件最近要做个控制台程序在用户关闭程序的时候要做些处理但控制台程序却没有WinForm的Closing或Closed事件想想只能用API才捕捉消息来实现了代码如下 using
对xml文件的记录进行删除修改或增加新记录 利用了datagrid控件的sortmand事件对xml里的记录进行排序 email: &nb
MouseHover(鼠标悬停)事件发生于鼠标悬停在窗体控件上一段时间之后 同样在如图所示的Form属性窗口找到MouseHover事件项双击该项进入该事件代码编辑文件Formcs并对其编写事件
KeyDown(按键)用于响应键盘中首次按下的键 KeyDown事件同样可以在如图所示的Form属性窗口中找到双击该项为其编写事件响应如下 privatevoidForm_KeyDown(ob
原版win7系统镜像怎么用硬盘安装原版的win7ISO镜像可以直接解压到C盘以外的地方,然后双击setup.exe就可以开始安装(在xpvistawin7里面只要都是32位或者64位的双击就能安装wi
由于浏览器是无状态的在这时候捕捉浏览器关闭会出现两种情况 真正的关闭浏览器(a点击关闭按钮b右击任务栏关闭c按alt+F关闭) 刷新浏览器 那如何
VisualC#通用模块开发:DataGrid控件 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
常见Datagrid错误 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 摘要学习如何避免在使用A