Solved

Load picture in DrawGrid

Posted on 1998-05-15
1
457 Views
Last Modified: 2011-04-14
HHHHHHEEEEEELLLLLLLPPPPPP

I have got a DrawGrid (size: 10 x 10), and I want to load a picture for example into cell [2,8]. How can I do this? Or do I have to use a StringGrid for this kind of jobs.

DrawGrid1.Image.LoadFromFile('pic.bmp'); DOES NOT WORK !!!

Please help me.

Stefan.
0
Comment
Question by:roosiedb
1 Comment
 
LVL 8

Accepted Solution

by:
ZifNab earned 30 total points
ID: 1345835
Hi roosiedb,

Haven't worked it out totally, but I think you can manage from here....

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
    DrawGrid1: TDrawGrid;
    procedure DrawGrid1DrawCell(Sender: TObject; Col, Row: Longint;
      Rect: TRect; State: TGridDrawState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.DrawGrid1DrawCell(Sender: TObject; Col, Row: Longint;
  Rect: TRect; State: TGridDrawState);
var
  bmp : TBitmap;
begin
  with Canvas do
  begin
    FillRect(Rect);
         try
          bmp := TBitmap.Create;
          bmp.Assign('your bitmap');
          Draw(Rect.Left, Rect.Top, bmp);
        finally
          bmp.Free;
        end
  end;
end;
end.

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 123
oracle global variables 4 68
CheckListBox usage 3 58
Why  'Host Connection unavailable/Socket Error #113 No route to host' 6 38
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question