一个要求画面变暗的帖子里一个高手的方法。。
改了改 黑了。。。。
你在做个Form放到最上面 拦截一切消息 特别是Ctrl+Alt+Del
由于太黑了。。我没试
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
procedure DarkScreen;
procedure RepaintScreen;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure DarkScreen;
const
bMask: array [0..15] of Byte = ( $33, 0, $CC, 0, $33, 0,
$CC, 0, $33, 0, $CC, 0, $33, 0, $CC, 0);
var
Bitmap: HBITMAP;
Pattern: HBRUSH;
DCScreen: HDC;
OldPattern: HGDIOBJ;
begin
Bitmap := CreateBitmap(1, 1, 1, 1, @bMask);
Pattern := CreatePatternBrush(Bitmap);
DCScreen := GetDC(0);
OldPattern := SelectObject(DCScreen, Pattern);
BitBlt(DCScreen, 0, 0, Screen.Width, Screen.Height, 0, 0, 0, $A000C9);
SelectObject(DCScreen, OldPattern);
ReleaseDC(0, DCScreen);
DeleteObject(Bitmap);
DeleteObject(Pattern);
end;
procedure RepaintScreen;
var
r : TRect;
begin
r := Screen.DesktopRect;
InvalidateRect(0, @r, true);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
DarkScreen;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
RepaintScreen;
end;
end.