TreeNode in bold clips the label also if Treeview Fond is bold

G

Guest

When settiing a TreeNode to bold the text label of that node is clipped. As
describedin in the Bug Rebort FDBK16963 I set the underliying TreeView Fond
to be bold.

Now I have the strange behavior, if I delete all childnodes, when the parent
node is expanted, and rebuild all child treenodes, I can make an childnode
bold without clipping it. If I make the same with an closed parent node so
after rebulding all childnodes and expanting it, all child nodes will be
clipped if makeing them bold
 
L

Luke Zhang [MSFT]

Hello,

Can you provide some source code you are currently working with? With them,
we may reproduce the issue and see what happen there.

Thanks,

Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Hello Luke,

for example the code for making the childnodes:

Private Sub update_mrkparlist(ByRef prp_date_id As Integer, ByRef
mrk_num As String)
Dim paritem As ListViewEx.ListViewItem
Dim prp_par_num() As Short = Nothing
Dim prp_par_kom() As String = Nothing
Dim prp_par_val() As Single = Nothing
Dim prp_par_fmt() As String = Nothing
Dim prp_par_txt() As String = Nothing
Dim idx As Short
Dim par_node As TreeViewEx.TreeNode
Dim mkey As String = ""
Dim parTxt As String = ""

ACTION_SEND = AC_LOAD
siz_size = MAX_REC_SIZE
rec_size = 0
retval = ole2eva.w_ustmmprl(rec_size, siz_size, prp_date_id,
mrk_num, prp_par_num, prp_par_kom, prp_par_val, prp_par_fmt, prp_par_txt,
zugriff_user, ACTION_SEND, ACTION_RET)
If rec_size = MAX_REC_SIZE Then

meassage(fm_evastamm.DefInstance.lv_text.GetText("T_message_maxsize"))
End If

If ts_main.SelectedTab.Name = "MPLST" Then
bring_Listbox("MPLST", Im_EVA)
lv_main.Columns.Clear()

lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_Parameter"),
70, HorizontalAlignment.Left)

lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_Kommentar"),
150, HorizontalAlignment.Left)

lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_Wert"), 50,
HorizontalAlignment.Left)

lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_Format"), 50,
HorizontalAlignment.Left)

lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_ParameterText"), 300, HorizontalAlignment.Left)
End If

While tv_main.SelectedNode.GetNodeCount(False) > 0
tv_main.Nodes.Remove((tv_main.SelectedNode.FirstNode))
End While
lv_main.Items.Clear()
tv_main.ImageList = Im_EVA
parTxt = fm_evastamm.DefInstance.lv_text.GetText("T_Parameter") & ": "
For idx = 0 To rec_size - 1
mkey = "MP" & prp_date_id & KEYSEP & mrk_num & KEYSEP &
prp_par_num(idx)
paritem = New ListViewEx.ListViewItem(mkey, 11,
CStr(prp_par_num(idx)))
paritem.Text = CStr(prp_par_num(idx))
paritem.SubItems.Add(prp_par_kom(idx))
paritem.SubItems.Add(to_string(prp_par_fmt(idx),
prp_par_val(idx), idx + 1))
paritem.SubItems.Add(prp_par_fmt(idx))
paritem.SubItems.Add(prp_par_txt(idx))
lv_main.Items.Add(paritem)
par_node = New TreeViewEx.TreeNode(mkey, 11, parTxt &
prp_par_num(idx))
par_node.Tag = prp_par_num
tv_main.SelectedNode.Nodes.Add(par_node)
Next idx
End Sub

this is the code to making the selected node bold and the selected node
befor to normal fond

Public Sub tv_main_AfterSelect(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeViewEventArgs) Handles tv_main.AfterSelect

Dim fnt As Font
Dim fnt_bold As Font

akt_node = tv_main.SelectedNode
fnt = akt_node.NodeFont
fnt_bold = New Font(fnt, FontStyle.Bold)
akt_node.NodeFont = fnt
If Not (akt_node_befor Is Nothing) Then akt_node_befor.NodeFont = fnt
akt_node.NodeFont = fnt_bold
akt_node_befor = akt_node

End Sub

and hear you see the code for my extended treeview with key inside

Public Class TreeNode
Inherits System.Windows.Forms.TreeNode
Implements IDictionaryEnumerator

Private nodeEntry As DictionaryEntry
Private enumerator As IEnumerator

Public Sub New()
enumerator = MyBase.Nodes.GetEnumerator()
End Sub
Public Sub New(ByVal Key As String)
enumerator = MyBase.Nodes.GetEnumerator()
nodeEntry.Key = Key
End Sub
Public Sub New(ByVal Key As String, ByVal ImageIndex As Short, ByVal
Text As String)
enumerator = MyBase.Nodes.GetEnumerator()
nodeEntry.Key = Key
MyBase.Text = Text
MyBase.ImageIndex = ImageIndex
MyBase.SelectedImageIndex = ImageIndex
MyBase.NodeFont = New Font("Microsoft Sans Serif", 8,
FontStyle.Regular)
End Sub
Public Property NodeKey() As String
Get
Return nodeEntry.Key.ToString()
End Get

Set(ByVal Value As String)
nodeEntry.Key = Value
End Set
End Property
Public Property NodeValue() As Object
Get
Return nodeEntry.Value
End Get

Set(ByVal Value As Object)
nodeEntry.Value = Value
End Set
End Property
Public Overridable Overloads ReadOnly Property Entry() As
DictionaryEntry _
Implements IDictionaryEnumerator.Entry

Get
Return nodeEntry
End Get
End Property
Public Overridable Overloads Function MoveNext() As Boolean _
Implements IDictionaryEnumerator.MoveNext

Dim Success As Boolean

Success = enumerator.MoveNext()
Return Success
End Function
Public Overridable Overloads ReadOnly Property Current() As Object _
Implements IEnumerator.Current

Get
Return enumerator.Current
End Get
End Property
Public Overridable Overloads ReadOnly Property Key() As Object _
Implements IDictionaryEnumerator.Key

Get
Return nodeEntry.Key
End Get
End Property

Public Overridable Overloads ReadOnly Property Value() As Object _
Implements IDictionaryEnumerator.Value

Get
Return nodeEntry.Value
End Get
End Property

Public Overridable Overloads Sub Reset() _
Implements IEnumerator.Reset

enumerator.Reset()
End Sub
End Class

I hobe this will help you to help me.

Best regards

Manfred Loeffler
 
L

Luke Zhang [MSFT]

Hello,

Thank you for the code, however, there is still some parts not clear. I
cannot find How you deifne "akt_node" and "akt_node_befor"? Also, could you
please tell the exact link for "Bug Rebort FDBK16963" mentioned in your
first message?

Thanks,

Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
L

Luke Zhang [MSFT]

Thank you for the information. I can now run a sample application with your
code. But strange enough, I couldn't found the issue you mentioned the
thild node will always clipped if its font is bold. For example, I select a
parent node, and then click a button, running some code to remove its child
nodes and re-add them. But the child nodes always clipped when I selected
them.

Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Can you send me an email adress where I can send you some screenshots of the
behavour of the treeview with the necassery action to reproduce the error

Manfred Löffler
 
L

Luke Zhang [MSFT]

Please remove "online" to get my actual email. And, how many items did you
add to the parent node?

Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Hello Luke,

I have make some screenshots with the strange behaviour and send it to you
by mail.

I hope this will help you.

so long,

Manfred Löffler
 
L

Luke Zhang [MSFT]

Thank you for the inforamtion. I have got your message and seen the screen
shot. However, I still cannot repro on my side. I suspect it may be related
the nodes we added in the treeview control.

Anyway, I double if we should call this a bug. The "Clipped" node text is a
known bug, and the "unclipped" text is right behavior as we expect. So, if
we get the "unclipped" with some precondition, shall we call it a bug?

Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Yes I thing it is a bug because the behaviour is completlie differnt to the
former version of Framework 1.1 and my custumers can not accept an clipped
treenode. I make now the selected treeview in a different color and waiting
of the bugfix which correct the problem with the bold treenode.

Manfred Löffler
 
L

Luke Zhang [MSFT]

By further researching on the bug, I found it is related to the comctl
control shipped with Windows and IE. The bad news is, we cannot expect it
will be fixed in a short time since it is not a completed .NET issue.

Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top