注册本站  论坛  繁體中文

电脑技巧
手机 | MP3 | MP4 | 显卡 | 主板 | 显示器 | 光存储 | 笔记本 | 网络设备 | 移动存储 | 数码相机
键鼠 | CPU | 音箱 | GPS | 电视 | 服务器 | 投影机 | 机箱电源 | 品牌电脑 | 办公打印 |
| 网站首页 | Cisco | Windows | Linux | Java | Dotnet | Oracle | 网页设计 | 平面设计 | 安全 | 软件应用 | 电脑维修 | 办公维修 |
您现在的位置: 电脑技巧 >> Dotnet >> ASP.NET >> Dotnet正文

TreeView 拖动的下横线

文章来源:blog.csdn.net 作者:jackydre… 更新时间:2008-6-28 20:39:18 【 】 【加入收藏

       对于treeview 节点的拖动网上有很多,不想再多写了。我把自己地址贴出来:http://www.chenjiliang.com/Article/View.aspx?ArticleID=1578&TypeID=79

我实现的效果:

   我想说的是拖动的下横线。

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

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

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

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

 
  1. Imports System.Drawing   
  2. Imports System.Drawing.Drawing2D   
  3. Imports System.Collections   
  4. Imports System.Collections.Generic   
  5. Imports System.ComponentModel   
  6. Imports System.Drawing.Imaging   
  7. Public Class SplitLine   
  8.     Sub New()   
  9.         ' 此调用是 Windows 窗体设计器所必需的。   
  10.         InitializeComponent()   
  11.   
  12.         ' 在 InitializeComponent() 调用之后添加任何初始化。   
  13.         SetStyle(ControlStyles.AllPaintingInWmPaint, True)   
  14.         SetStyle(ControlStyles.ResizeRedraw, True)   
  15.         SetStyle(ControlStyles.UserPaint, True)   
  16.         SetStyle(ControlStyles.OptimizedDoubleBuffer, True)   
  17.     End Sub  
  18.   
  19.     Dim _color As Color = Color.Red   
  20.      _   
  21.     Public Property MyColor() As Color   
  22.         Get  
  23.             Return _color   
  24.         End Get  
  25.         Set(ByVal value As Color)   
  26.             _color = value   
  27.         End Set  
  28.     End Property  
  29.   
  30.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)   
  31.         MyBase.OnPaint(e)   
  32.   
  33.         Dim br As New SolidBrush(MyColor)   
  34.         Dim g As Graphics = e.Graphics   
  35.         Dim path As New GraphicsPath   
  36.         Dim path1 As New GraphicsPath   
  37.         Dim path2 As New GraphicsPath   
  38.         path.AddLine(New Point(0, 0), New Point(0, 9))   
  39.         path.AddLine(New Point(0, 9), New Point(5, 5))   
  40.         path.AddLine(New Point(5, 5), New Point(0, 0))   
  41.         path.CloseAllFigures()   
  42.   
  43.         path1.AddLine(New Point(Me.Width - 5, 5), New Point(Me.Width, 0))   
  44.         path1.AddLine(New Point(Me.Width, 0), New Point(Me.Width, 9))   
  45.         path1.AddLine(New Point(Me.Width, 9), New Point(Me.Width - 5, 5))   
  46.         path1.CloseAllFigures()   
  47.   
  48.         path2.AddRectangle(New Rectangle(5, 5, Me.Width - 5, 1))   
  49.         path2.CloseAllFigures()   
  50.   
  51.         Dim pen As New Pen(Color.Black, 2)   
  52.         g.FillPath(br, path)   
  53.         g.FillPath(br, path1)   
  54.         g.FillPath(br, path2)   
  55.   
  56.         Dim re As New Region(path)   
  57.         re.Union(path2)   
  58.         re.Union(path1)   
  59.         Me.Region = re   
  60.     End Sub  
  61.   
  62. End Class  

  • 上一篇Dotnet:

  • 下一篇Dotnet:
  • 最 新 热 门
     web.config配置文件中的 元素
     为网站添加业务层
     用SqlDataSource实现DataList嵌套DataList
     Visual Studio 2003插件的编写
     千条DOS命令收藏
     IIS 常见问题
     IIS需要的最小NTFS权限
     优化 .NET的性能
     设计模式与VB .net代码 外观模式,合成模式
     VB.net中介者模式
    最 新 推 荐
     总结必须学习的10项.NET技术
     asp.net+C#实现文件上传实现代码
     AlwaysVisibleControl控件的使用方法
     asp.net中的WebApplication和WebSite使用技…
     ShowModalDialog数据缓存的清除方法
     LinkButton的数据绑定问题
     数独求解算法
     Excel导出时数据中有特殊字符的可能会出错
     数据加密
     ASP.NET 2.0中连接字符串的设置
    相 关 文 章

    vb.net中用GetPrivateProfileString访问INI…
    AlwaysVisibleControl控件的使用方法
    与IDE相关的Attribute补遗
    UrlRewriter2.0使用中的问题
    与IDE相关的Attribute属性
    C#FileStream复制大文件
    C# String StringBuider 解惑
    Asp.net—递归方式的FindControl
    C# 实现屏幕键盘 (ScreenKeyboard)
    DataReader与DataTable,DataSet转换

    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告

     

    Copyright 2006-2008 pcjx.com All Rights Reserved
    电脑技巧 版权所有 粤ICP备06059145号 地图
    本网站所有内容未经许可不得转载或做其他使用