db192,
It would help if you could clarify what problems you encounter. Do you have som code snippet and an error message?
I Havent coded DB very much but may be able to help...
Cheers
- fruNNik
use the DrawColumnCell to draw on the Grids Canvas, there you can place the if like so:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
// pseudo code
if Value > 10 then...
Hi,
DBGrid has a selectedrows property which is a TBookmarkList, and it has the functionality you describe...
You can select records bij clicking the thumb (i think), when DBGrid.Options include: dgRowSelect and dgMultiSelect
When the selected rows are needed you just walk the...
Maybe by using the OnGetEditText and SetEditText events of the Grid, you can get what you want ?
SetEditText is called everytime the contents of the cell changes, and when you leave the edited cell, so you'd have to fiddle something there ...
hth
- fruNNik
Its not a real answer but, I have used the ADO components to connect to MSSql server.
The setup is sort of the same you mentioned with a
TADoConnection and TDatasource, which can be tables, queries
or stored procs, and viewing components like TDBGrid etc.
I dont know which Delphi version...
Search on Google found:
http://www.delphifaq.com/fq/q4053.shtml
says:
Msg 'Canvas does not allow drawing'
Q:
What does the error message 'Canvas does not allow drawing' mean?
A:
you may have run out of resources, which means a new DC cannot be
allocated. Usually this is a result of not...
Oops (typo):
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
n: Integer;
begin
n := StrToIntDef(StringGrid1.Cells[ACol,ARow],-1);
if n >= 0 then
ImageList1.Draw(StringGrid1.Canvas,Rect.Left,Rect.Top,n)...
I would take a TStringGrid (to put the index of the picture to draw in), and make it owner drawn like this:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
n: Integer;
begin
n :=...
Hmm i dont get it quite.
What i showed you is how to display a pict in drawgrid.
You need some structure or rules to determine when to display the image and which image to display.
In the DrawGridCell YOU (as the programmer) have to decide IF you show a picture (or text for that matter) and...
Great it works!
To use jpeg u need to include the unit jpeg...
You probably need to convert the copybmp function to accept a TGraphic instead of a TBitmap ... dunno ?
After i gave you my solution, the following occured to me:
You could probably just use the Canvas.CopyRect function to
do in...
try this to scale
procedure copybmp(ASrc,ADst: TBitmap);
var
r,c: Integer;
x,y: Integer;
dx,dy: Real;
begin
(*
it assumes dst is always smaller then src,
and that both bitmaps have their dimensions set
*)
dx := ASrc.Width / ADst.Width;
dy := ASrc.Height / ADst.height;
for r := 0 to...
I assume that when you say: an icon to be loaded, you mean an icon to be displayed ? In which case something like this will do the trick:
procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if gdSelected in State then...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.