ownerdrawn

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

那年仲夏 提交于 2019-11-28 13:21:28
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 defined by the system's appearance settings. I would like to change the color of selected items to a custom color. So an example, the result would be something like this: Note the last listbox has been modified in Paint to illustrate the example. try this: procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State:

How to set the client area (ClientRectangle) in a borderless form?

一笑奈何 提交于 2019-11-28 02:01:39
问题 I want to know if it's possible to set the client area of a borderless form. Say for example I define a form like so: Code public class MyForm : Form { public MyForm() { this.FormBorderStyle = FormBorderStyle.None; } } Result What I want to do is specify the client area, so that the form has a frame (like the standard windows frame, but custom drawn). Result Essentially, the blue area would become the non client area, and the gray area would remain as the client area. I have tried to set the

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

可紊 提交于 2019-11-27 14:49:05
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? In the constructor of your control, set the DoubleBuffered property, and/or ControlStyle appropriately. For example, I have a simple DoubleBufferedPanel whose constructor is the following: this.DoubleBuffered = true; this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.ContainerControl | ControlStyles

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

喜欢而已 提交于 2019-11-27 08:45:38
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 if the node's state was highlighted and drew my own highlighting except the black highlighting gets added when a node is clicked, not just selected... The highlight gets drawn over by my rectangle once the mouse button is released but does get drawn and blinks...it's annoying. :/ Apparently I forgot to actually ask my question...How would one go

Delphi TListview OwnerDraw SubItems - change default font (it's bold somehow after you Draw on the canvas)

一个人想着一个人 提交于 2019-11-27 07:59:32
问题 If you use ownerdraw with a TListView, the subitems are all BOLD font style by default somehow, even if the listview font.style is set to [], for all the SubItems following a custom drawn one. A workaround I found is forcing the Style set in the CustomDrawSubItem event: ListView2.Canvas.Font.Style := [fsItalic]; ListView2.Canvas.Font.Style := []; (a simple call with [] won't work unless the default style is set to something other than [], because the SetStyle call doesn't think the style has

Simple TListView OwnerDraw Text Font Size and Color example?

有些话、适合烂在心里 提交于 2019-11-27 06:21:42
问题 I am trying to owner draw a List View control in report-mode with 4 columns, using OnCustomDrawItem . When I try to change the Canvas.font.color, and that's all I do, I have no problems. If I set canvas.font.size, I find that there is no change in the size of the text drawn by the control. If I try to take over the painting of the text, from within OnCustomDrawItem, I find I can not. I am aware of how to use OnCustomDraw to draw in the background area, but I want to custom draw a listview

TreeView Remove CheckBox by some Nodes

霸气de小男生 提交于 2019-11-26 17:40:54
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, foreColor; if ((e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected) { backColor = SystemColors.Highlight; foreColor = SystemColors.HighlightText; } else if ((e.State & TreeNodeStates.Hot) == TreeNodeStates.Hot) { backColor = SystemColors.HotTrack; foreColor = SystemColors.HighlightText; } else { backColor = e.Node.BackColor; foreColor = e.Node.ForeColor; } using

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

风流意气都作罢 提交于 2019-11-26 16:55:17
问题 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? 回答1: In the constructor of your control, set the DoubleBuffered property, and/or ControlStyle appropriately. For example, I have a simple DoubleBufferedPanel whose constructor is the following: this.DoubleBuffered = true; this.SetStyle(ControlStyles.UserPaint |

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

自作多情 提交于 2019-11-26 14:17:16
问题 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 if the node's state was highlighted and drew my own highlighting except the black highlighting gets added when a node is clicked, not just selected... The highlight gets drawn over by my rectangle once the mouse button is released but does get

TreeView Remove CheckBox by some Nodes

妖精的绣舞 提交于 2019-11-26 04:47:41
问题 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, foreColor; if ((e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected) { backColor = SystemColors.Highlight; foreColor = SystemColors.HighlightText; } else if ((e.State & TreeNodeStates.Hot) == TreeNodeStates.Hot) { backColor = SystemColors.HotTrack; foreColor =