【问题标题】:I can't move a UserControl containing full-size ElementHost in the Windows Forms designer?我无法在 Windows 窗体设计器中移动包含全尺寸 ElementHost 的 UserControl?
【发布时间】:2011-06-22 15:10:52
【问题描述】:

我在 Windows 窗体 UserControl 中有一个 ElementHost,它的大小与 Windows 窗体 UserControl 的全宽/高度一致。 UserControl 在窗体上...但我无法移动 UserControl 或在设计器中选择它,因为每当我将鼠标悬停在/单击设计器中的 UserControl 时,ElementHost 的子级都会窃取焦点。

如何在设计时防止这种情况发生?

【问题讨论】:

    标签: wpf winforms windows-forms-designer elementhost


    【解决方案1】:

    我做了以下事情:

            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                host.Enabled = false;
            }
    

    现在允许我在父级上拖动 UserControl 并调整其大小。

    【讨论】:

      猜你喜欢
      • 2011-09-26
      • 1970-01-01
      • 2011-05-28
      • 2014-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多