Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How do I draw a box around DBGrid row

Jerry@WGJerry@WG Member Posts: 17
Is there a way to draw a box around a row in a DBGrid as I drag an object over it? If I could get a canvas that represents the row I could do it, but I can't find a way to get the canvas of the row under the mouse. I can get the cell, but not the entire row.

Any ideas?

Comments

  • zibadianzibadian Member Posts: 6,349
    : Is there a way to draw a box around a row in a DBGrid as I drag an object over it? If I could get a canvas that represents the row I could do it, but I can't find a way to get the canvas of the row under the mouse. I can get the cell, but not the entire row.
    :
    : Any ideas?
    :
    :
    I think the entire row is simply a TRect with the following coordinates (0, Y_Cell_1, DBGrid.Width-1, Y_Cell_2), where Y_Cell_X are the top and bottom coordinates of the cell rect. I'm not sure about it, but its worth a try I think.
  • Jerry@WGJerry@WG Member Posts: 17
    Thanks but it isn't going to work. It turns out that I can't get the rect coords of the call. There is a CellRect method of TCustomeGrid I thought I could use and there is a BoxRect that give the coords of a group of calls. As it turns out these methods are not available in TDBGrid.

    One more problem I discovered. There is no way to relate a row on the screen (in the grid) to the underlying record of the table. Without that info the entire drag and drop operation is worthless. I need to either find a new DBGrid componant that offers the methods I need or create one of my own. I would rather buy one because it would save me a lot of time I dont have.

    : : Is there a way to draw a box around a row in a DBGrid as I drag an object over it? If I could get a canvas that represents the row I could do it, but I can't find a way to get the canvas of the row under the mouse. I can get the cell, but not the entire row.
    : :
    : : Any ideas?
    : :
    : :
    : I think the entire row is simply a TRect with the following coordinates (0, Y_Cell_1, DBGrid.Width-1, Y_Cell_2), where Y_Cell_X are the top and bottom coordinates of the cell rect. I'm not sure about it, but its worth a try I think.
    :

  • Justin BibJustin Bib USAMember Posts: 0

    ___ { http://forcoder.org } free video tutorials and ebooks about { MATLAB Python Ruby Java PHP Visual Basic C Delphi Visual Basic .NET R JavaScript Assembly Go Perl PL/SQL Swift Objective-C C# C++ Scratch ABAP Fortran Scheme Awk Clojure LabVIEW Scala Hack Erlang F# Apex COBOL FoxPro Transact-SQL Rust SAS Lua Alice Crystal Ada VBScript ML Logo D Prolog Kotlin Lisp Dart Bash Julia } _____

Sign In or Register to comment.