首页 > 解决方案 > 如何识别任务栏设置“在桌面模式下自动隐藏任务栏”设置为开

问题描述

我有一个自定义表单和一个自定义控件,当我将“在桌面模式下自动隐藏任务栏”设置为 true 时,我遇到了控件大小的问题。如何获取此属性是否启用或 TaskBar 是否已隐藏或可见的值?

我检查了始终返回Sizable的选项FormBorderStyle。你能建议一种方法吗?

if (this.FormBorderStyle == FormBorderStyle.None)
{
  c.SetBounds(0, 0, topWidth, height);
}

else if (this.CompositionEnabled && (c as StatusExt != null && (c as StatusExt).IsFormManager)
{
  if (borderValueChanged)
   {
      c.SetBounds(StatusForm.BORDER_WIDTHNORMAL, topHeight + StatusForm.BORDER_WIDTH, displayWidth, height);
   }
  else
   {
      c.SetBounds(StatusForm.BORDER_WIDTH + borderWidth, topHeight + StatusForm.BORDER_WIDTH - borderWidth, topWidth - borders.Left - borders.Right, height);
   }
 }

这是我拥有的代码,当 FormBorderStyle 设置为 None 时,我将 x 和 y 设置为 0,当提到的属性为 true 时,我需要设置相同的 x 和 y。

标签: c#winformstaskbar

解决方案


推荐阅读