如何做一个窗口,像QQ那样的,当窗口拉到左面的左、右侧窗口会自动缩小,当鼠标移到左、右侧时,窗口会呈现出来

解决方案 »

  1.   

    何象QQ那样拖曳到屏幕边上时缩到边上去
    private void Form1_MouseLeave(object sender, System.EventArgs e) {
    const int j = 5; // 要故意露出在右上的高度 if (this.Top <1) { //如果当前X 已经是在最顶
    // 并且Y 也已经在最右边
    if (this.Left >= Screen.PrimaryScreen.WorkingArea.Width - this.Width) {
    // 开始往上移
    while(this.Top >= 0-this.Height + j) {
    this.Top --;
    }
    }
    }
    }private void Form1_MouseEnter(object sender, System.EventArgs e) {
    if (this.Top <0) {
    // 这里是移回正常位置的代码你接上面的逆着做就是了
    }
    }
      

  2.   

    见这个帖子,我在上面解决过:
    http://community.csdn.net/Expert/topic/5098/5098134.xml?temp=.8131525
      

  3.   

    你可以用Hook技术,利用API技术捕获全局鼠标。
      

  4.   

    private void Form1_MouseLeave(object sender, System.EventArgs e) {
    const int j = 5;// 要故意露出在右上的高度if (this.Top <1) {//如果当前X 已经是在最顶
    // 并且Y 也已经在最右边
    if (this.Left >= Screen.PrimaryScreen.WorkingArea.Width - this.Width) {
    // 开始往上移
    while(this.Top >= 0-this.Height + j) {
    this.Top --;
    }
    }
    }
    }private void Form1_MouseEnter(object sender, System.EventArgs e) {
    if (this.Top <0) {
    // 这里是移回正常位置的代码你接上面的逆着做就是了
    }
    }