网站首页站长博客下载中心域名交易站长论坛域名主机免费电邮免费域名中文排行排名查询站长书库书籍教程下载
设为首页
加入收藏
总编信箱
投稿或申请专栏请先 [登 陆]
学院首页 网络编程 网页设计 图形图象 数 据 库 服 务 器 网络媒体 网络安全 个人专栏 站长CLUB 业界新闻 信息公告
 当前位置:首页 >> 网络编程 >> NET专区 >> 正文
公告通知
返回上级列表
资料搜索
相关文章
用户自定义控件的应用
c#.net常用函数和方法集
在VB中使用水晶报表的一种简易编
C#调用父类的父类的方法
浏览.NET Framework 2.0 类型库中
为.Text Blog 添加 计数器
编程实现邮件地址有效性检测 
VB/VB.NET/C#导出到Excel的方法
c#高性能在WEB端产生验证图片
用System.Web.Caching.Cache保存
按钮列的应用
[ 来源:中国站长学院 | 作者:郁郁小蝎 | 时间:2005-6-28 9:44:30 | 浏览:人次 ]
收藏到新浪ViVi 收藏到365KEY 收藏到我摘  字号选择〖    〗/ 双击滚屏 单击停止  
   Public Sub New(ByVal colNum As Integer)

        m_columnNum = colNum

        m_Row = -1

 

        Try

            Dim strm As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("btnface.bmp")

            m_Face = New Bitmap(strm)

            strm = Me.GetType().Assembly.GetManifestResourceStream("btnpressed.bmp")

            m_FacePressed = New Bitmap(strm)

        Catch

        End Try

    End Sub

 

    Protected Overloads Overrides Sub Edit(ByVal [source] As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean)

 

    End Sub

 

  

 

    Public Sub HandleMouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)

        Dim dg As DataGrid = Me.DataGridTableStyle.DataGrid

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

        Dim isClickInCell As Boolean = hti.Column = Me.m_columnNum

 

        m_Row = -1

 

        Dim rect As New Rectangle(0, 0, 0, 0)

 

        If isClickInCell Then

            rect = dg.GetCellBounds(hti.Row, hti.Column)

            isClickInCell = e.X > rect.Right - Me.m_Face.Width

        End If

        If isClickInCell Then

            Dim g As Graphics = Graphics.FromHwnd(dg.Handle)

            g.DrawImage(Me.m_Face, rect.Right - Me.m_Face.Width, rect.Y)

            g.Dispose()

 

            RaiseEvent CellButtonClicked(Me, New DataGridCellButtonClickEventArgs(hti.Row, hti.Column))

 

        End If

    End Sub

 

    Public Sub HandleMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)

        Dim dg As DataGrid = Me.DataGridTableStyle.DataGrid

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

        Dim isClickInCell As Boolean = hti.Column = Me.m_columnNum

        Dim rect As New Rectangle(0, 0, 0, 0)

        If isClickInCell Then

            rect = dg.GetCellBounds(hti.Row, hti.Column)

            isClickInCell = e.X > rect.Right - Me.m_Face.Width

        End If

 

        If isClickInCell Then

 

            Dim g As Graphics = Graphics.FromHwnd(dg.Handle)

            g.DrawImage(Me.m_FacePressed, rect.Right - Me.m_FacePressed.Width, rect.Y)

            g.Dispose()

            m_Row = hti.Row

        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)

 

        Dim parent As DataGrid = Me.DataGridTableStyle.DataGrid

        '如果该行是选中行 或者 当前单元格的行号=点击行的行号并且当前单元格的列号等于NEW的列号参数

        Dim current As Boolean = parent.IsSelected(rowNum) Or (parent.CurrentRowIndex = rowNum And parent.CurrentCell.ColumnNumber = Me.m_columnNum)

 

        Dim BackColor As Color

        If current Then BackColor = parent.SelectionBackColor Else BackColor = parent.BackColor

        Dim ForeColor As Color

        If current Then ForeColor = parent.SelectionForeColor Else ForeColor = parent.ForeColor

本新闻共3页,当前在第2页  1  2  3  


[发送给好友]  [打印本页]  [关闭窗口]  [返回顶部]   转载请注明来源:http://edu.chinaz.com   
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
栏目编辑: 设计风 责任编辑: 设计风,设计风
原始作者: 郁郁小蝎 录入时间: 2005-6-28 9:44:30
信息来源: 中国站长学院 投稿信箱: Edu#chinaz.com
设为首页 - 加入收藏 - 关于我们 - 广告服务 - 版权申明 - 友情链接 - 联系方式 - 总编信箱 - 会员投稿