简体   繁体   English

如何在创建选项卡控件后更改它?

[英]How do I change the style of a tab control after it has been created?

I have a Windows form ( not a WPF form) that contains a tab control from CommCtrl.h. 我有一个Windows窗体( 不是 WPF窗体),它包含来自CommCtrl.h的选项卡控件。 According to the documentation , I should be able to change the "style" to TCS_BUTTONS after the control has been created. 根据文档 ,我应该能够在创建控件后将“样式”更改为TCS_BUTTONS。 Unfortunately, I can't find any examples on how to do that. 不幸的是,我找不到任何关于如何做到这一点的例子。 Can anyone provide a reference to C++ or VB6 code to do this? 任何人都可以提供C ++或VB6代码的引用吗?

More specifically, I'm using PowerBuilder 11.5 which wraps the native MS tab control. 更具体地说,我正在使用PowerBuilder 11.5,它包装了本机MS选项卡控件。 PowerBuilder doesn't expose the TCS_BUTTONS style but I'm looking for a way to send the raw messages to change the style anyway to get around this PowerBuilder limitation. PowerBuilder没有公开TCS_BUTTONS样式,但我正在寻找一种方法来发送原始消息以改变样式,以解决这个PowerBuilder限制。

I'm not sure about the PowerBuilder angle but if you want to add a flag in the style of a control try this: 我不确定PowerBuilder的角度,但是如果你想在控件的风格中添加一个标志,试试这个:

DWORD dwStyle = ::GetWindowLong(hWnd, GWL_STYLE);
dwStyle |= TCS_BUTTONS;

::SetWindowLong(hWnd, GWL_STYLE, dwStyle);

You can use the same sort of concept to remove a style, eg 您可以使用相同的概念来删除样式,例如

dwStyle &= ~dwRemove;

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

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