WPF 应用程序中的滚轮出现问题

发布于 2024-10-05 00:27:56 字数 1006 浏览 4 评论 0原文

我遇到一个问题,在一台计算机上使用 Windows Presentation Foundation 开发的应用程序的滚轮全部倒转。我“向上”滚动,相关控件就会向下滚动。反之亦然。其他程序不受影响并且滚动得很好。

我已经搜索了很多,但我似乎无法弄清楚可能是什么原因造成的。我用的是W7 64位。

我尝试过或可能知道的有用的事情...

  • 使用 Winforms 以及普通的 Win32 api 创建应用程序。在这些中,当我向下滚动时,它也会向下滚动。那里一切都很好。
  • 我还在我的 WXP 32 位笔记本电脑上尝试了受影响的应用程序之一(我自己编写的)。就这一点而言,向下滚动确实意味着向下滚动。
  • 我使用标准的 Windows 鼠标驱动程序。没有安装精美的罗技或其他软件可能会导致此问题。
  • 此 Windows 安装已有 2 个月左右的时间。几乎没有什么多余的东西。我毫不怀疑,如果我重新安装,我会设法再次触发它。 (我以前从未遇到过这个问题,因为在此之前我运行的是 XP,并且像躲避瘟疫一样避免使用 .NET。)

有人知道什么设置隐藏在哪里,导致我的 WPF 应用程序像这样混乱吗?

编辑

当将以下内容放在填充的列表视图上时,会给出正确的消息(向下滚动,向上滚动),但它仍然会以错误的方式滚动方向。我勒个去?

private void listView1_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
    if (e.Delta < 0)
        textBox1.Text = "PREVIEW DOWN WE GO.";   // no we end up going up :(
    else
        textBox1.Text = "PREVIEW UP UP UP.";     // big letdown here.
}

(普通的 MouseWheel 事件不会触发,因此预览会有所不同。)

I have an issue that on one computer applications developed using the Windows Presentation Foundation have my scrollwheel all inverted. I scroll 'upwards' and the control in question will go down. And vice versa. Other programs are not affected and scroll just fine.

I have searched a lot, but I can't seem to figure out what might be causing it. I am using W7 64-bit.

Things I have tried or might be useful to know...

  • creating an application using Winforms as well as a plain Win32 api. In those, when I scroll down, it scrolls down. All is well there.
  • I have also tried one of the affected applications (which I myself wrote) on my WXP 32-bit laptop. On that one, scrolling down indeed means scrolling down.
  • I use the standard Windows mouse driver. No fancy Logitech or other software installed that might be causing this.
  • This Windows installation is 2 months old or so. There is very little, if no cruft. I have no doubt that if I reinstalled, I'd manage to trigger it again. (I never had this issue before because prior to this I ran XP and avoided .NET like the plague.)

Anyone have any clue what setting is hiding where that's messing my WPF applications up like this?

Edit:

The following, when put on a populated listview, gives the correct message (down for down scroll, up for up scroll), yet it will still scroll in the wrong direction. What the hell?

private void listView1_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
    if (e.Delta < 0)
        textBox1.Text = "PREVIEW DOWN WE GO.";   // no we end up going up :(
    else
        textBox1.Text = "PREVIEW UP UP UP.";     // big letdown here.
}

(The plain MouseWheel event won't fire, hence the preview variety.)

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

奈何桥上唱咆哮 2024-10-12 00:27:56

天哪,我刚刚想通了。它突然击中了我。

我将鼠标滚轮设置为“一次滚动一个屏幕”。尽管我在那个窗口上看了十几遍寻找我可能已经检查过的“反转滚动方向”选项,但我从未想过任何事情。

将设置设置为在滚轮上每个凹口滚动给定的行数可以修复滚动问题,尽管我没有得到预期的分页。

对于微软来说,这是明显的错误编码。首先,我花了半天时间在互联网上搜索 TextOptions.TextFormattingMode="Display",这样我的表单看起来才不像完全垃圾,然后我花了一小段时间在另一个问题上,幸好有一个简单的设置也够了。现在这个。我是否只是遇到了其他人似乎没有遇到或关心的所有小路坎? :/

(很抱歉再次回答我自己的问题,善良的人们。尽管我花了几个小时寻找有关此事的答案,但我已经完成了最后几个问题。呃。)

Holy crap, I just figured it out. It suddenly hit me.

I have me Mouse wheel set to 'scroll one screen at a time'. I never thought anything of it despite going over that window a dozen times looking for an 'invert scroll direction' option I might have checked.

Setting the setting to scroll a given number of lines per notch on my wheel fixes the scrolling, although I don't get my expected paging.

This is plain buggy coding on Microsoft's part. First I spend half a day searching the internet for TextOptions.TextFormattingMode="Display" so my forms don't look like total crap, then I spend a small eternity on another issue which thankfully had a simple setting suffice as well. And now this. Am I just hitting all those little roadbumps nobody else seems to hit or care much about? :/

(Apologies for answering my own question again, kind people. I've done it the last few questions despite searching for answers on the matter for hours. Ugh.)

挽心 2024-10-12 00:27:56

绝对没有理由发生这种情况。您是否尝试过在其他计算机上运行有问题的应用程序。

There is absolutely no reason for this to happen. Have you tried running the problematic application on other computers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文