msdn.vb.lang论坛网格 [英] msdn.vb.lang forum grid

查看:82
本文介绍了msdn.vb.lang论坛网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有,


你注意到当你在这个论坛中鼠标悬停每个线程时如何突出显示

,我怎么能做同样的事情在我的数据网格的赢取形式中?


谢谢,

rodchar

解决方案

< blockquote>


你需要为此制作自己的columnstyle。这是一个专栏<

正在进行的工作。


代码


Imports System.Drawing


进口System.Drawing.Drawing2D


进口System.Windows.Forms


进口系统。反思


导入System.ComponentModel


公共类HotTrackTextBoxColumn


继承DataGridTextBoxColumn


Dim c As Integer


Dim rectPaint As New RectangleF


Dim fnt As New Font(MyBase.TextBox .Font.Name,MyBase.TextBox.Font.Size,

FontStyle.Underline)


Dim WithEvents dg As DataGrid


Dim oldCell As New Point(-1,-1)


Dim isInCell As Boolean = False


Public Sub HandleMouseMove( ByVal sender As Object,ByVal e As

MouseEventArgs)处理dg.MouseMove


Dim g As Graphics = dg.CreateGraphics


Dim bounds As Rectangle


Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point(e.X,e.Y))


isInCell =(hti.Row> -1和hti.Column = c)


静态bRedraw As Boolean = False


如果isInCell那么


Dim pt As Point


pt =新点(hti.Row,hti.Column)


如果不是pt.Equals (oldCell)然后


''


''创建一个我们希望数据网格重绘的区域


''所以数据网格不会闪现。


''


Dim pthToRedraw As New Drawing2D.GraphicsPath


Dim rgnToRedraw作为地区


Dim rCell As Rectangle = dg.GetCellBounds(pt.X,pt.Y)

>
pthToRedraw.AddRectangle(rCell)


如果oldCell.X> -1然后


''


''必须重绘最后一个单元格


''


pthToRedraw.AddRectangle(dg.GetCellBounds(oldCell.X,oldCell.Y))


结束如果


rgnToRedraw =新区域(pthToRedraw)


dg.Invalidate(rgnToRedraw)


结束如果


''


''标记数据网格重绘


''


bRedraw = True


oldCell = pt


Else


''


''只在需要时重绘


''


如果bRedraw那么


dg.Invalidate(dg.GetCellBounds(oldCell.X,oldCell.Y))


结束如果


bRedraw = False


oldCell =新点(-1,-1)


结束如果


End Sub


受保护的重载覆盖Sub Paint(ByVal g As System.Drawing.Graphics,

ByV al bounds As System.Drawing.Rectangle,ByVal source As

System.Windows.Forms.CurrencyManager,ByVal rowNum As Integer,ByVal

backBrush As System.Drawing.Brush, ByVal foreBrush As System.Drawing.Brush,

ByVal alignToRight As Boolean)


静态bPainted As布尔值= False


''


''我们第一次画画获得对数据网格的引用


''所以我们可以消耗它的事件


''


如果不是bPainted那么


dg = Me.DataGridTableStyle.DataGrid


c = -1


每个grdCol As DataGridColumnStyle在

Me.DataGridTableStyle.GridColumnStyles


c + = 1


如果grdCol.MappingName = Me.MappingName然后退出


下一页

结束如果


bPainted = True


MyBase.Paint(g,bounds,source,rowNum,backBrush,foreBrush, alignToRight)


Dim pnHot As New Pen(SystemColors.HotTrack)


Dim brHot As New SolidBrush(Color.FromArgb(128,SystemColors.HotTrack))


''透过画笔


如果MouseOverCell(rowNum)那么


bounds.Inflate(-1 ,-1)


g.FillRectangle(brHot,bounds)


g.DrawRectangle(pnHot,bounds)


结束如果


Dim r作为新的RectangleF(bounds.X,bounds.Y,bounds.Width,bounds.Height)


rectPaint = r


End Sub


Public ReadOnly属性MouseOverCell(ByVal rownum As Integer)As Boolean


获取


Dim pt As New Point(rownum,c)


返回pt.Equals(oldCell)


结束获取


结束物业


结束班级

链接示例
http://www.onteor asoftware.com/Downl...lumnstyles.zip


Ken

-------------- ---------

" rodchar" < RO ***** @ discussions.microsoft.com>在消息中写道

news:46 ********************************** @ microsof t.com ...

嘿所有,


你注意到当你在这个论坛中鼠标悬停在每个帖子上时如何

亮点,我怎么能用我的

数据网格在我的胜利形式中做同样的事情?


谢谢,

rodchar


我很感激。


" Ken Tucker [MVP]"写道:



你需要为此制作自己的columnstyle。这是一个我正在研究的专栏。

代码

Imports System.Drawing

Imports System.Drawing。 Drawing2D

进口System.Windows.Forms

Imports System.Reflection

Imports System.ComponentModel

Public Class HotTrackTextBoxColumn

继承DataGridTextBoxColumn

Dim c As Integer

Dim rectPaint为新的RectangleF

Dim fnt As New Font(MyBase) .TextBox.Font.Name,MyBase.TextBox.Font.Size,
FontStyle.Underline)

Dim WithEvents dg As DataGrid

Dim oldCell As New Point( -1,-1)

Dim isInCell As Boolean = False
公共Sub HandleMouseMove(ByVal发送者为对象,ByVal e As
MouseEventArgs)处理dg.MouseMove

Dim g As Graphics = dg.CreateGraphics

Dim bounds As Rectangle

Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point( eX,eY))

isInCell =(hti.Row> -1 A. nd hti.Column = c)

静态bRedraw As Boolean = False

如果isInCell那么

Dim pt As Point

pt =新点(hti.Row,hti.Column)

如果不是pt.Equals(oldCell)那么

''

''创建一个我们希望数据网格重绘的区域

''所以数据网格不会闪现。

''

昏暗pthToRedraw作为新Drawing2D.GraphicsPath

Dim rgnToRedraw作为地区

Dim rCell As Rectangle = dg.GetCellBounds(pt.X,pt.Y)

> pthToRedraw.AddRectangle(rCell)

如果oldCell.X> -1然后

''

''必须重绘最后一个单元格

''

pthToRedraw.AddRectangle( dg.GetCellBounds(oldCell.X,oldCell.Y))

结束如果

rgnToRedraw =新区域(pthToRedraw)

dg.Invalidate( rgnToRedraw)

结束如果

''

''标记数据网格重绘

''

bRedraw = True

oldCell = pt

其他

''

''只有重绘时需要

''

如果bRedraw那么

dg.Invalidate(dg.GetCellBounds(oldCell.X,oldCell.Y))

结束如果

bRedraw = False

oldCell =新点(-1,-1)

结束如果
End Sub

受保护的重载覆盖Sub Paint(ByVal g As System.Drawing.Graphics,
ByVal bounds As System.Drawing.Rectangle,ByVal source As
System.Windows.Forms.CurrencyManager,ByVal rowNum As Integer,ByVal
backBrush As Syste m.Drawing.Brush,ByVal foreBrush As System.Drawing.Brush,
ByVal alignToRight As Boolean)

静态bPainted As Boolean = False

''

''我们第一次画画得到数据网格的参考

''所以我们可以消耗它的活动

''
如果没有bPainted那么

dg = Me.DataGridTableStyle.DataGrid

对于每个grdCol As DataGridColumnStyle在
Me.DataGridTableStyle.GridColumnStyles

c + = 1

如果grdCol.MappingName = Me.MappingName然后退出

下一页
<结束如果

bPainted = True

MyBase.Paint(g,bounds,source,rowNum,backBrush,foreBrush,alignToRight)

Dim pnHot As New Pen(SystemColors.HotTrack)

Dim brHot As New SolidBrush(Color.FromArgb(128,SystemColors.HotTrack))

''透过画笔

如果MouseOverCell(rowNum)那么

bounds.Inflate(-1,-1)

g.Fi llRectangle(brHot,bounds)

g.DrawRectangle(pnHot,bounds)

结束如果

Dim r作为新的RectangleF(bounds.X, bounds.Y,bounds.Width,bounds.Height)

rectPaint = r

End Sub

Public ReadOnly属性MouseOverCell(ByVal rownum As Integer )作为布尔特

获得

Dim作为新点(rownum,c)

返回pt.Equals(oldCell)
<结束获取

最终产品


链接到示例
http://www.onteorasoftware.com/Downl...lumnstyles.zip

-----------------------
" rodchar" < RO ***** @ discussions.microsoft.com>在消息中写道
新闻:46 ********************************** @ microsof t.com。 ..
嘿所有,

你注意到当你在这个论坛中鼠标悬停在每个帖子上时如何突出显示,以及如何在我的胜利形式中做同样的事情我的
datagrid?

谢谢,
rodchar



所有代码落后我的Form1代码落后了吗?


" Ken Tucker [MVP]"写道:



你需要为此制作自己的columnstyle。这是一个我正在研究的专栏。

代码

Imports System.Drawing

Imports System.Drawing。 Drawing2D

进口System.Windows.Forms

Imports System.Reflection

Imports System.ComponentModel

Public Class HotTrackTextBoxColumn

继承DataGridTextBoxColumn

Dim c As Integer

Dim rectPaint为新的RectangleF

Dim fnt As New Font(MyBase) .TextBox.Font.Name,MyBase.TextBox.Font.Size,
FontStyle.Underline)

Dim WithEvents dg As DataGrid

Dim oldCell As New Point( -1,-1)

Dim isInCell As Boolean = False
公共Sub HandleMouseMove(ByVal发送者为对象,ByVal e As
MouseEventArgs)处理dg.MouseMove

Dim g As Graphics = dg.CreateGraphics

Dim bounds As Rectangle

Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point( eX,eY))

isInCell =(hti.Row> -1 A. nd hti.Column = c)

静态bRedraw As Boolean = False

如果isInCell那么

Dim pt As Point

pt =新点(hti.Row,hti.Column)

如果不是pt.Equals(oldCell)那么

''

''创建一个我们希望数据网格重绘的区域

''所以数据网格不会闪现。

''

昏暗pthToRedraw作为新Drawing2D.GraphicsPath

Dim rgnToRedraw作为地区

Dim rCell As Rectangle = dg.GetCellBounds(pt.X,pt.Y)

> pthToRedraw.AddRectangle(rCell)

如果oldCell.X> -1然后

''

''必须重绘最后一个单元格

''

pthToRedraw.AddRectangle( dg.GetCellBounds(oldCell.X,oldCell.Y))

结束如果

rgnToRedraw =新区域(pthToRedraw)

dg.Invalidate( rgnToRedraw)

结束如果

''

''标记数据网格重绘

''

bRedraw = True

oldCell = pt

其他

''

''只有重绘时需要

''

如果bRedraw那么

dg.Invalidate(dg.GetCellBounds(oldCell.X,oldCell.Y))

结束如果

bRedraw = False

oldCell =新点(-1,-1)

结束如果
End Sub

受保护的重载覆盖Sub Paint(ByVal g As System.Drawing.Graphics,
ByVal bounds As System.Drawing.Rectangle,ByVal source As
System.Windows.Forms.CurrencyManager,ByVal rowNum As Integer,ByVal
backBrush As Syste m.Drawing.Brush,ByVal foreBrush As System.Drawing.Brush,
ByVal alignToRight As Boolean)

静态bPainted As Boolean = False

''

''我们第一次画画得到数据网格的参考

''所以我们可以消耗它的活动

''
如果没有bPainted那么

dg = Me.DataGridTableStyle.DataGrid

对于每个grdCol As DataGridColumnStyle在
Me.DataGridTableStyle.GridColumnStyles

c + = 1

如果grdCol.MappingName = Me.MappingName然后退出

下一页
<结束如果

bPainted = True

MyBase.Paint(g,bounds,source,rowNum,backBrush,foreBrush,alignToRight)

Dim pnHot As New Pen(SystemColors.HotTrack)

Dim brHot As New SolidBrush(Color.FromArgb(128,SystemColors.HotTrack))

''透过画笔

如果MouseOverCell(rowNum)那么

bounds.Inflate(-1,-1)

g.Fi llRectangle(brHot,bounds)

g.DrawRectangle(pnHot,bounds)

结束如果

Dim r作为新的RectangleF(bounds.X, bounds.Y,bounds.Width,bounds.Height)

rectPaint = r

End Sub

Public ReadOnly属性MouseOverCell(ByVal rownum As Integer )作为布尔特

获得

Dim作为新点(rownum,c)

返回pt.Equals(oldCell)
<结束获取

最终产品


链接到示例
http://www.onteorasoftware.com/Downl...lumnstyles.zip

-----------------------
" rodchar" < RO ***** @ discussions.microsoft.com>在消息中写道
新闻:46 ********************************** @ microsof t.com。 ..
嘿所有,

你注意到当你在这个论坛中鼠标悬停在每个帖子上时如何突出显示,以及如何在我的胜利形式中做同样的事情我的
datagrid?

谢谢,
rodchar



Hey all,

You notice how when you mouse over each thread in this forum how the
highlights, well how can I do this same thing in my win form with my datagrid?

thanks,
rodchar

解决方案

Hi,

You need to make your own columnstyle for that. Here is a column i
am working on that does that.

Code

Imports System.Drawing

Imports System.Drawing.Drawing2D

Imports System.Windows.Forms

Imports System.Reflection

Imports System.ComponentModel

Public Class HotTrackTextBoxColumn

Inherits DataGridTextBoxColumn

Dim c As Integer

Dim rectPaint As New RectangleF

Dim fnt As New Font(MyBase.TextBox.Font.Name, MyBase.TextBox.Font.Size,
FontStyle.Underline)

Dim WithEvents dg As DataGrid

Dim oldCell As New Point(-1, -1)

Dim isInCell As Boolean = False

Public Sub HandleMouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles dg.MouseMove

Dim g As Graphics = dg.CreateGraphics

Dim bounds As Rectangle

Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point(e.X, e.Y))

isInCell = (hti.Row > -1 And hti.Column = c)

Static bRedraw As Boolean = False

If isInCell Then

Dim pt As Point

pt = New Point(hti.Row, hti.Column)

If Not pt.Equals(oldCell) Then

''

'' Create a region where we want the datagrid to redraw

'' So the datagrid doesn''t flash.

''

Dim pthToRedraw As New Drawing2D.GraphicsPath

Dim rgnToRedraw As Region

Dim rCell As Rectangle = dg.GetCellBounds(pt.X, pt.Y)

pthToRedraw.AddRectangle(rCell)

If oldCell.X > -1 Then

''

'' Have to redraw last cell

''

pthToRedraw.AddRectangle(dg.GetCellBounds(oldCell. X, oldCell.Y))

End If

rgnToRedraw = New Region(pthToRedraw)

dg.Invalidate(rgnToRedraw)

End If

''

'' Flag datagrid for redraw

''

bRedraw = True

oldCell = pt

Else

''

'' Only redraw when needed

''

If bRedraw Then

dg.Invalidate(dg.GetCellBounds(oldCell.X, oldCell.Y))

End If

bRedraw = False

oldCell = New Point(-1, -1)

End If

End Sub

Protected Overloads Overrides Sub Paint(ByVal g As System.Drawing.Graphics,
ByVal bounds As System.Drawing.Rectangle, ByVal source As
System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal
backBrush As System.Drawing.Brush, ByVal foreBrush As System.Drawing.Brush,
ByVal alignToRight As Boolean)

Static bPainted As Boolean = False

''

'' First time we paint get a reference to datagrid

'' So we can consume its events

''

If Not bPainted Then

dg = Me.DataGridTableStyle.DataGrid

c = -1

For Each grdCol As DataGridColumnStyle In
Me.DataGridTableStyle.GridColumnStyles

c += 1

If grdCol.MappingName = Me.MappingName Then Exit For

Next

End If

bPainted = True

MyBase.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight)

Dim pnHot As New Pen(SystemColors.HotTrack)

Dim brHot As New SolidBrush(Color.FromArgb(128, SystemColors.HotTrack))

'' see through brush

If MouseOverCell(rowNum) Then

bounds.Inflate(-1, -1)

g.FillRectangle(brHot, bounds)

g.DrawRectangle(pnHot, bounds)

End If

Dim r As New RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Height)

rectPaint = r

End Sub

Public ReadOnly Property MouseOverCell(ByVal rownum As Integer) As Boolean

Get

Dim pt As New Point(rownum, c)

Return pt.Equals(oldCell)

End Get

End Property

End Class
Link to example
http://www.onteorasoftware.com/Downl...lumnstyles.zip

Ken
-----------------------
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:46**********************************@microsof t.com...
Hey all,

You notice how when you mouse over each thread in this forum how the
highlights, well how can I do this same thing in my win form with my
datagrid?

thanks,
rodchar


I appreciate it.

"Ken Tucker [MVP]" wrote:

Hi,

You need to make your own columnstyle for that. Here is a column i
am working on that does that.

Code

Imports System.Drawing

Imports System.Drawing.Drawing2D

Imports System.Windows.Forms

Imports System.Reflection

Imports System.ComponentModel

Public Class HotTrackTextBoxColumn

Inherits DataGridTextBoxColumn

Dim c As Integer

Dim rectPaint As New RectangleF

Dim fnt As New Font(MyBase.TextBox.Font.Name, MyBase.TextBox.Font.Size,
FontStyle.Underline)

Dim WithEvents dg As DataGrid

Dim oldCell As New Point(-1, -1)

Dim isInCell As Boolean = False

Public Sub HandleMouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles dg.MouseMove

Dim g As Graphics = dg.CreateGraphics

Dim bounds As Rectangle

Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point(e.X, e.Y))

isInCell = (hti.Row > -1 And hti.Column = c)

Static bRedraw As Boolean = False

If isInCell Then

Dim pt As Point

pt = New Point(hti.Row, hti.Column)

If Not pt.Equals(oldCell) Then

''

'' Create a region where we want the datagrid to redraw

'' So the datagrid doesn''t flash.

''

Dim pthToRedraw As New Drawing2D.GraphicsPath

Dim rgnToRedraw As Region

Dim rCell As Rectangle = dg.GetCellBounds(pt.X, pt.Y)

pthToRedraw.AddRectangle(rCell)

If oldCell.X > -1 Then

''

'' Have to redraw last cell

''

pthToRedraw.AddRectangle(dg.GetCellBounds(oldCell. X, oldCell.Y))

End If

rgnToRedraw = New Region(pthToRedraw)

dg.Invalidate(rgnToRedraw)

End If

''

'' Flag datagrid for redraw

''

bRedraw = True

oldCell = pt

Else

''

'' Only redraw when needed

''

If bRedraw Then

dg.Invalidate(dg.GetCellBounds(oldCell.X, oldCell.Y))

End If

bRedraw = False

oldCell = New Point(-1, -1)

End If

End Sub

Protected Overloads Overrides Sub Paint(ByVal g As System.Drawing.Graphics,
ByVal bounds As System.Drawing.Rectangle, ByVal source As
System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal
backBrush As System.Drawing.Brush, ByVal foreBrush As System.Drawing.Brush,
ByVal alignToRight As Boolean)

Static bPainted As Boolean = False

''

'' First time we paint get a reference to datagrid

'' So we can consume its events

''

If Not bPainted Then

dg = Me.DataGridTableStyle.DataGrid

c = -1

For Each grdCol As DataGridColumnStyle In
Me.DataGridTableStyle.GridColumnStyles

c += 1

If grdCol.MappingName = Me.MappingName Then Exit For

Next

End If

bPainted = True

MyBase.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight)

Dim pnHot As New Pen(SystemColors.HotTrack)

Dim brHot As New SolidBrush(Color.FromArgb(128, SystemColors.HotTrack))

'' see through brush

If MouseOverCell(rowNum) Then

bounds.Inflate(-1, -1)

g.FillRectangle(brHot, bounds)

g.DrawRectangle(pnHot, bounds)

End If

Dim r As New RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Height)

rectPaint = r

End Sub

Public ReadOnly Property MouseOverCell(ByVal rownum As Integer) As Boolean

Get

Dim pt As New Point(rownum, c)

Return pt.Equals(oldCell)

End Get

End Property

End Class
Link to example
http://www.onteorasoftware.com/Downl...lumnstyles.zip

Ken
-----------------------
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:46**********************************@microsof t.com...
Hey all,

You notice how when you mouse over each thread in this forum how the
highlights, well how can I do this same thing in my win form with my
datagrid?

thanks,
rodchar



all the code goes behind my Form1 code behind?

"Ken Tucker [MVP]" wrote:

Hi,

You need to make your own columnstyle for that. Here is a column i
am working on that does that.

Code

Imports System.Drawing

Imports System.Drawing.Drawing2D

Imports System.Windows.Forms

Imports System.Reflection

Imports System.ComponentModel

Public Class HotTrackTextBoxColumn

Inherits DataGridTextBoxColumn

Dim c As Integer

Dim rectPaint As New RectangleF

Dim fnt As New Font(MyBase.TextBox.Font.Name, MyBase.TextBox.Font.Size,
FontStyle.Underline)

Dim WithEvents dg As DataGrid

Dim oldCell As New Point(-1, -1)

Dim isInCell As Boolean = False

Public Sub HandleMouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles dg.MouseMove

Dim g As Graphics = dg.CreateGraphics

Dim bounds As Rectangle

Dim hti As DataGrid.HitTestInfo = dg.HitTest(New Point(e.X, e.Y))

isInCell = (hti.Row > -1 And hti.Column = c)

Static bRedraw As Boolean = False

If isInCell Then

Dim pt As Point

pt = New Point(hti.Row, hti.Column)

If Not pt.Equals(oldCell) Then

''

'' Create a region where we want the datagrid to redraw

'' So the datagrid doesn''t flash.

''

Dim pthToRedraw As New Drawing2D.GraphicsPath

Dim rgnToRedraw As Region

Dim rCell As Rectangle = dg.GetCellBounds(pt.X, pt.Y)

pthToRedraw.AddRectangle(rCell)

If oldCell.X > -1 Then

''

'' Have to redraw last cell

''

pthToRedraw.AddRectangle(dg.GetCellBounds(oldCell. X, oldCell.Y))

End If

rgnToRedraw = New Region(pthToRedraw)

dg.Invalidate(rgnToRedraw)

End If

''

'' Flag datagrid for redraw

''

bRedraw = True

oldCell = pt

Else

''

'' Only redraw when needed

''

If bRedraw Then

dg.Invalidate(dg.GetCellBounds(oldCell.X, oldCell.Y))

End If

bRedraw = False

oldCell = New Point(-1, -1)

End If

End Sub

Protected Overloads Overrides Sub Paint(ByVal g As System.Drawing.Graphics,
ByVal bounds As System.Drawing.Rectangle, ByVal source As
System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal
backBrush As System.Drawing.Brush, ByVal foreBrush As System.Drawing.Brush,
ByVal alignToRight As Boolean)

Static bPainted As Boolean = False

''

'' First time we paint get a reference to datagrid

'' So we can consume its events

''

If Not bPainted Then

dg = Me.DataGridTableStyle.DataGrid

c = -1

For Each grdCol As DataGridColumnStyle In
Me.DataGridTableStyle.GridColumnStyles

c += 1

If grdCol.MappingName = Me.MappingName Then Exit For

Next

End If

bPainted = True

MyBase.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight)

Dim pnHot As New Pen(SystemColors.HotTrack)

Dim brHot As New SolidBrush(Color.FromArgb(128, SystemColors.HotTrack))

'' see through brush

If MouseOverCell(rowNum) Then

bounds.Inflate(-1, -1)

g.FillRectangle(brHot, bounds)

g.DrawRectangle(pnHot, bounds)

End If

Dim r As New RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Height)

rectPaint = r

End Sub

Public ReadOnly Property MouseOverCell(ByVal rownum As Integer) As Boolean

Get

Dim pt As New Point(rownum, c)

Return pt.Equals(oldCell)

End Get

End Property

End Class
Link to example
http://www.onteorasoftware.com/Downl...lumnstyles.zip

Ken
-----------------------
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:46**********************************@microsof t.com...
Hey all,

You notice how when you mouse over each thread in this forum how the
highlights, well how can I do this same thing in my win form with my
datagrid?

thanks,
rodchar



这篇关于msdn.vb.lang论坛网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆