LVM_SETBKCOLOR + Transparenz
-
Wenn ich meinem ListView ein LVM_SETBKCOLOR sende, mit CLR_NONE sollte der Hintergrund des ListView transparent/farblos erscheinen.
Bei mir wird er aber SCHWARZ statt Transparent.Kann da jemand was zu beisteuern??
MFG:a4
-
In der aktuellen MSDN steht folgendes:
clrBk
Background color to set or the CLR_NONE value for no background color. List-view controls with background colors redraw themselves significantly faster than those without background colors.In der alten MSDN steht hingegen:
Default List View Message Processing:
...
WM_ERASEBKGND Erases the window background using the current background color for the list view control. If the background color is the CLR_NONE value, the list view control forwards the message to the parent window.
...Ich vermute es liegt daran, dass dein Elternfenster den Hintergrund schwarz malt. Wenn ich bei meinem Treeview Control (ok ist kein ListView
) CLR_NONE als Hintergrundfarbe angebe, wird der Hintergrund in weiß gezeichnet.
-
Ok, dass ich CLR_NONE bei einem TreeView Control angebe dürfte da sowieso nichts bewirken. Ignorier am besten was ich da gesagt habe

-
Hab immernoch das Problem, das CLR_NONE bei mir den Hintergrund schwarz färbt, statt transparent...
Hat da jemand nen besseren Tip???MFG:a4
-
Hab das folgende aus einer Newsgroup:
**************************************************************************
3. Images in List View columns are not drawn transparently
**************************************************************************This one's odd. If you create an image list, assign it to a ListView
control, and assign images to the column headers, the images in the column
headers are not drawn transparently, but rather are drawn with a background
of COLOR_WINDOWCreate a ListView control.
Create a masked ImageList with the image icons for the columns and the items
in the list. Assign the imagelist to the ListView control.
Create a set of columns with image icons; whether assigned at create time or
not.Display List View - result? Transparent areas are drawn in COLOR_WINDOW.
Workaround
This appears to be yet another class of order-dependency bug. To fix it, you
have to create the ImageList, assign it to the ListView control, and then
*after* assigning it, set the BkColor of the ImageList to CLR_NONE. If you
don't do this after assigning it to the ListView, you will not get proper
transparent drawing.Hast du eine ImageList? Wenn ja, dann setze den Hintergrund erst nachdem du sie dem ListView Control zugewiesen hast. Ich hab keine Ahnung ob das helfen wird, aber wir wollen ja nichts unprobiert lassen

-
@aziz
Das hilft mir leider nicht wirklich.
Ich habe keine Image-List.
Das einzige Bild in der ListView soll ein Hintergrundbild in der Anwendung sein.
Deswegen soll TextBkColor und BkColor transparent sein.
Wenn ich bei TextBkColor CLR_None angebe funzt das ja supi.
Wenn ichs bei BkColor mache ist halt schwarz.
(Meine COLOR_WINDOW farbe ist übrigens NICHT schwarz)Trotzdem Danke aziz.
... andere Vorschläge ... ??
-
Hmm, dann weiß ich echt nimmer woran's liegen könnte. Kannst du uns deinen Code herzeigen, falls möglich?
-
klar kann ich den code zeigen... aber
leider erst ab morgen. (komm heute nicht mehr dran)Probier das dann einfach nochmal.
THX a4