New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Bold Property to TreeNode #2788
Comments
A definition for
In this case I propose we create a property called [UPDATE] applied @weltkante corrections and added a link to more background on the boldness issues |
Not entirely correct, there is Also note the hint at the bottom of the docs, mentioning that NodeFont is bugged and will get clipped if the text drawn with NodeFont is larger than what the TreeView font would produce. I wonder if introducing the |
This is exactly one of the reasons why the TVIS_BOLD flag exists in the first place, to avoid the text clipping problem. See https://devblogs.microsoft.com/oldnewthing/20090406-00/?p=18623 |
🤦♂ I'm not sure how I missed it... I guess I was looking for |
namespace System.Windows.Forms
{
public partial class TreeNode
{
public bool IsBold { get; set; }
}
} |
The native Win32
TreeView
control supports the item state flagTVIS_BOLD
for makingTreeNodes
bold. This is not exposed in the Windows FormsTreeNode
API.I would suggest adding a new Property
bool Bold { get; set; }
toTreeNode
, which when set totrue
, sets the item state flag on theTreeView
item.Describe alternatives you've considered
The canonical way to do this now by setting the
NodeFont
to something derived from the original is a bit cumbersome and also has the problem of potentially using the wrong font. The built-in default font may be different from the default font set in the OS.Setting the state flag manually via P/invoking
SendMessage(TVM_SETITEMW ...)
works but is difficult to implement and also only works if theTreeNode
already has a handle, i.e. it has been added to theTreeView
already.Will this feature affect UI controls?
Yes
The new property
TreeNode.Bold
should be settable via the designer like otherTreeNode
properties.The text was updated successfully, but these errors were encountered: