Beispiel #1
0
        public static void AdjustSizeAgainstTaskBar(ref double width, ref double height)
        {
            Taskbar tb = new Taskbar();

            if (tb.Position == TaskBarEdge.Bottom || tb.Position == TaskBarEdge.Top)
            {
                height -= tb.Height;
            }
            else if (tb.Position == TaskBarEdge.Left || tb.Position == TaskBarEdge.Right)
            {
                width -= tb.Height;
            }
        }
Beispiel #2
0
		public static void AdjustSizeAgainstTaskBar(ref double width, ref double height)
		{
			Taskbar tb = new Taskbar();
			if (tb.Position == TaskBarEdge.Bottom || tb.Position == TaskBarEdge.Top)
			{
				height -= tb.Height;
			}
			else if (tb.Position == TaskBarEdge.Left || tb.Position == TaskBarEdge.Right)
			{
				width -= tb.Height;
			}
		}
Beispiel #3
0
		/// <summary>
		///  Method returns information about the Window's TaskBarEdge.
		/// </summary>
		/// Location of the TaskBar
		/// (Top,Bottom,Left,Right).
		/// Height of the TaskBarEdge.
		/// AutoHide property of the TaskBarEdge.
		public static Taskbar GetTaskBarInfo(Taskbar tb)
		{
			TaskBarEdge taskBarEdge;
			double height = 0;
			bool autoHide = false;
			APPBARDATA abd = new APPBARDATA();
			taskBarEdge = TaskBarEdge.Bottom;
			autoHide = false;

			#region TaskBar & Height
			uint ret = SHAppBarMessage((int)ABMsg.ABM_GETTASKBARPOS, ref abd);
			switch (abd.uEdge)
			{
				case (int)ABEdge.ABE_BOTTOM:
					taskBarEdge = TaskBarEdge.Bottom;
					height = abd.rc.bottom - abd.rc.top;
					break;
				case (int)ABEdge.ABE_TOP:
					taskBarEdge = TaskBarEdge.Top;
					height = abd.rc.bottom;
					break;
				case (int)ABEdge.ABE_LEFT:
					taskBarEdge = TaskBarEdge.Left;
					height = abd.rc.right - abd.rc.left;
					break;
				case (int)ABEdge.ABE_RIGHT:
					taskBarEdge = TaskBarEdge.Right;
					height = abd.rc.right - abd.rc.left;
					break;

			}
			#endregion

			#region TaskBar AutoHide Property
			abd = new APPBARDATA();
			uint uState = SHAppBarMessage((int)ABMsg.ABM_GETSTATE, ref abd);
			switch (uState)
			{
				case (int)ABState.ABS_ALWAYSONTOP:
					autoHide = false;
					break;
				case (int)ABState.ABS_AUTOHIDE:
					autoHide = true;
					break;
				case (int)ABState.ABS_AUTOHIDEANDONTOP:
					autoHide = true;
					break;
				case (int)ABState.ABS_MANUAL:
					autoHide = false;
					break;
			}
			#endregion
			if (tb == null)
			{
				tb = new Taskbar(taskBarEdge, height, autoHide);
			}
			else
			{
				tb.Height = height;
				tb.AutoHide = autoHide;
				tb.Position = taskBarEdge;
			}
			return tb;
		}
Beispiel #4
0
 public Taskbar()
 {
     Taskbar.GetTaskBarInfo(this);
 }
Beispiel #5
0
        /// <summary>
        ///  Method returns information about the Window's TaskBarEdge.
        /// </summary>
        /// Location of the TaskBar
        /// (Top,Bottom,Left,Right).
        /// Height of the TaskBarEdge.
        /// AutoHide property of the TaskBarEdge.
        public static Taskbar GetTaskBarInfo(Taskbar tb)
        {
            TaskBarEdge taskBarEdge;
            double      height   = 0;
            bool        autoHide = false;
            APPBARDATA  abd      = new APPBARDATA();

            taskBarEdge = TaskBarEdge.Bottom;
            autoHide    = false;

            #region TaskBar & Height
            uint ret = SHAppBarMessage((int)ABMsg.ABM_GETTASKBARPOS, ref abd);
            switch (abd.uEdge)
            {
            case (int)ABEdge.ABE_BOTTOM:
                taskBarEdge = TaskBarEdge.Bottom;
                height      = abd.rc.bottom - abd.rc.top;
                break;

            case (int)ABEdge.ABE_TOP:
                taskBarEdge = TaskBarEdge.Top;
                height      = abd.rc.bottom;
                break;

            case (int)ABEdge.ABE_LEFT:
                taskBarEdge = TaskBarEdge.Left;
                height      = abd.rc.right - abd.rc.left;
                break;

            case (int)ABEdge.ABE_RIGHT:
                taskBarEdge = TaskBarEdge.Right;
                height      = abd.rc.right - abd.rc.left;
                break;
            }
            #endregion

            #region TaskBar AutoHide Property
            abd = new APPBARDATA();
            uint uState = SHAppBarMessage((int)ABMsg.ABM_GETSTATE, ref abd);
            switch (uState)
            {
            case (int)ABState.ABS_ALWAYSONTOP:
                autoHide = false;
                break;

            case (int)ABState.ABS_AUTOHIDE:
                autoHide = true;
                break;

            case (int)ABState.ABS_AUTOHIDEANDONTOP:
                autoHide = true;
                break;

            case (int)ABState.ABS_MANUAL:
                autoHide = false;
                break;
            }
            #endregion
            if (tb == null)
            {
                tb = new Taskbar(taskBarEdge, height, autoHide);
            }
            else
            {
                tb.Height   = height;
                tb.AutoHide = autoHide;
                tb.Position = taskBarEdge;
            }
            return(tb);
        }