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...
Let me get this clear first ;)
Do you want to draw on the Tab or on the Page ?
I thought what you wanted was an icon beside the (regular) text on the tabs of the PageControl - is that right ?
- fruNNik
I Guess you are using a dbgrid for viewing the dataset ?, that wont display the picture (without help).
You need to display the image in a separate control. Catch the OnChange event of the Dataset and assign the data of the blobfield to an image.
hth
- fruNNik
You use a TBlobField to assign the image to it:
if not (Query1.State in [dsInsert, dsEdit]) then Query1.Insert;
Query1Images.Assign(Image1.Picture.Bitmap);
Query1.Post;
where Query1Images is a TBlobField
hth
- fruNNik
Ive tried it in D5 with this:
procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
TabIndex: Integer; const Rect: TRect; Active: Boolean);
begin
PageControl1.Canvas.Draw(Rect.Left,Rect.Top,Image1.Picture.Graphic);
end;
which works,
Have you set the Ownerdraw porperty of the...
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.