Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Delphi Misc > OnDraw routine ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 6029 of 6137
Post > Topic >>

OnDraw routine doesn't work as expected

by "Stark" <franco.jommi@[EMAIL PROTECTED] > Apr 2, 2008 at 02:23 PM

I wish to color my DBGrid as for the following schema:
- All of the DBGrid with black cahracters on a white background
- If the user goes into edit mode, I would like the cell the user wants to

edit to get a yellow background and the entire ROW a grey background. The 
cell should keep its yellow background while the user is typing.
I have written the following procedure to realize what above, but 
unfortunately it doesn't work as expected: in fact when entering the edit 
mode (clicking a button):
- the ROW doesn't get its grey background,
- the yellow background is on the first cell of the row (and this may be 
right), but as soon as one starts typing, the background turns to white..

Can you understand why or give me a suggestion ?

  with Sender as TDBGrid do
  begin
    if dgRowSelect in Options then
       // dgRowSelect ON = DBGrid in Browse mode
       DefaultDrawColumnCell(Rect, Datacol, Column, State)
    else
    begin
       // dgRowSelect OFF = DBGrid in Edit mode
       if State = [gdFocused, gdSelected] then
       begin
          //  yellow background on the cell in edit
          Canvas.Brush.Color := clYellow;
          Canvas.Font.Color := clBlack;
       end else
       begin
          //  grey background on the row of the cell in edit
          Canvas.Brush.Color := clGrey;
          Canvas.Font.Color := clBlack;
       end;
        DefaultDrawColumnCell(Rect, Datacol, Column, State);
    end;
  end;
 




 1 Posts in Topic:
OnDraw routine doesn't work as expected
"Stark" <fra  2008-04-02 14:23:14 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Sep 5 12:32:02 CDT 2008.