锚定的datagridviews无法在其他计算机上安装时预期扩展

发布于 2025-02-09 05:45:12 字数 1482 浏览 3 评论 0原文

我正在Visual Studio 2022中使用C#Winforms应用程序。

该应用程序的一部分是一个用户控件,具有几个嵌套的拆分范围,又包含一个datagridview,该数据杂志可以停靠以填充整个面板(似乎正常工作)或在其下面带有数据杂志的标签,固定在所有尺寸上。这个想法是在调整应用程序大小时调整DataGridView的大小,但保持标签静态和可见。在开发该应用程序的过程中,这正如我预期的那样,但是当我的某些同事计算机上运行时,它没有并在面板底部留出空白。

该应用程序以以下配置发布:

  • 目标框架:net6.0-windows
  • 部署模式:独立
  • 目标运行时:win-x86

设计中的用户控制:

当不工作时 emoxy2

因为这在整个计算机上都不一致地显示在我身上,我怀疑这是我怀疑的,我的问题在于它的发布方式,或者我本身会缺少某些设置。如果我错过了相关的东西,我可以根据要求提供任何其他信息。

更新: 我已经在项目中添加了一个应用清单,并添加了:

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
    </windowsSettings>
  </application>

不起作用后,我删除了清单并更新了CSPROJ文件:

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWindowsForms>true</UseWindowsForms>
    <ImplicitUsings>enable</ImplicitUsings>
    <ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
  </PropertyGroup>

行为保持不变。

I'm working on an C# WinForms App in Visual Studio 2022.

Part of the application is a user control that has several nested SplitContainers which in turn contain either a DataGridView that is docked to fill the entire Panel (which seems to be working fine) or Label with a DataGridView below it, anchored to all sizes. The idea is to resize the DataGridView when the application is resized but keep the Label static and visible. While developing the application this worked as I expected, however when run on some of my coworkers computers it does not and leaves empty space at the bottom of the panel.

The application is published with the following configuration:

  • Target framework : net6.0-windows
  • Deployment mode : Self-contained
  • Target runtime: win-x86

User control in design:user control

When working: example1

When not working example2

As this has been showing up inconsistently across computers that it runs on I suspect that my issue is in how it is published or there is some setting I'm missing on the controls themselves. I can provide any additional information on request if I've missed something pertinent.

Update:
I've added an app manifest to the project and added:

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
    </windowsSettings>
  </application>

After that didn't work I removed the manifest and updated the csproj file:

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWindowsForms>true</UseWindowsForms>
    <ImplicitUsings>enable</ImplicitUsings>
    <ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
  </PropertyGroup>

Behavior remains the same.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文