Questions tagged [ondrawitem]

20 questions
9
votes
2 answers

How to make a custom ComboBox (OwnerDrawFixed) looks 3D like the standard ComboBox?

I am making a custom ComboBox, inherited from Winforms' standard ComboBox. For my custom ComboBox, I set DrawMode to OwnerDrawFixed and DropDownStyle to DropDownList. Then I write my own OnDrawItem method. But I ended up like this: How do I make my…
pepoluan
  • 6,132
  • 4
  • 46
  • 76
5
votes
2 answers

Overriding DrawItem for ListBox - unselected items are not redrawn

This is a C# desktop application. The DrawStyle property of my ListBox is set to OwnerDrawFixed. The problem: I override DrawItem to draw text in different fonts, and it works. But when I start resizing the form at the runtime, the selected item is…
flamey
  • 2,311
  • 4
  • 33
  • 40
2
votes
2 answers

How to display FontFamily in Combobox?

I have a combobox and I need to populate it with all the available fonts in the system - their actual name, style, etc... From all the information I can find online, I am able to put together the DrawItem event, but I keep running into the following…
ThN
  • 3,235
  • 3
  • 57
  • 115
1
vote
0 answers

Device context null in OnEraseBkgnd(CDC* pDC) handler

I am facing a problem where I am getting the device context as NULL in OnEraseBkgnd fucntion handler. I have OnEraseBkgnd handler in my custom Tab control class which is inherited from CTabCtrl, I am also getting the same problem in…
Sannuthi M
  • 11
  • 2
1
vote
0 answers

Windows Forms: Manually paint SelectedItem of ComboBox

I have a ComboBox (ToolStripCombobox, to be more precise) filled with items of type KeyValuePair. I managed to have the Items beeing painted manually by using the DrawItem event. So every Item is painted with the FontFamily of the…
tafkab76
  • 465
  • 1
  • 6
  • 18
1
vote
1 answer

DrawItem event is fired only when the user clicks the ListBox

I'm writing a client/server WinForms application in C# using VS 2015. I have a ListBox control whose DrawItem event is owner-drawn (yes, I set the DrawMode property to OwnerDrawFixed), which has to be redrawn every time a new message is recieved. I…
Nomid
  • 91
  • 8
1
vote
1 answer

CMenu border color on MFC

I've a class that inherit from CMenu Owner draw menu using this class the Menu appears correctly but, for example, when you open the menu FILE you will see the border and the separator of the standard menu color How I can paint also this part of…
SNC
  • 59
  • 2
  • 15
1
vote
2 answers

Can I use a DrawItem event handler with a CheckedListBox?

I would like to override the text displayed when an item is added to a checked list box. Right now it is using obj.ToString(), but I want to append some text, without changing the objects ToString method. I have seen examples of handling the…
spainchaud
  • 365
  • 3
  • 12
0
votes
0 answers

How to make a FileListBox with thumbnails?

I'm trying to build a file listbox with thumbnails. To achieve this I'm doing: Feed a TListBox with the files in a folder. Build an array with thumbnails - for this I'm using a temporary TImage component to load the picture and resize it. Draw the…
delphirules
  • 6,443
  • 17
  • 59
  • 108
0
votes
1 answer

Retrieving .Text of Textbox located on Panel during DataRepeater_DrawItem event

I'm using the DrawItem event of a DataRepeater to change the .BackColor and .ForeColor of a textbox based on the .Text contents. This works just fine UNLESS the textbox is located on a panel. If the textbox is on a panel, then I am returning this…
GeekInOhio
  • 202
  • 1
  • 6
0
votes
1 answer

WM_DRAWITEM of SysTabControl32 is overpainted?

I have to restyle our SysTabControl32, so I'm trying to use TCS_OWNERDRAWFIXED and WM_DRAWITEM. Everything works well BUT it seems that the Tabs are still overpainted by the system. Unfortunately the code is in Visual Objects which makes things…
Jay
  • 1
0
votes
1 answer

Mouse Hover on ListBoxItems of Custom ListBox

I have created a custom ListBox in c#. I have drawn text and image on my custom ListBox using DrawItemEventArgs. I want to fill a color in my rectangle(Item of ListBox) when mouse is hovered over it. Is there a way for it using DrawItemEventArgs or…
Ashish Rana
  • 135
  • 1
  • 11
0
votes
0 answers

Issue with OnDrawItem Method within a TabPage Control

I need a custom TabControl with different TabPage Header. I've set the DrawMode Property to "OwnerDrawFixed" in order to get the OnDrawItem Method called. In The OnDrawItem Method I do this: protected override void…
Dev86
  • 91
  • 9
0
votes
1 answer

winform listbox drawitem change substring color

I created a winform custom control which has a textbox and listbox both sharing same bindingsource, so that the listbox can be filtered with the textbox input. I need to override the lisbox drawitem so that the filtered items having searched text as…
madmonk88
  • 169
  • 10
0
votes
1 answer

How to call event on formload drawitem

I am using this code to put a image in listbox but the text does not show . When I click on the list then it shows . What is the problem ? form_load() { listbox1.Items.Add("string"); listbox1.DrawMode = DrawMode.OwnerDrawVariable; } private…
phpnet
  • 903
  • 1
  • 8
  • 23
1
2