当选择隐藏周围的TrackBar控制虚线轮廓 [英] Hiding dashed outline around trackbar control when selected

查看:598
本文介绍了当选择隐藏周围的TrackBar控制虚线轮廓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#中的WinForms,有没有办法不显示虚线焦点外框,显示周围时正在使用它的TrackBar控制

In C# winforms, is there a way to not show the dashed focus outline border that shows around a trackbar control when it is being used?

详细信息:本大纲看起来有点俗气给我,所以我只是拍摄的美学没有表现出来。

Details: This outline looks kinda tacky to me, so I'm just shooting for aesthetics to not show it.

谢谢,

亚当

推荐答案

ShowFocusCues没有为我工作,但这个做的:

ShowFocusCues didn't work for me, but this did:

   internal class NoFocusTrackBar : System.Windows.Forms.TrackBar
   {
      [System.Runtime.InteropServices.DllImport("user32.dll")]
      public extern static int SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam);

      private static int MakeParam(int loWord, int hiWord)
      {
         return (hiWord << 16) | (loWord & 0xffff);
      }

      protected override void OnGotFocus(EventArgs e)
      {
         base.OnGotFocus(e);
         SendMessage(this.Handle, 0x0128, MakeParam(1, 0x1), 0);
      }
   }



是怎样工作参见WM_UPDATEUISTATE文档(基本上发送打开邮件的愚蠢的事情离开的TrackBar获得焦点)。

See documentation on WM_UPDATEUISTATE for how this works (basically sending a message to turn the dumb thing off the trackbar gets the focus).

这篇关于当选择隐藏周围的TrackBar控制虚线轮廓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆