Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to Disable the transparent part of a TSpeedButton from clicking Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
31-Oct-02
Category
VCL-General
Language
Delphi 2.x
Views
100
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to disable the transparent part of a TSpeedButton from clicking

Answer:
1   
2   procedure TMFSpeedButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y:
3     Integer);
4   var
5     ScreenDC: HDC;
6     Transp, Bits: Boolean;
7   begin
8     inherited MouseDown(Button, Shift, X, Y);
9     if (Button = mbLeft) and Enabled then
10    begin
11      Bits := False;
12      Transp := False;
13      ScreenDC := GetDC(0);
14      try
15        {Transparent color is color of form background. Test for True Color 24bit
16  		  or  more, because on lower color depth the color is blended, so it works only
17  			on true color for some colors. If it is for example clBlack, it works
18  			on everything}
19        Bits := GetDeviceCaps(ScreenDC, BITSPIXEL) >= 24;
20        {test for desired color}
21        Transp := GetPixel(ScreenDC, Mouse.CursorPos.x, Mouse.CursorPos.Y) = 
22  $0094ADBD;
23      finally
24        ReleaseDC(0, ScreenDC);
25      end;
26      {leave procedure if test for transp. color was successful}
27      if Transp and Bits then
28        Exit;
29      if not FDown then
30      begin
31        FState := bsDown;
32        Invalidate;
33      end;
34      FDragging := True;
35    end;
36  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC