【发布时间】:2014-10-27 10:33:39
【问题描述】:
我正在尝试在标题栏中添加一个按钮,我想赋予它与其他按钮相同的外观,但我无法做到,请参阅:
请注意,我的新按钮颜色比其他按钮更亮,而且尺寸突出了黄色边框。
这是我正在使用的代码:
Imports Telerik.WinControls.UI
Public Class RadForm_TestForm : Inherits RadForm
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Set the RadForm design.
With Me
.ThemeName = "VisualStudio2012Dark" ' The visual theme.
.FormElement.Border.ForeColor = Color.Gold ' Set the borders color.
.FormElement.Border.Width = 1I ' Set the borders width.
.FormElement.TitleBar.BorderPrimitive.ForeColor = Color.Red
.FormElement.TitleBar.ForeColor = Color.LightGray ' Set the TitleBar text color.
.FormElement.TitleBar.MinimizeButton.Enabled = False
End With
' Create a RadButtonElement.
Dim SystrayButton As New RadButtonElement()
With SystrayButton ' Set the RadForm design.
.Text = "."
.ShowBorder = False
.AutoSize = False
.Size = Me.FormElement.TitleBar.MinimizeButton.Size
' .ButtonFillElement.BackColor = Me.FormElement.TitleBar.MinimizeButton.BackColor
End With
' Add the Button in the TitleBar.
Me.FormElement.TitleBar.Children(2).Children(0).Children.Insert(0, SystrayButton)
End Sub
End Class
请注意,在上面的代码中,这一行被禁用:
.ButtonFillElement.BackColor = Me.FormElement.TitleBar.MinimizeButton.BackColor
因为如果我以这种方式更改颜色,如果我将鼠标放在按钮上,它在聚焦时不会改变颜色。
更新:
也许解决方案可以在RadButtonElement 上应用我的RadForm 的相同主题?
我读过这个:http://www.telerik.com/forums/apply-theme-to-radbuttonelement
...但我真的不明白该怎么做,我没有任何“DefaultStyleBuilder”,我在 Telerik 中找不到关于这意味着什么的信息。
【问题讨论】:
-
@Joiner 谢谢,但你明白我的问题的根源吗?这不是我正在寻找的解决方案,我已经在使用不需要破解表单的用户控件和弄乱客户/非客户区域以添加按钮。这是 Telerik 用户界面。
标签: .net vb.net winforms user-controls telerik