两个TreeView和ListView的问题!!高分求助!!在线等待!!!

shadesert 2003-02-27 10:21:57
Question1:
主窗体中左边是一个Treeview,右边是一个ListView.这样排列就是固定的.但是我现在要的效果是要是的中间的分隔线能够左右移动该如何处理?就象"资源管理器"中的那样.
是不是要用Frame来进行处理?

Question2:
主窗体中左边是一个Treeview,右边是一个ListView.现在的问题是:点选了右边的ListView中的内容时左边的Treeview中其所属节点就会失去焦点,现在如何
使得即使我选中了右边的节点其左边的焦点还在?

(分不够可以再给!!)

...全文
77 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
shadesert 2003-03-05
  • 打赏
  • 举报
回复
Thanks!
tollers 2003-03-02
  • 打赏
  • 举报
回复
'鼠标在picAdjust上按下时相对于picAdjust.Left的位置
Dim iMouseClickX As Integer

Private Sub picAdjust_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
iMouseClickX = X - picAdjust.Left
End Sub

Private Sub picAdjust_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then '若是左键按下
If Shift = 0 Then 'SHIFT,CTRL,和 ALT 键没有被按下
picAdjust.Left = X - iMouseClickX

TreeView1.Width = picAdjust.Left
ListView1.Left = TreeView1.Width + picAdjust.Width
ListView1.Width = Me.ScaleWidth - ListView1.Left
End If
End If
End Sub
SNUMA 2003-03-02
  • 打赏
  • 举报
回复
随机教程上有这个窗体的源代码。
northwolves 2003-03-01
  • 打赏
  • 举报
回复
Private Sub Form_Load()
Picture1.Move TreeView1.Left + TreeView1.Width, TreeView1.Top, ListView1.Left - TreeView1.Left - TreeView1.Width, TreeView1.Height
Picture1.BorderStyle = 0
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Picture1.MousePointer = 9
If Button = 1 Then
Picture1.Left = Picture1.Left + x
TreeView1.Width = TreeView1.Width + x
ListView1.Left = ListView1.Left + x
ListView1.Width = ListView1.Width - x
End If
End Sub
shadesert 2003-02-28
  • 打赏
  • 举报
回复
我在TreeView和ListView中加入了Picture.
但是我下面的代码不正常,能帮我看看吗?
这样写好吗?谢谢!

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Picture1.MousePointer = 9
If Button = 1 Then
Picture1.Left = Picture1.Left + x
TreeView1.Width = TreeView1.Width + x
ListView1.Left = ListView1.Left + x
ListView1.Width = ListView1.Width - x

End If
End Sub
SonicOne 2003-02-27
  • 打赏
  • 举报
回复
学我做,新建->VB应用程序向导->资源管理器样式·

看看吧,符合你要求嘛?
tollers 2003-02-27
  • 打赏
  • 举报
回复
Q1:可以用PictureBox来做分隔线,在PictureBox的Mousemove事件中判断鼠标左键是否按下,若按下,将PictureBox移动到鼠标的位置,在PictureBox的的Mouseup事件中调整Treeview和Listview的位置。

Q2:设置HideSelection属性为false

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧