Вниз
Скачать: 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.017 c
15-1179297538
IMHO
2007-05-16 10:38
2007.06.10
Сегодня - финал Кубка УЕФА!


2-1179676353
BaseMaker
2007-05-20 19:52
2007.06.10
Не показывать удаленные поля!


2-1179521983
style007
2007-05-19 00:59
2007.06.10
опять этот Invalid floating ....


15-1179006731
Бывший_ТСтас
2007-05-13 01:52
2007.06.10
Как восстановить пароль к форуму?


2-1179425992
Alexdeil
2007-05-17 22:19
2007.06.10
График




   Наверх