25
发现毛刺与VCL风格:当您更新窗体标题,以前在相同的过程中重新绘制其它控件没有得到重新绘制,而你不得不调用重绘,失去宝贵的处理时间来重绘。德尔福XE2 VCL样式,更新标题块等控制失效
例子:(手动设置项目选项/ VCL风格)
unit Unit11;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TForm11 = class(TForm)
Button1: TButton;
Panel1: TPanel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form11: TForm11;
implementation
{$R *.dfm}
procedure TForm11.Button1Click(Sender: TObject);
begin
Panel1.Caption := 'test';
caption := 'glitch';
end;
end.
object Form11: TForm11
Left = 0
Top = 0
Caption = 'Form11'
ClientHeight = 89
ClientWidth = 352
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 8
Top = 8
Width = 121
Height = 57
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Panel1: TPanel
Left = 135
Top = 8
Width = 185
Height = 57
Caption = 'Panel1'
TabOrder = 1
end
end
program Project10;
uses
Vcl.Forms,
Unit11 in 'Unit11.pas' {Form11},
Vcl.Themes,
Vcl.Styles;
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
TStyleManager.TrySetStyle('Cobalt XEMedia');
Application.CreateForm(TForm11, Form11);
Application.Run;
end.
这只是一个清晰显示问题的例子。 – hikari 2012-04-06 01:54:53
好吧修改了代码,虽然没有必要,但我没有听到你的抱怨,这个问题在最初的例子中很明显。 – hikari 2012-04-06 02:07:25
这不是在抱怨。如果您的代码有问题,发布编写的代码将无助于您获得答案。阅读我的最后一条评论 - 我可以编写代码来复制几乎所有你想创建的问题,但这并不意味着我的编写代码是现实生活中造成问题的原因。如果您需要帮助,请发布您的代码。顺便说一句 - 对你要求免费帮助的人采取态度通常不是一个好主意 - 这会让人不想帮忙。 :) – 2012-04-06 02:11:11