Вниз
Скачать: CL | DM;

Картика в гриде не отрисовывается транспарентно   Найти похожие ветки 

 
kyn66 ©   (2007-04-14 11:18) [0]

Делаю грид полосатым. Затем по условию вставляю картинку. Говорю ей быть транспарентной, однако не получается.


procedure TRepSprFrm.RxDBGrid1GetCellParams(Sender: TObject; Field: TField;
 AFont: TFont; var Background: TColor; Highlight: Boolean);
begin
 if (DM1.RepTbl.RecNo mod 2 <> 0) then
  Background := cl3DLight;
 if Highlight then
  begin
    AFont.Color := clBlack;
    Background := clMoneyGreen;
    AFont.Style := [fsBold];
  end;
end;
...
procedure TRepSprFrm.RxDBGrid1DrawColumnCell(Sender: TObject;
 const Rect: TRect; DataCol: Integer; Column: TColumn;
 State: TGridDrawState);
Var
 Im1 : TBitmap;
begin
 if DM1.RepTbl.RecordCount <> 0 then
  begin
    Im1 := TBitmap.Create;
    with RxDBGrid1.Canvas do
     begin
       if (Column.FieldName = "Ins") then
        begin
          FillRect(Rect);
          Im1.Transparent := True;
          if DM1.RepTbl.FieldByName("Ins").Value = False then
           ImageList1.GetBitmap(1,Im1);
          Draw(round((Rect.Left + Rect.Right - Im1.Width)/2), Rect.Top, Im1);
        end;
    end;
  Im1.Free
 end;



 
Чапаев ©   (2007-04-14 11:26) [1]

RTFM TImageList.GetMaskBitmap(), BitBlt().


 
kyn66 ©   (2007-04-14 11:50) [2]

>> Чапаев
Подробнее можно?


 
Чапаев ©   (2007-04-14 12:15) [3]

А вообще, как оказалось, проще всего будет использовать ImageList_Draw() из модуля CommCtrl. Что-то вроде ImageList_Draw(ImageList1.Handle,1,RxDBGrid1.Canvas.Handle,0,0,ILD_NORMAL) .



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.016 c
2-1179734365
Dr.M@$
2007-05-21 11:59
2007.06.10
Fbook


15-1179109412
Slider007
2007-05-14 06:23
2007.06.10
С днем рождения ! 14 мая


15-1179065236
>>DEATH<<
2007-05-13 18:07
2007.06.10
compilers.jino-net.ru


2-1179659324
ari_9
2007-05-20 15:08
2007.06.10
как из контекста устройства (HDC) получить битмап ?


1-1176716998
well
2007-04-16 13:49
2007.06.10
BDS. Как создать иконку если нет ImageEditor




   Наверх