对于treeview 节点的拖动网上有很多,不想再多写了。我把自己地址贴出来:http://www.chenjiliang.com/Article/View.aspx?ArticleID=1578&TypeID=79
我实现的效果:
我想说的是拖动的下横线。
最初的想法是通过拖动绘图的方法,这种方法可以实现,不过要刷新特别多。对于用gdi+绘图方法不知道
大家怎样处理让刷新减少一点的方法?请指教
由于gid+绘图刷新的问题,我只好想到一些比较笨的方法,用一个label来实现一条细线的效果。
label 细线看起来不好看。自己绘图的个控件得了。下面是我绘图一个控件的主要代码(vb.net ):
view plaincopy to clipboardprint?Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing.Imaging
Public Class SplitLine
Sub New()
' 此调用是 Windows 窗体设计器所必需的。
InitializeComponent()
' 在 InitializeComponent() 调用之后添加任何初始化。
SetStyle(ControlStyles.AllPaintingInWmPaint, True)
SetStyle(ControlStyles.ResizeRedraw, True)
SetStyle(ControlStyles.UserPaint, True)
SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
End Sub
Dim _color As Color = Color.Red
_
Public Property MyColor() As Color
Get
Return _color
End Get
Set(ByVal value As Color)
_color = value
End Set
End Property
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
Dim br As New SolidBrush(MyColor)
Dim g As Graphics = e.Graphics
Dim path As New GraphicsPath
Dim path1 As New GraphicsPath
Dim path2 As New GraphicsPath
path.AddLine(New Point(0, 0), New Point(0, 9))
path.AddLine(New Point(0, 9), New Point(5, 5))
path.AddLine(New Point(5, 5), New Point(0, 0))
path.CloseAllFigures()
path1.AddLine(New Point(Me.Width - 5, 5), New Point(Me.Width, 0))
path1.AddLine(New Point(Me.Width, 0), New Point(Me.Width, 9))
path1.AddLine(New Point(Me.Width, 9), New Point(Me.Width - 5, 5))
path1.CloseAllFigures()
path2.AddRectangle(New Rectangle(5, 5, Me.Width - 5, 1))
path2.CloseAllFigures()
Dim pen As New Pen(Color.Black, 2)
g.FillPath(br, path)
g.FillPath(br, path1)
g.FillPath(br, path2)
Dim re As New Region(path)
re.Union(path2)
re.Union(path1)
Me.Region = re
End Sub
End Class
view plaincopy to clipboardprint?
文档说明:
相关文档
返回首页 | 关于本站 | | 友情链接 | 广告服务 | 意见建议 | 访客留言 | 本站论坛
Copyright© 2001-2006 ProgramBBS.com All Rights Reserved 版权所有©编程论坛
Email: 吉ICP备05009985号
感谢长春订餐网友情支持