Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.57 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Prevent Click-thru on transparent form
  2. Bitmap.Canvas.Brush.Color := clFuchsia;
  3.    Bitmap.Canvas.FillRect (Rect (0, 0, Bitmap.Width, Bitmap.Height));
  4.        
  5. procedure TForm1.Button1Click(Sender: TObject);
  6. var
  7.   Color: DWORD;
  8.   DC: HDC;
  9. begin
  10.   Color := $00FFFFFF;
  11.   SetWindowLong(Handle, GWL_EXSTYLE,
  12.       GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_LAYERED );
  13.   SetLayeredWindowAttributes(Handle, Color, 255, LWA_COLORKEY);
  14.  
  15.   DC := GetWindowDC(Handle);
  16.   SetDCBrushColor(DC, Color);
  17.   FillRect(DC, Rect(10, 10, 100, 80), GetStockObject(DC_BRUSH));
  18.   ReleaseDC(Handle, DC);
  19. end;