Read the manual on how to create a component then go through several examples 
and you'll see how to override the Paint event to add this code to your 
component. Personally, I wouldn't bother. Adding an entire component with this 
trivial change to your component pallette will take up a lot more RAM 
(especially if you do it many times). You're better off just adding snippets of 
code like this when you need them. That's what the those custom draw events are 
for.

Dave

--- On Mon, 8/17/09, Loay Habash <[email protected]> wrote:

From: Loay Habash <[email protected]>
Subject: Re: [delphi-en] Transerant StringGrid
To: [email protected]
Date: Monday, August 17, 2009, 6:15 AM






 




    
                  Hello,

Thank you for at least repling my Email, am not sure that I can build my own 
componnents, thats why I need this code which will make the StringGrid 
Transparent. to be as a new component at the OnGridCell event.

 

Thank you,

Loay Habash, 



--- On Sun, 8/16/09, David Smith <djsmith_1998@ yahoo.com> wrote:



From: David Smith <djsmith_1998@ yahoo.com>

Subject: Re: [delphi-en] Transerant StringGrid

To: delphi...@yahoogrou ps.com

Date: Sunday, August 16, 2009, 7:46 PM



  



   Why, is it too much hassle? Try keeping it in a text file in your components 
folder so you can use the modern computer magic of "cut and paste" when you 
need it.



Dave



--- On Sun, 8/16/09, Loay Habash <leohab...@yahoo. com> wrote:



From: Loay Habash <leohab...@yahoo. com>

Subject: [delphi-en] Transerant StringGrid

To: "delphi" <delphi...@yahoogro u ps.com>

Date: Sunday, August 16, 2009, 1:33 AM



 



Hello,



Pls. anybody can help me in creating Transparent String grid, or at least show 
the background image inside the cells.



 



I downloaded some code from the net and it work fine, But I need to make it as 
a component attached with this code, I don't need to rewrite this code each 
time I need to use this option.



 



The code :



 



procedure TForm1.StringGrid1D rawCell(Sender: TObject; ACol, ARow: Integer;



  Rect: TRect; State: TGridDrawState) ;



var



  Text: string;



  Rct: TRect;



begin



  Text := TStringGrid( sender).Cells[ ACol,ARow] ;



  Rct:= Rect;



  BitBlt(TStringGrid( sender).Canvas. handle,



         Rct.left,



         Rct.top,



         Rct.right - Rct.left,



         Rct.bottom - Rct.top,



         Image1.Canvas. Handle,



         Rct.left + TStringGrid( sender).Left ,



         Rct.Top + TStringGrid( sender).Top ,



         SRCCOPY);



  SetBkModE(TStringGr id(sender) .Canvas.Handle, TRANSPARENT) ;



  TStringGrid( sender).Canvas. .Font.Style := [fsBold];



  DrawtextEx(TStringG rid(sender) .Canvas.Handle,



             PChar(Text),



             Length(Text) ,



             Rct,



             DT_WORDBREAK,



             nil);



end;



 



Loay Habash, 



http://groups. yahoo.com/ group/WeLoveYouA ll/ 



http://profiles. yahoo.com/ leohabash 



leohab...@yahoo. com 



Mobile: +966503322315



[Non-text portions of this message have been removed]



[Non-text portions of this message have been removed]



[Non-text portions of this message have been removed]




 

      

    
    
        
         
        
        








        


        
        


      

[Non-text portions of this message have been removed]

Reply via email to