- This topic has 9 replies, 3 voices, and was last updated 13 years, 4 months ago by Pedro-Juan.
-
AuthorPosts
-
July 6, 2011 at 5:17 pm #34659Pedro-JuanParticipant
Hello.
Somebody knows how to obtain those triangles that appear in the heads of the TColumn in a Grid to indicate the arrangement?
I have obtained some images, but he appears bad (BMP). I have turned them to png, but he appears bad.
I have tried also it with images of arrow up/down of 16×16, but it is very great (superior and inferior of the head arrive until the edge).
I have reduced them with a tool of images, but appears bad again.
When it does not appears bad, they are not transparent…
D7.
Thank you very much and a greeting.
July 7, 2011 at 1:47 pm #46176SupportKeymasterHello
You mean arrows in the TsDBGrid component?
DrawColorArrow procedure used there, you can see an example of using in the acDBGrid.pas file.
Or maybe I not quite understand you?
July 7, 2011 at 5:03 pm #46190Pedro-JuanParticipant'Support' wrote:Hello
You mean arrows in the TsDBGrid component?
DrawColorArrow procedure used there, you can see an example of using in the acDBGrid.pas file.
Or maybe I not quite understand you?
Hello
Yes, I mean arrows in the TsDBGrid component.
Both images are from a sAlphaImageList and both are .png. (16×16)
D7 Last version of Beta AC 7.45
How can I do transparent it? I have tried with many images and always the same.
Thanks.
July 8, 2011 at 3:48 pm #46197HeDiBoParticipant'Pedro-Juan' wrote:How can I do transparent it? I have tried with many images and always the same.
I believe the background should be Fuchsia (hex FF00FF). I use this picture in my application:
[attachment=4983:ICON32Fuchsia.bmp]
That comes out transparent.
Hope it helped.
July 8, 2011 at 4:22 pm #46198Pedro-JuanParticipant'HeDiBo' wrote:I believe the background should be Fuchsia (hex FF00FF). I use this picture in my application:
[attachment=4983:ICON32Fuchsia.bmp]
That comes out transparent.
Hope it helped.
Hello.
Some of which I have used previously also were fuchsia in background, and they were not transparent.
I will continue trying…
Thanks for you interest
July 11, 2011 at 8:22 am #46206SupportKeymasterPedro-Juan, can you provide an example? How you draw this arrow?
July 11, 2011 at 4:18 pm #46223Pedro-JuanParticipant'Support' wrote:Pedro-Juan, can you provide an example? How you draw this arrow?
Yes, here
Thanks.
July 17, 2011 at 6:18 am #46269SupportKeymasterThank you.
I have changed your code, look it please [
Code:procedure TFMain.sDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);var
Png : TPNGGraphic;
Ndx : integer;function GetColsWidth: Integer;
var I: Integer;
begin
Result := 0;
for I := 0 to Column.Index do begin
Result := Result + TDBGrid(Sender).Columns.Items.Width;
end;
Result := Result + 10 + (Column.Index);
end;begin
with TDBGrid(Sender) do begin
if Column.Index = nColumn then begin
Png := TPNGGraphic.Create;
try
Ndx := integer(lDesc);
DataModule1.sAlphaImageList.Items[Ndx].ImgData.Seek(0, 0);
Png.LoadFromStream(DataModule1.sAlphaImageList.Items[Ndx].ImgData);
if (RowHeights[0] < Png.Height + 4) then RowHeights[0] := (Png.Height + 4);
Canvas.Draw((GetColsWidth – Png.Width),(RowHeights[0] – Png.Height) div 2, Png);
finally
Png.Free;
end;
end
else DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;July 17, 2011 at 6:18 am #46270SupportKeymaster'Support' wrote:Thank you.
I have changed your code, look it please [
Code:procedure TFMain.sDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);var
Png : TPNGGraphic;
Ndx : integer;function GetColsWidth: Integer;
var I: Integer;
begin
Result := 0;
for I := 0 to Column.Index do begin
Result := Result + TDBGrid(Sender).Columns.Items.Width;
end;
Result := Result + 10 + (Column.Index);
end;begin
with TDBGrid(Sender) do begin
if Column.Index = nColumn then begin
Png := TPNGGraphic.Create;
try
Ndx := integer(lDesc);
DataModule1.sAlphaImageList.Items[Ndx].ImgData.Seek(0, 0);
Png.LoadFromStream(DataModule1.sAlphaImageList.Items[Ndx].ImgData);
if (RowHeights[0] < Png.Height + 4) then RowHeights[0] := (Png.Height + 4);
Canvas.Draw((GetColsWidth – Png.Width),(RowHeights[0] – Png.Height) div 2, Png);
finally
Png.Free;
end;
end
else DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;TBitmap can't draw a Png with transaprency, you should use TPNGGraphic here.
July 18, 2011 at 10:43 am #46276Pedro-JuanParticipantHi.
Now works OK.
Thank you very much and a greeting.
-
AuthorPosts
- You must be logged in to reply to this topic.