gpt4 book ai didi

c# - PropertyGrid 提示超链接?

转载 作者:太空宇宙 更新时间:2023-11-03 23:30:39 25 4
gpt4 key购买 nike

是否可以在属性网格提示中添加可点击的超链接?

我的类(class)有以下内容(作为 SelectedObject 分配给属性网格):

[Browsable(true), 
ReadOnly(false),
Category("7. InnoDB"),
DefaultValue(1),
Description("Defines what happens after InnoDB transaction commit, for more details view https://mariadb.com/kb/en/mariadb/xtradbinnodb-server-system-variables/#innodb_flush_log_at_trx_commit")]
public int innodb_flush_log_at_trx_commit { get; set; } = 1;

在属性网格中查看时,链接不可单击。有什么想法吗?

最佳答案

查看 MSDN 引用,PropertyGrid 使用两个 Label,一个用于标题,一个用于描述:

http://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/PropertyGridInternal/DocComment.cs,a0b78590be82b950

Label 不支持超链接。您可以做的是将 RichTextBox 放在描述标签上,让它显示文本。例如

    PropertyGrid pg = new PropertyGrid() { Dock = DockStyle.Fill };
Control c = pg.Controls[0]; // internal DocComment control
Label l1 = (Label) c.Controls[1];
RichTextBox tb = new RichTextBox { Multiline = true, WordWrap = true, ReadOnly = true, BorderStyle = BorderStyle.None };
c.Controls.Add(tb);
c.Controls.SetChildIndex(tb, 0);
l1.TextChanged += delegate {
tb.Text = l1.Text;
};
l1.SizeChanged += delegate {
tb.Size = l1.Size;
};
l1.LocationChanged += delegate {
tb.Location = l1.Location;
};

关于c# - PropertyGrid 提示超链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32372002/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com