电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

TreeView 拖动的下横线


发布日期:2019/12/5
 

对于treeview 节点的拖动网上有很多不想再多写了我把自己地址贴出来x?ArticleID=&TypeID=

我实现的效果

我想说的是拖动的下横线

最初的想法是通过拖动绘图的方法这种方法可以实现不过要刷新特别多对于用gdi+绘图方法不知道

大家怎样处理让刷新减少一点的方法?请指教

由于gid+绘图刷新的问题我只好想到一些比较笨的方法用一个label来实现一条细线的效果

label 细线看起来不好看自己绘图的个控件得了下面是我绘图一个控件的主要代码( )

    ImportsSystemDrawing

    ImportsSystemDrawingDrawingD

    ImportsSystemCollections

    ImportsSystemCollectionsGeneric

    ImportsSystemComponentModel

    ImportsSystemDrawingImaging

    PublicClassSplitLine

    SubNew()

    此调用是Windows窗体设计器所必需的

    InitializeComponent()

    在InitializeComponent()调用之后添加任何初始化

    SetStyle(ControlStylesAllPaintingInWmPaintTrue)

    SetStyle(ControlStylesResizeRedrawTrue)

    SetStyle(ControlStylesUserPaintTrue)

    SetStyle(ControlStylesOptimizedDoubleBufferTrue)

    EndSub

    Dim_colorAsColor=ColorRed

    _

    PublicPropertyMyColor()AsColor

    Get

    Return_color

    EndGet

    Set(ByValvalueAsColor)

    _color=value

    EndSet

    EndProperty

    ProtectedOverridesSubOnPaint(ByValeAsSystemWindowsFormsPaintEventArgs)

    MyBaseOnPaint(e)

    DimbrAsNewSolidBrush(MyColor)

    DimgAsGraphics=eGraphics

    DimpathAsNewGraphicsPath

    DimpathAsNewGraphicsPath

    DimpathAsNewGraphicsPath

    pathAddLine(NewPoint()NewPoint())

    pathAddLine(NewPoint()NewPoint())

    pathAddLine(NewPoint()NewPoint())

    pathCloseAllFigures()

    pathAddLine(NewPoint(MeWidth)NewPoint(MeWidth))

    pathAddLine(NewPoint(MeWidth)NewPoint(MeWidth))

    pathAddLine(NewPoint(MeWidth)NewPoint(MeWidth))

    pathCloseAllFigures()

    pathAddRectangle(NewRectangle(MeWidth))

    pathCloseAllFigures()

    DimpenAsNewPen(ColorBlack)

    gFillPath(brpath)

    gFillPath(brpath)

    gFillPath(brpath)

    DimreAsNewRegion(path)

    reUnion(path)

    reUnion(path)

    MeRegion=re

    EndSub

    EndClass

上一篇:建立WinForm文件模板

下一篇:Frame、Iframe、Frameset 的区别