View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002306 | JEDI VCL | 04 Feature Request | public | 2004-11-11 02:32 | 2005-05-18 06:09 |
Reporter | anonymous | Assigned To | user72 | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | |||||
Target Version | Fixed in Version | 3.10 | |||
Summary | 0002306: Background picture for Listview | ||||
Description | A background picture feature would be cool in the Listview. | ||||
Tags | No tags attached. | ||||
|
Sure would. And how is that done? |
|
procedure TForm1.ListView1CustomDraw(Sender: TCustomListView; const ARect: TRect; var DefaultDraw: Boolean); function GetHeaderHeight: Integer; var Header: HWND; // header window handle Pl: TWindowPlacement; // header window placement begin // Get header window Header := SendMessage(ListView1.Handle, LVM_GETHEADER, 0, 0); // Get header window placement FillChar(Pl, SizeOf(Pl), 0); Pl.length := SizeOf(Pl); GetWindowPlacement(Header, @Pl); // Calculate header window height Result := Pl.rcNormalPosition.Bottom - Pl.rcNormalPosition.Top; end; var BmpXPos, BmpYPos: Integer; // X and Y position for bitmap Bmp: TBitmap; // Reference to bitmap ItemRect: TRect; // List item bounds rectangle TopOffset: Integer; // Y pos where bmp drawing starts begin // Get top offset where bitmap drawing starts if ListView1.Items.Count > 0 then begin ListView_GetItemRect(ListView1.Handle, 0, ItemRect, LVIR_BOUNDS); TopOffset := ListView_GetTopIndex(ListView1.Handle) * (ItemRect.Bottom - ItemRect.Top); end else TopOffset := 0; BmpYPos := ARect.Top - TopOffset + GetHeaderHeight; // Draw the bitmap // get reference to bitmap Bmp := Image1.Picture.Bitmap; // loop until bmp is past bottom of list view while BmpYPos < ARect.Bottom do begin // draw bitmaps across width of display BmpXPos := ARect.Left; while BmpXPos < ARect.Right do begin ListView1.Canvas.Draw(BmpXPos, BmpYPos, Bmp); Inc(BmpXPos, Bmp.Width); end; // move to next row Inc(BmpYPos, Bmp.Height); end; // Ensure that the items are drawn transparently SetBkMode(ListView1.Canvas.Handle, TRANSPARENT); ListView_SetTextBkColor(ListView1.Handle, CLR_NONE); ListView_SetBKColor(ListView1.Handle, CLR_NONE); end; |
|
Thanks, but how to include that in the component itself? |
|
> Thanks, but how to include that in the component itself? Shouldn't be much of a problem. I'll have a look |
|
I've attached a first stab that you can try out. There are some shortcomings: - In Delphi 5, you must assign an empty handler to the OnCustomDraw event. This is due to the IsCustomDrawn method (determines whether OnCustomDraw should be called) being static, so cannot be overriden - There is quite some flicker when ViewStyle is vsReport and you resize the header (even though I draw to an offscreen bitmap to minimize the flickering) - There should probably be some kind of PictureOptions property (with a standard assortment of Transparent/Tile/Stretch/Proportional properties) - With some image types, the items flicker when you select them (don't know why) |
2004-12-20 14:24
|
JvListView.pas (40,894 bytes) |
|
Please provide feedback in the next 14 days, or we won't include this in the JVCL |
|
When using Tlistview and a background picture and you also set the OwnerData to true (for a virtual list) the content disapears when you move the mouse pointer over it. When you scroll with the scrollbar it appears again but as soon you move mouse the pointer over the content it disapears again. BTW This bug does not appear when you set the Ownerdata to false. |
|
Is this now in CVS ? |
|
Well, I guess it is. |
Date Modified | Username | Field | Change |
---|---|---|---|
2004-11-11 02:32 | anonymous | New Issue | |
2004-11-11 11:01 |
|
Note Added: 0005607 | |
2004-11-30 01:42 | anonymous | Note Added: 0005763 | |
2004-12-20 07:02 | obones | Note Added: 0005959 | |
2004-12-20 10:20 |
|
Note Added: 0005963 | |
2004-12-20 10:21 |
|
Status | new => assigned |
2004-12-20 10:21 |
|
Assigned To | => user72 |
2004-12-20 14:23 |
|
Note Added: 0005966 | |
2004-12-20 14:23 |
|
Status | assigned => feedback |
2004-12-20 14:24 |
|
File Added: JvListView.pas | |
2005-02-04 05:10 | obones | Note Added: 0006404 | |
2005-02-06 03:00 | anonymous | Note Added: 0006427 | |
2005-04-12 07:03 | obones | Note Added: 0006959 | |
2005-05-18 06:09 | obones | Status | feedback => resolved |
2005-05-18 06:09 | obones | Resolution | open => fixed |
2005-05-18 06:09 | obones | Note Added: 0007188 |