关键代码部分: begin
if (Trunc(IntPower(2, DevModeInfo^.dmBitsPerPel)) = 4294967296) then
s := '真彩色(32)位';
if (Trunc(IntPower(2, DevModeInfo^.dmBitsPerPel)) = 65536) then
s := '增强色(16)位';
if (Trunc(IntPower(2, DevModeInfo^.dmBitsPerPel)) = 256) then
s := '256色';
ListBox1.Items.Add(IntToStr(DevModeInfo^.dmPelsWidth) + 'x' + IntToStr(DevModeInfo^.dmPelsHeight) + ', ' + s + ' , ' + IntToStr(DevModeInfo.dmDisplayFrequency) + 'hz'); // 将获得的分辨率和其他信息显示到listbox1列表里。
GetMem(DevModeInfo, SizeOf(TDevMode));
for i := ListBox1.Items.Count - 1 downto 1 do //防止有重复的项
begin
if ListBox1.Items = ListBox1.Items[i - 1] then
ListBox1.Items.Delete(i);
end;
end;
还一个随机水波纹代码:
begin
if Random(8) = 1 then //这里产生一个随机数
mywater.Blob(-1, -1, Random(1) + 1, Random(500) + 50);
mywater.Render(mybmp, img1.Picture.Bitmap);
with img1.Canvas do
begin
Brush.Style := bsClear;
Font.Size := 12;
Font.Color := $FFFFFF;
//下面这句话必须有,否则无水波效果!
TextOut((mybmp.Width - TextWidth('')) div 2 + 2, 10, '');
end;