如果Treeview Fond为粗体,则以粗体显示的TreeNode也会剪切标签 [英] TreeNode in bold clips the label also if Treeview Fond is bold
问题描述
将TreeNode设置为粗体时,将剪切该节点的文本标签。正如在Bug Rebort FDBK16963中描述的那样,我将底层的TreeView Fond
设置为粗体。
现在我有了奇怪的行为,如果我删除所有的子节点,当父级
节点被扩展,并重建所有子节点时,我可以使子节点
粗体而不剪切它。如果我对一个封闭的父节点进行相同的操作,那么在重新生成所有子节点并对其进行重新表示之后,所有子节点将被修改为
如果将它们设为粗体
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
推荐答案
你好,
你能提供一些你目前正在使用的源代码吗?有了它们,我们可以重现这个问题并看看那里发生了什么。
谢谢,
Luke Zhang
(此帖子按原样提供,不作任何保证,并且不授予
权利。)
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.)
你好Luke,
例如制作子节点的代码:
Private Sub update_mrkparlist(ByRef prp_date_id As Integer ,ByRef
mrk_num As String)
Dim paritem作为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 = M AX_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)
如果rec_size = MAX_REC_SIZE那么
meassage(fm_evastamm.DefInstance.lv_text.GetText (QUOT; T_message_maxsize"))
结束如果
如果ts_main.SelectedTab.Name =" MPLST"然后
bring_Listbox(MPLST",Im_EVA)
lv_main.Columns.Clear()
lv_main.Columns.Add (fm_evastamm.DefInstance.lv_tex t.GetText(" T_Parameter"),
70,HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm。 DefInstance.lv_tex t.GetText(" T_Kommentar"),
150,HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_tex t.GetText(" T_Wert"),50,
HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_tex t.GetText (T_Format),50,
HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_tex t.GetText(" T_ParameterText"),300,HorizontalAlignment.Left)
结束如果
虽然tv_main.SelectedNode.GetNodeCount(False)> 0
tv_main.Nodes.Remove((tv_main.SelectedNode.FirstNo de))
结束时
lv_main.Items.Clear()< br $>
tv_main.ImageList = Im_EVA
parTxt = fm_evastamm.DefInstance.lv_text.GetText(" T_Paramet er")& ""
对于idx = 0要rec_size - 1
mkey =" MP" &安培; prp_date_id& KEYSEP& mrk_num& KEYSEP&
prp_par_num(idx)
paritem =新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。添加(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)
下一个idx
结束子
这是使所选节点变为粗体和所选节点的代码
bfor normal fond
Public Sub tv_main_AfterSelect(ByVal sender As Object,ByVal e As
System.Windows.Forms.TreeViewEventArgs)处理tv_main.AfterSelect
Dt fnt As Font
Dim fnt_bold As Font
akt_node = tv_main.SelectedNode
fnt = akt_node.NodeFont
fnt_bold =新字体(fnt,FontStyle.Bold)
akt_node.NodeFont = fnt
如果不是(akt_node_befor什么都没有)那么akt_node_befor.NodeFont = fnt
akt_node.NodeFont = fnt_bold
akt_node_befor = akt_node
结束子
和听到你看到我的扩展树视图的代码与内部的密钥
公共类TreeNode
继承System.Windows.Forms.TreeNode
实现IDictionaryEnumerator
私有nodeEntry作为DictionaryEntry
私人枚举器作为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 S ub 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属性NodeKey()As String
获取
返回nodeEntry.Key.ToString()
结束获取
设置(ByVal值为字符串)
nodeEntry.Key =价值
结束集
结束物业
公共属性NodeValue()As Object
获取
返回nodeEntry.Value
结束获取
设置(ByVal值为对象)
nodeEntry.Value = Value
结束集
结束财产
公开Overoverable Overloads ReadOnly属性条目()为
DictionaryEntry _
实现IDictionaryEnumerator.Entry
获取
返回nodeEntry
结束获取
End Property
Public Overridable Overloads函数MoveNext()As Boolean _
实现IDictionaryEnumerator.MoveNext
Dim Success As As布尔值
成功= enumerator.MoveNext()
返回成功
结束功能
Public Overridable重载ReadOnly属性Current()As Object _
实现IEnumerator.Current
获取
返回enumerator.Current
结束获取
结束财产
公共可覆盖超载ReadOnly属性Key()作为对象_
实现IDictionaryEnumerator.Key
获取
返回nodeEntry.Key
结束获取
结束物业
Public Overridable Overloads ReadOnly属性Value()As Object _
实现IDictionaryEnumerator.Value
获取
返回nodeEntry.Value
结束获取
结束物业
Public Overridable Overloads Sub Reset()_
实现IEnumerator.Reset
enumerator.Reset()
End Sub
结束班级
我会帮助你帮助我。
祝你好运
Manfred Loeffler
" Luke Zhang [MSFT]"写道:
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_tex t.GetText("T_Parameter"),
70, HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_tex t.GetText("T_Kommentar"),
150, HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_tex t.GetText("T_Wert"), 50,
HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_tex t.GetText("T_Format"), 50,
HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_tex t.GetText("T_ParameterText"), 300, HorizontalAlignment.Left)
End If
While tv_main.SelectedNode.GetNodeCount(False) > 0
tv_main.Nodes.Remove((tv_main.SelectedNode.FirstNo de))
End While
lv_main.Items.Clear()
tv_main.ImageList = Im_EVA
parTxt = fm_evastamm.DefInstance.lv_text.GetText("T_Paramet er") & ": "
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
"Luke Zhang [MSFT]" wrote:
您好,
您能提供一些目前正在使用的源代码吗?有了他们,我们可以重现这个问题,看看那里发生了什么。
谢谢,张璐璐
(这篇文章提供了AS IS,没有保证,也没有赋予
权利。)
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.)
您好,
感谢您的代码,但仍有一些部分不清楚。我
找不到你如何解决akt_node的问题。和akt_node_befor?另外,你能否告诉Bug Rebort FDBK16963的确切链接
在你的
第一条消息中提到了吗?
谢谢,
Luke Zhang
(此帖子按原样提供,不作任何保证,并且不授予
权利。)
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.)
这篇关于如果Treeview Fond为粗体,则以粗体显示的TreeNode也会剪切标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!