我正在使用自定义消息框的类。但我的问题是,图标背景总是白色的。下面的代码显示图标。有人可以告诉我这段代码有什么问题吗?我希望图标背景透明。自定义MessageBox图标背景白色
try
if not custb then
case i of
MB_ICONINFORMATION:ico.Handle := LoadIcon(0, IDI_INFORMATION);
MB_ICONEXCLAMATION:ico.Handle := LoadIcon(0, IDI_EXCLAMATION);
MB_ICONQUESTION:ico.Handle := LoadIcon(0, IDI_QUESTION);
MB_ICONERROR:ico.Handle := LoadIcon(0, IDI_ERROR);
end;
with timage.Create(frm) do
begin
parent := frm;
transparent := True;
if custb then
begin
height := glyph.Height;
width := Glyph.Width;
end
else
begin
height := ico.Height;
width := ico.Width;
end;
ih := height;
top := Height div 2 + 2;
it := Top;
left := Width div 2 + 2;
il := Left + width + width div 2;
if width <= 16 then
begin
il := il + 16;
left := left + 8;
end;
if height <= 16 then
begin
it := it + 8;
top := top + 8;
end;
if custb then picture := Glyph else canvas.Draw(0, 0, ico);
end;
finally
end;
if not custb then ico.Free;
end
最良好的祝愿, evilone
这是相当多的代码负载...你可能想尝试减少到相关的部分。 – jpfollenius 2011-02-14 07:42:24
@Smasher缩小了代码 – evilone 2011-02-14 07:46:11