标签上的PageControl禁用文本-灰色文本 [英] PageControl disabled text on tabs - gray text

查看:48
本文介绍了标签上的PageControl禁用文本-灰色文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找(我认为)可以在TPageControl组件的OnDrawTab事件中使用的Windows API,以便在我选择的选项卡上显示灰色文本。我过去曾经这样做过,从内存中可以做到这一点(在OnDrawTab事件中)。不幸的是,我无法访问代码来回顾以前的工作方式。

I am looking (I think) for the Windows API that I can use in my OnDrawTab event in the TPageControl component to display gray text on tabs that I choose. I have done it in the past and from memory this is where I did (in the OnDrawTab event). Unfortunately I don't have access to the code to look back how I did it before.

我确定我使用了诸如DrawText或TextOut之类的东西,但是我能够为其添加标志或格式样式,从而使其外观呈灰色。为了我的一生,我找不到我使用的命令。 ODS_DISABLED标志似乎与我想要的类似,但是它是Windows消息处理程序,因此我确定我以前没有使用过。我不是在这里编写组件,只是在处理OnDrawTab事件。

I'm sure that I used something like DrawText or TextOut or something but I was able to add a flag or format style to it which gave it the appearance of grayed out. For the life of me I cannot find the command I used. ODS_DISABLED flag seems to be something like what I'm after but it is a windows message handler so I'm sure I didn't use that before. I'm not writing a component here, just handling the OnDrawTab event.

有人指出我的方向正确吗?

Anyone point me in the right direction?

我正在使用Delphi 6。

I'm using Delphi 6.

谢谢

Jason

推荐答案

您可以使用 DrawState GrayString 函数。

You can use the DrawState and GrayString functions.

procedure TForm1.FormClick(Sender: TObject);
var
  s: string;
begin
  s := 'testar';
  DrawState(Canvas.Handle,
            0,
            nil,
            integer(@s[1]),
            length(s),
            10,
            10,
            0,
            0,
            DST_TEXT or DSS_DISABLED)
end;

这篇关于标签上的PageControl禁用文本-灰色文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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