易语言设置窗口位置怎么用啊

就是想把指定窗口设置到指定位置就行了

xh=me.height, xw=me.width, X=10
上,左:窗体<=X,窗体向上(top=xh-xh+X)或左移动;
右、下:窗体与屏幕判断比较,当屏幕宽-(窗体左+宽)<=X,右移;屏幕高-(窗体上+高)<=X,下移
然后鼠标指向窗体后拉出窗体,
有些得加些API函数用于检测鼠标移入移出,窗体置顶,窗体也不能是普通类型的,有些难度,你也可以自己在网上找找看更好的。新建工程,将窗体的BorderStyle设置为0,再加入一个Command按钮,粘贴以下代码测试

Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long

Dim nX As Single, nY As Single

Private Sub Command1_Click()
SetWindowPos Me.hwnd, -2, 0, 0, 0, 0, 3
Unload Me
End Sub

Private Sub Form_Load()
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
nX = X: nY = Y
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Me.Move Me.Left - nX + X, Me.Top - nY + Y
Me.Caption = Me.Top
End If

Dim pW!, pH!, mL!, mT!, mW!, mH!
pW = Screen.Width
pH = Screen.Height
mL = Me.Left
mT = Me.Top
mW = Me.Width
mH = Me.Height
Const m = 50

Dim MouseEnter As Boolean
MouseEnter = (0 <= X) And (X <= mW) And (0 <= Y) And (Y <= mH)
If MouseEnter Then '进入
If mL <= m Then Me.Left = -m
If mT <= m Then Me.Top = -m
If mL >= pW - m Then Me.Left = pW - mW
If mT >= pH - m Then Me.Top = pH - mH
SetCapture Me.hwnd
Else '移出
If mL <= m Then Me.Left = m - mW '左隐
If mT <= m Then Me.Top = m - mH '上隐
If pW - mL - mW <= m Then Me.Left = pW - m '右隐
If pH - mT - mH <= m Then Me.Top = pH - m '下隐
ReleaseCapture
End If
End Sub这样设定以后你的窗口可以自由移动,在靠边时可以也像QQ一样自动隐藏。
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-08-09
窗口.左边=.....
窗口.**边=.....
你可以输出调试来确定
第2个回答  2013-08-09
简单的事情何必复杂化,窗口.左边=指定值,窗口.顶边=指定值
第3个回答  2013-08-09
_启动窗口.移动()
相似回答