Questions tagged [ownerdrawn]

This allows the user to custom draw controls at run time in the Win32 Api. Any existing control can have its appearance altered through the paint message. This is C, C++,C# and Delphi applicable.

When you are changing the appearance of most any Win32 controls, you specify the _OWNERDRAW flag. This will then allow you to intercept the paint messages of desired control.

184 questions
28
votes
3 answers

TreeView Remove CheckBox by some Nodes

I want remove CheckBoxes where the Node.Type is 5 or 6. I use this code: private void TvOne_DrawNode(object sender, DrawTreeNodeEventArgs e) { int type = (e.Node as Node).typ; if (type == 5 || type == 6) { Color backColor,…
Werewolve
  • 2,448
  • 5
  • 24
  • 38
12
votes
3 answers

How do I draw the selected list-box item in a different color?

Is is possible to change the item selection focus color and text color in a TListBox? When themes are not enabled in the project, or the list box style is set to owner-draw, the selection around the item is painted blue, which I believe is globally…
user741875
11
votes
1 answer

Wrong hint showing on TListView with OwnerData and OwnerDraw set to True

I use Delphi 2007. I have a TListView with OwnerData and OwnerDraw set to True. ViewStyle is set to vsReport. I have a record. type TAList=record Item:Integer; SubItem1:String; SubItem2:String; end; var ModuleData: array of…
Pascal Bergeron
  • 761
  • 3
  • 12
  • 27
11
votes
3 answers

Flickering in ListView control (OwnerDraw, Virtual)

This question might be considered a follow-up to Flickering in listview with ownerdraw and virtualmode. I've got a ListView control in Virtual mode and I attempt to perform custom drawing. Item rendering is done via the following method…
Yippie-Ki-Yay
  • 22,026
  • 26
  • 90
  • 148
10
votes
3 answers

C# ListView Detail, Highlight a single cell

I'm using a ListView in C# to make a grid. I would like to find out a way to be able to highlight a specific cell, programatically. I only need to highlight one cell. I've experimented with Owner Drawn subitems, but using the below code, I get…
Mike Christiansen
  • 1,104
  • 2
  • 13
  • 30
9
votes
1 answer

Trouble with TreeView.DrawNode - OwnerDrawText

I have an app that is connected to a remote server and polling data when needed. It has a TreeView where the Nodes represent the objects that are available and the color of the text indicate whether the data has been loaded or not; gray-italicized…
Emmanuel F
  • 1,125
  • 1
  • 15
  • 34
9
votes
1 answer

How to draw a string without padding

I am using the GraphicsPath.AddString() function, but it draws the text with a little space around the text. Any idea how to draw the string without that padding, only the paths of the text? My code is like this: GraphicsPath gp = new…
MHMr
  • 119
  • 1
  • 2
9
votes
1 answer

C#: TreeView owner drawing with ownerdrawtext and the weird black highlighting when clicking on a node

I set the DrawMode to OwnerDrawText and tacked on to the DrawNode event, added my code to draw the text the way I want and all works well save for some odd black selection highlighting when a node is selected. No problem, I added logic to check for…
Austin Hanson
  • 21,820
  • 6
  • 35
  • 41
8
votes
2 answers

How a Combobox with the csOwnerDrawFixed Style can behave like the csDropDown style?

I'm using a TComboBox component with the style property set to csOwnerDrawFixed, I implement the OnDrawItem And everything works fine, Now I want which the combobox to behave like when had the csDropDown style (with the csOwnerDrawFixed style…
Salvador
  • 16,132
  • 33
  • 143
  • 245
8
votes
3 answers

How do I enable double-buffering of a control using C# (Windows forms)?

How do I enable double-buffering of a control using C# (Windows forms)? I have a panel control which I am drawing stuff into and also an owner-drawn tab control. Both suffer from flicker, so how can I enable double-buffering?
Gary Willoughby
  • 50,926
  • 41
  • 133
  • 199
8
votes
1 answer

How to draw TTreeView's styled selection rectangle during AdvancedCustomDrawItem?

I'm doing custom TTreeView drawing from scratch using OnAdvancedCustomDrawItem event, and I wonder how to render these selection and hot rectangles correctly in the background of my owner-draw items? They are Vista/7 styled so I cannot simply fill…
Andrew
  • 3,696
  • 3
  • 40
  • 71
7
votes
2 answers

ListBox DrawItem HotLight State in the OwnerDraw mode?

I'm using OwnerDrawFixed as a DrawMode for the custom ListBox control in my WinForms app. I want to repaint the background (or do some other action) of the ListBoxItem when the user hovers over the listbox item, that is, at the…
Beaver
  • 257
  • 5
  • 12
6
votes
1 answer

Why is there a separate message for WM_ERASEBKGND

I've never quite understood why erasing the background has a separate windows message. I looks a bit redundant to me. When I've created owner-drawn buttons, I've always ended up erasing the background from inside WM_PAINT. I have sometimes even done…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
6
votes
2 answers

Custom menu border in pure Win32 C++ (w/o WTL, MFC, etc)

Using only Win32 C++ (no WTL or MFC or any other third-party library), how can I get custom menu borders? I was able to ownerdrawn the items but the borders are in the Non Client area and I was unable to find a way change them. Is there a way?
AP.
  • 5,205
  • 7
  • 50
  • 94
6
votes
2 answers

Changing CreateParams dynamically?

I have a custom button component that I have derived from TCustomButton. To make it ownerdrawn I have overrided the CreateParams like so: procedure TMyButton.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); with…
user1175743
1
2 3
12 13