Re: Problem drawing the right font in an owner draw TreeView
- From: "Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom>
- Date: Thu, 5 Apr 2007 08:14:35 -0400
Thanks for the pointer. Rather than build another user control to handle
editing, I side stepped the issue by doing this:
During owner draw, I ignore the width of the passed in bounds rectangle.
Instead, I get the parent tree view's right edge and use that to generate a
DrawString rectangle. I also set the draw string's format value so that it
doesn't clip or wrap. The two togehter allow my own text to draw without
being clipped or trying to wrap.
I don't explicitly make the display font the same as the edit font. These
are allowed to be different. However, I do catch the before edit event and
use that to make sure that the TreeNode's display text is removed from the
screen, thus removing the stale text scraps that would otherwise be
displayed on the row at the same time that the smaller edit window is
active.
Again, thanks for the ideas.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
"Peter Ritchie [C# MVP]" <PRSoCo@xxxxxxxxxxxxxxxxx> wrote in message
news:9838BEA0-655B-47F1-8B85-032A8A4B3CA2@xxxxxxxxxxxxxxxx
If you're already using the font, that means the underlying Windows
control
that .NET uses doesn't support changing the font for the edit box.
You would have to handle the BeforeLabelEdit, set the
NodeLabelEditEventArgs.CancelEdit to false and do whatever you want for
editing...
I think this example does something like that:
http://www.codeproject.com/cs/miscctrl/CustomizedLabelEdit.asp?df=100&forumid=224195&exp=0&select=1952320
--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"Richard Lewis Haggard" wrote:
And what font would that be? I'm already using the one that is associated
with control itself and that is where my confusion is coming from in that
there appears to be a discrepancy between the font that is supplied by
the
control and the one that is used by the in place edit.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
"Peter Ritchie [C# MVP]" <PRSoCo@xxxxxxxxxxxxxxxxx> wrote in message
news:0F589954-D778-44DD-8FAB-508740764925@xxxxxxxxxxxxxxxx
Have you tried setting the ListView's Font property to the font you
want
the
text box to use when it displays?
--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"Richard Lewis Haggard" wrote:
I have a TreeView control that is marked as DrawMode: OwnerDrawText
and
has
inline LabelEdit set to true. The problem is that the text that I'm
getting
from the node to draw is not the same font that is being used by the
edit
or
the same font that is being used by inline editing. When I do the
DrawString, I'm using the font that is in the node so it is unclear to
me
why the node's text is too big to fit in its bounds or why the
displayed
text is larger than the same text in the node's inline edit box.
Ideas?
.
- References:
- Problem drawing the right font in an owner draw TreeView
- From: Richard Lewis Haggard
- Re: Problem drawing the right font in an owner draw TreeView
- From: Richard Lewis Haggard
- Problem drawing the right font in an owner draw TreeView
- Prev by Date: GXOpenInput
- Next by Date: Re: How to disable inplace edit of some TreeView nodes
- Previous by thread: Re: Problem drawing the right font in an owner draw TreeView
- Next by thread: Focus not being set to Form Window
- Index(es):
Relevant Pages
|