ginsonic
asked on
TListView background
Hy,
I need a TListView with a bitmap background. I write a code that use OnCustomDraw and show me the bitmaped background. But my problem appear when scroll. When scroll up or down the listview content the bitmaped is scroll too.
How can I have a ListView with bitmaped background but fixed? When scroll the items the background to stay fixed.
Code please!
I need a TListView with a bitmap background. I write a code that use OnCustomDraw and show me the bitmaped background. But my problem appear when scroll. When scroll up or down the listview content the bitmaped is scroll too.
How can I have a ListView with bitmaped background but fixed? When scroll the items the background to stay fixed.
Code please!
Or maybe you should just migrate to Virtual TreeView by Mike Lischke http://www.soft-gems.net/VirtualTreeview/VT.php
ASKER
Don't wish to use 3th part. I need a ListView to create a combo for my own combobox vcl.
can you post some code on how you did your background painting?
when drawing just count in the Scrollbars position and offset the drawing rect
ASKER
procedure TForm1.ListView1CustomDraw (Sender: TCustomListView;
const ARect: TRect; var DefaultDraw: Boolean);
begin
Self.Canvas.Draw(0,0,MyIma ge);
....
end;
const ARect: TRect; var DefaultDraw: Boolean);
begin
Self.Canvas.Draw(0,0,MyIma
....
end;
ASKER
I will try to play with ARect. Maybe ... !?!?!
Hi qinsonic,
I spent some time on this a while ago and even succeded to some extent, but sorry to say that custom backgound in TListView is impossible without a flicker. You can use a component by Mike Lischke mentioned above or CoolBreeze by Jim Kueneman at mustangpeak.com (depending on what you need)
Regards,
odissey1
I spent some time on this a while ago and even succeded to some extent, but sorry to say that custom backgound in TListView is impossible without a flicker. You can use a component by Mike Lischke mentioned above or CoolBreeze by Jim Kueneman at mustangpeak.com (depending on what you need)
Regards,
odissey1
Hello
If you look at Delphi Demos you will see how to do that for TTreeView and it's the same with TListView
procedure TForm1.ListView1CustomDraw (Sender: TCustomListView;
const ARect: TRect; var DefaultDraw: Boolean);
var
Bitmap : TBitmap;
begin
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('c:\pi c.bmp');
Listview1.Canvas.Brush.Bit map := Bitmap;
ListView1.Canvas.StretchDr aw(ARect,B itmap);
end;
Another way by sending LVM_SETBKIMAGE, it's the best one I found for putting the image as background for the TListView
http://edit.coders-corner.com/faq/f670.shtml
Regards,
Mohammed
If you look at Delphi Demos you will see how to do that for TTreeView and it's the same with TListView
procedure TForm1.ListView1CustomDraw
const ARect: TRect; var DefaultDraw: Boolean);
var
Bitmap : TBitmap;
begin
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile('c:\pi
Listview1.Canvas.Brush.Bit
ListView1.Canvas.StretchDr
end;
Another way by sending LVM_SETBKIMAGE, it's the best one I found for putting the image as background for the TListView
http://edit.coders-corner.com/faq/f670.shtml
Regards,
Mohammed
ASKER
I can draw a bitmap and I can do that without flickering. My problem is that when I scroll the items ( you can add enough items to get a HScrollBar and set it to vsReport ) the bitmap is scrolled too. I wish to have a fixed image as background and to scroll just the items.
ASKER
Look like can't be done in ListView so I go to ListBox. Somebody can help me with:
https://www.experts-exchange.com/questions/21211633/ListBox-scrolling-problems.html
I offer these points for an answer, too.
https://www.experts-exchange.com/questions/21211633/ListBox-scrolling-problems.html
I offer these points for an answer, too.
Hi qinsonic,
as I mentioned above, only solution I know is a freware CoolBreeze by J.Kueneman (mustangpeak.net). Basically, this is a TListview with all extended features you asked.
regards,
odissey1
as I mentioned above, only solution I know is a freware CoolBreeze by J.Kueneman (mustangpeak.net). Basically, this is a TListview with all extended features you asked.
regards,
odissey1
it's actually a TVirtualTreeView with the stuff that a TListView has
ASKER
Yap, still wish to use just TListView! I thinking to go to rewrite WM_Paint . I success to do this on DBGrid. (I intend to add a background to all my used VCL)
To CetusMOD,
I don't see why to delete a post instead of PAQ. I think qinsonic received an exact unswer from the beginning: TListView by M$ and background are not going along well (Sorry to add that WindowsExplorer doesn't uses same TListView which distributed by M$ to the outer world). Solution was provided also: CoolBreeze freware set by J. Kueneman which is a native VCL and probably the only way to add a bkgr to ListView.
I suggest to PAQ so other folks can see problem with TListView and possible solution too.
Regards,
odissey1
I don't see why to delete a post instead of PAQ. I think qinsonic received an exact unswer from the beginning: TListView by M$ and background are not going along well (Sorry to add that WindowsExplorer doesn't uses same TListView which distributed by M$ to the outer world). Solution was provided also: CoolBreeze freware set by J. Kueneman which is a native VCL and probably the only way to add a bkgr to ListView.
I suggest to PAQ so other folks can see problem with TListView and possible solution too.
Regards,
odissey1
ASKER
For odissey1: my answer then was that I can draw to Listview background with no flickering.
8<
I spent some time on this a while ago and even succeded to some extent, but sorry to say that custom backgound in TListView is impossible without a flicker. You can use a component by Mike Lischke mentioned above or CoolBreeze by Jim Kueneman at mustangpeak.com (depending on what you need)
>8
And by the way I made big steps overriding WM_Paint.
8<
I spent some time on this a while ago and even succeded to some extent, but sorry to say that custom backgound in TListView is impossible without a flicker. You can use a component by Mike Lischke mentioned above or CoolBreeze by Jim Kueneman at mustangpeak.com (depending on what you need)
>8
And by the way I made big steps overriding WM_Paint.
ASKER
And how a say already, don't wish to use 3th party licenses because I intend to use inside my own component.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
procedure TForm1.ListView1CustomDraw
const ARect: TRect; var DefaultDraw: Boolean);
var DestRect, SrcRect : TRect;
begin
DestRect := Rect(0,0,ListView1.width, Listview1.Height);
SrcRect := Rect(0,0,Image1.Width,Imag
ListView1.Canvas.CopyRect(
end;