Home > Back-end >  How to teach C builder in the lattice of StingGrid add button or images
How to teach C builder in the lattice of StingGrid add button or images

Time:10-13

As the topic for the great god grant instruction I want to write a mine clearance procedures

CodePudding user response:

 
Bitmap Graphics: : TBitmap *;
Void __fastcall TForm1: : DrawGrid1DrawCell (TObject * Sender, int ACol, int ARow, TRect & amp; The Rect,
TGridDrawState State)
{
TDrawGrid * sg=(TDrawGrid *) Sender;
If (ARow==3 & amp; & ACol==3) {//specified cell
//sg - & gt; Canvas - & gt; The Draw (the Rect. Left + 1, the Rect. Top + 1, Bitmap);//display bitmap images according to the actual size according to
//sg - & gt; Canvas - & gt; StretchDraw (the Rect, Bitmap);//display bitmap, make the image fill the whole cell

//sg - & gt; Canvas - & gt; TextOutW (the Rect. Left + 2, the Rect. Top + 2, L "this is a test");//draw the text
Sg - & gt; Canvas - & gt; TextRect (the Rect, the Rect. Left + 2, the Rect. Top + 2, L "this is a test");//draw the text
}
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : FormCreate (TObject * Sender)
{
Bitmap=new Graphics: : TBitmap;
Bitmap - & gt; LoadFromFile (" c: \ \ Blue Lace 16. BMP ");
Bitmap - & gt; Transparent=true;//transparent
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : FormClose (TObject * Sender, TCloseAction & amp; The Action)
{
The delete Bitmap.
}

CodePudding user response:

reference 1st floor KFRGHT response:
 
Bitmap Graphics: : TBitmap *;
Void __fastcall TForm1: : DrawGrid1DrawCell (TObject * Sender, int ACol, int ARow, TRect & amp; The Rect,
TGridDrawState State)
{
TDrawGrid * sg=(TDrawGrid *) Sender;
If (ARow==3 & amp; & ACol==3) {//specified cell
//sg - & gt; Canvas - & gt; The Draw (the Rect. Left + 1, the Rect. Top + 1, Bitmap);//display bitmap images according to the actual size according to
//sg - & gt; Canvas - & gt; StretchDraw (the Rect, Bitmap);//display bitmap, make the image fill the whole cell

//sg - & gt; Canvas - & gt; TextOutW (the Rect. Left + 2, the Rect. Top + 2, L "this is a test");//draw the text
Sg - & gt; Canvas - & gt; TextRect (the Rect, the Rect. Left + 2, the Rect. Top + 2, L "this is a test");//draw the text
}
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : FormCreate (TObject * Sender)
{
Bitmap=new Graphics: : TBitmap;
Bitmap - & gt; LoadFromFile (" c: \ \ Blue Lace 16. BMP ");
Bitmap - & gt; Transparent=true;//transparent
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : FormClose (TObject * Sender, TCloseAction & amp; The Action)
{
The delete Bitmap.
}


Use multiple Graphics: : TBitmap loaded the different picture, and then continuously the if (ARow==specified & amp; & ACol==specified) {} drawing can

CodePudding user response:

A ride, how to join in stringGrid combobox,, combo boxes,,,

CodePudding user response:

With TMS advStringGirdle
  • Related