怎么判断任务栏的位置 就是它是在屏幕的区域 左还是右 上还是下 
以及它的高度或宽度

解决方案 »

  1.   

    Screen.GetWorkingArea.GetBounds()
    检查左上角的点和宽度
    左上角  宽度
    0      小于屏幕宽度  任务栏在右
    0      等于屏幕宽度  下
    >0     小于          左
    >0     等于          上
      

  2.   

    Screen.GetWorkingArea.GetBounds()进行判断
      

  3.   

    用SystemInformation.WorkingArea和Screen.PrimaryScreen.Bounds进行判断。
    SystemInformation.WorkingArea.Y>0:任务栏在上方
    SystemInformation.WorkingArea.X>0:任务栏在左边
    SystemInformation.WorkingArea.Right<Screen.PrimaryScreen.Bounds.Width:任务栏在右边
    SystemInformation.WorkingArea.Bottom<Screen.PrimaryScreen.Bounds.Height:任务栏在下方
      

  4.   

    SystemInformation.WorkingArea
    Screen.PrimaryScreen.Bounds
      

  5.   

    我写的代码如下 看看有没有问题
       public struct 任务栏型
            {
                public 任务栏位置 位置;
                public int height;        };        public 任务栏型 Get任务栏()
            {
                任务栏型 任务栏temp;
                任务栏temp.位置 = 任务栏位置.上;
                任务栏temp.height = 24;            Rectangle rt = SystemInformation.WorkingArea;
                Rectangle rt1 = Screen.PrimaryScreen.Bounds;
                if (rt.Y > 0)
                {
                    任务栏temp.位置 = 任务栏位置.上;
                    任务栏temp.height = Math.Abs(rt1.Height - rt.Height);
                }
                if (rt.X > 0)
                {
                    任务栏temp.位置 = 任务栏位置.左;
                    任务栏temp.height = Math.Abs(rt1.Width - rt.Width);
                }
                if (rt.Right < rt1.Width)
                {
                    任务栏temp.位置 = 任务栏位置.右;
                    任务栏temp.height = Math.Abs(rt1.Width - rt.Width);
                }
                if (rt.Bottom < rt1.Height)
                {
                    任务栏temp.位置 = 任务栏位置.下;
                    任务栏temp.height = Math.Abs(rt1.Height - rt.Height);
                }
                return 任务栏temp;
            }