1.易语言设置窗口位置怎么用啊
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 LongPrivate Declare Function ReleaseCapture Lib "user32" () As LongDim nX As Single, nY As SinglePrivate Sub Command1_Click()SetWindowPos Me.hwnd, -2, 0, 0, 0, 0, 3Unload MeEnd SubPrivate Sub Form_Load()SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)nX = X: nY = YEnd SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 1 ThenMe.Move Me.Left - nX + X, Me.Top - nY + YMe.Caption = Me.TopEnd IfDim pW!, pH!, mL!, mT!, mW!, mH!pW = Screen.WidthpH = Screen.HeightmL = Me.LeftmT = Me.TopmW = Me.WidthmH = Me.HeightConst m = 50Dim MouseEnter As BooleanMouseEnter = (0 <= X) And (X <= mW) And (0 <= Y) And (Y <= mH)If MouseEnter Then '进入If mL <= m Then Me.Left = -mIf mT <= m Then Me.Top = -mIf mL >= pW - m Then Me.Left = pW - mWIf mT >= pH - m Then Me.Top = pH - mHSetCapture Me.hwndElse '移出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 '下隐ReleaseCaptureEnd IfEnd Sub 这样设定以后你的窗口可以自由移动,在靠边时可以也像QQ一样自动隐藏。
转载请注明出处windows之家 » win10易语言设置在哪里