主题:请问各位:拖动表单里的容器如何实现?
吉祥鸟
[专家分:0] 发布于 2008-07-25 10:36:00
请问各位:拖动表单里的容器如何实现?
回复列表 (共13个回复)
11 楼
lzguang [专家分:1210] 发布于 2008-08-04 02:06:00
If (OldHeight + ( OldTop - Mrow() * lnAvgCharHeight ))<=0
Return
Endif
If This.Left >= Mcol() * lnAvgCharWidth
Return
Endif
This.Top = Mrow() * lnAvgCharHeight
This.Height = OldHeight + ( OldTop - This.Top )
This.Width = Mcol() * lnAvgCharWidth - This.Left
Enddo
Case nXCoord >= This.Left + This.Width - 5 And nXCoord <= This.Left + This.Width And nYCoord >= This.Top + This.Height - 5 And nYCoord <= This.Top + This.Height
Do While Mdown()
If This.Top >= Mrow() * lnAvgCharHeight
Return
Endif
If This.Left >= Mcol() * lnAvgCharWidth
Return
Endif
This.Height = Mrow() * lnAvgCharHeight - This.Top
This.Width = Mcol() * lnAvgCharWidth - This.Left
Enddo
Case nXCoord > This.Left And nXCoord < This.Left + 5 And nYCoord > This.Top + 5 And nYCoord < This.Top + This.Height - 5
Do While Mdown()
If (OldWidth + ( OldLeft - Mcol() * lnAvgCharWidth )) <= 0
Return
Endif
This.Left = Mcol() * lnAvgCharWidth
This.Width = OldWidth + ( OldLeft - This.Left )
Enddo
Case nXCoord > This.Left + This.Width - 5 And nXCoord < This.Left + This.Width And nYCoord > This.Top + 5 And nYCoord < This.Top + This.Height - 5
Do While Mdown()
If This.Left >= Mcol() * lnAvgCharWidth
Return
Endif
This.Width = Mcol() * lnAvgCharWidth - This.Left
Enddo
Case nXCoord > This.Left +5 And nXCoord < This.Left + This.Width - 5 And nYCoord > This.Top And nYCoord < This.Top + 5
Do While Mdown()
If (OldHeight + ( OldTop - Mrow() * lnAvgCharHeight ))<=0
Return
12 楼
lzguang [专家分:1210] 发布于 2008-08-04 02:06:00
Endif
This.Top = Mrow() * lnAvgCharHeight
This.Height = OldHeight + ( OldTop - This.Top )
Enddo
Case nXCoord > This.Left +5 And nXCoord < This.Left + This.Width - 5 And nYCoord > This.Top + This.Height - 5 And nYCoord < This.Top + This.Height
Do While Mdown()
If This.Top >= Mrow() * lnAvgCharHeight
Return
Endif
This.Height = Mrow() * lnAvgCharHeight - This.Top
Enddo
Otherwise
Do While Mdown()
This.Left = Mcol() * lnAvgCharWidth - OldPosX
This.Top = Mrow() * lnAvgCharHeight - OldPosY
If This.Left <= 0
This.Left = OldLeft
This.Top = OldTop
Endif
If This.Left >= This.Parent.Width - This.Width
This.Left = OldLeft
This.Top = OldTop
Endif
If This.Top <= 0
This.Left = OldLeft
This.Top = OldTop
Endif
If This.Top >= This.Parent.Height - This.Height
This.Left = OldLeft
This.Top = OldTop
Endif
OldLeft = This.Left
OldTop = This.Top
This.Move(This.Left, This.Top)
Enddo
Endcase
二:在容器控件的 MouseMove 事件中:
Do Case
Case nXCoord >= This.Left And nXCoord <= This.Left + 5 And nYCoord >= This.Top And nYCoord <= This.Top + 5
This.MousePointer = 8
Case nXCoord >= This.Left And nXCoord <= This.Left + 5 And nYCoord >= This.Top + This.Height -
13 楼
lzguang [专家分:1210] 发布于 2008-08-04 02:07:00
5 And nYCoord <= This.Top + This.Height
This.MousePointer = 6
Case nXCoord >= This.Left + This.Width - 5 And nXCoord <= This.Left + This.Width And nYCoord >= This.Top And nYCoord =< This.Top + 5
This.MousePointer = 6
Case nXCoord >= This.Left + This.Width - 5 And nXCoord <= This.Left + This.Width And nYCoord >= This.Top + This.Height - 5 And nYCoord <= This.Top + This.Height
This.MousePointer = 8
Case nXCoord > This.Left And nXCoord < This.Left + 5 And nYCoord > This.Top + 5 And nYCoord < This.Top + This.Height - 5
This.MousePointer = 9
Case nXCoord > This.Left + This.Width - 5 And nXCoord < This.Left + This.Width And nYCoord > This.Top + 5 And nYCoord < This.Top + This.Height - 5
This.MousePointer = 9
Case nXCoord > This.Left +5 And nXCoord < This.Left + This.Width - 5 And nYCoord > This.Top And nYCoord < This.Top + 5
This.MousePointer = 7
Case nXCoord > This.Left +5 And nXCoord < This.Left + This.Width - 5 And nYCoord > This.Top + This.Height - 5 And nYCoord < This.Top + This.Height
This.MousePointer = 7
Otherwise
This.MousePointer = 5
Endcase
我来回复