没分了,只能两个问题当一个问!
高手指点

解决方案 »

  1.   

    using System;class Test
    {
      static void Main()
      {
        Console.WriteLine(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width);
        Console.WriteLine(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
      }
    }
      

  2.   

    MounceEnter事件判断鼠标是否进入控件
      

  3.   

    [1]
    好象有个Screen类。
    [2]
    供参考
    private void treeViewNavigator_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
    {

    //获取鼠标指针位置
    Point Position = new Point(0, 0) ;
    Position.X = e.X  ;
    Position.Y = e.Y  ;
    Position = treeViewNavigator.PointToClient(Position) ;

    TreeNode DropNode = this.treeViewNavigator.GetNodeAt(Position) ;
    if ( DropNode != null )
    {
    TreeViewColorReset(this.treeViewNavigator) ;

    //延时自动展开当前节点
    Pub.MarkNode = DropNode ;
    this.timerExpandNode.Enabled = true ;

    //标记当前节点颜色
    DropNode.BackColor = Color.Navy ;
    DropNode.ForeColor = Color.White ;

    e.Effect = DragDropEffects.Copy ;
    }
    else
    {
    TreeViewColorReset(this.treeViewNavigator) ;
    e.Effect = DragDropEffects.None ; 
    }

    }
      

  4.   

    “如何判断鼠标是否位于某个控件上”:我是想把pictureBox当成按扭使用,当鼠标移上去、按下、释放、移开分别在pictureBox上显示不同的图片,我想解决的是当鼠标在pictureBox上按下鼠标后并不释放鼠标而是按住鼠标并离开pictureBox上放后才释放掉鼠标按键,一般在这种情况下是不触发按扭事件的。用MounceEnter之类事件好象不能实现啊
      

  5.   

    private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    this.Text = "pictureBox1_MouseMove" ;
    }private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
    {
    this.Text = "pictureBox1_MouseLeave" ;
    }private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    this.Text = "pictureBox1_MouseDown" ;
    }private void pictureBox1_MouseEnter(object sender, System.EventArgs e)
    {
    this.Text = "pictureBox1_MouseEnter" ;
    }private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    this.Text = "pictureBox1_MouseUp" ;
    }private void pictureBox1_MouseHover(object sender, System.EventArgs e)
    {
    this.Text = "pictureBox1_MouseHover" ;
    }
      

  6.   

    虽然ZhouQiang()提供的资料看的不大懂,但从中的到启发!我把判断事件写在MouseUp中,在释放的时候判断:
    e.X>=0 && e.X<=this.pictureBox1.Width && e.Y>=0 && e.Y<=this.pictureBox1.Height
    就可以了谢谢楼上诸位!