简体   繁体   English

如何删除自定义CProgressCtrl周围的边框?

[英]How do I remove border around a custom CProgressCtrl?

I have created a custom progress control, derived from CProgressCtrl, to display the progress using a bitmap by overwriting the OnPaint function (CProgressCtrl::OnPaint is not called). 我创建了一个从CProgressCtrl派生的自定义进度控件,以通过覆盖OnPaint函数(未调用CProgressCtrl :: OnPaint)使用位图显示进度。 When viewed in the application, there is a border around the progress bar. 在应用程序中查看时,进度条周围有一个边框。 WS_BORDER is not set for the progress control, nor any other control that I can find within the application. WS_BORDER没有设置进度控件,也没有为应用程序中找到的任何其他控件设置。 Calling ModifyStyle(WS_BORDER, 0) on the progress control to remove the border returns 0 and does not change the appearance, while ModifyStyle(0, WS_BORDER) adds a second border around the progress bar. 在进度控件上调用ModifyStyle(WS_BORDER,0)删除边框将返回0并且不会更改外观,而ModifyStyle(0,WS_BORDER)在进度条周围添加第二个边框。

WS_BORDER is definitely not set on this control, but there is clearly a Windows border around the control. 绝对未在此控件上设置WS_BORDER,但显然该控件周围有Windows边框。 Is it possible that the control is fully enclosed within another control as a child window, and if so how would I find this control and disable the WS_BORDER? 该控件是否有可能完全作为子窗口包含在另一个控件中,如果是,我如何找到该控件并禁用WS_BORDER? Or is the border drawn automatically because the control is a derived class of CProgressCtrl even though OnPaint is overridden? 还是因为控件是CProgressCtrl的派生类(即使重写了OnPaint)而自动绘制了边框吗?

The progress control is a single window - this can easily be verified with Spy++. 进度控件是一个窗口-可以使用Spy ++轻松验证。

I think you need to override OnNcPaint as well as OnPaint . 我认为您需要重写OnNcPaint以及OnPaint

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM