我想在標題欄添加一個按鈕,我想給它比其他按鍵相同方面,但我無法做到這一點,請參閱:Telerik,如何在RadForm TitleBar中正確添加RadButtonElement?
通知我新按鈕的顏色比其他顏色更亮,並且尺寸也會突出黃色邊框。
這是我使用的代碼:
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的信息是什麼意思是。
參見[Vista的Aero的ToolStrip對非客戶區(http://www.codeproject.com/Articles/32623/Vista-Aero-ToolStrip-on-Non-Client-Area)[vb.net](http://www.codeproject.com/Articles/44235/Painting-Vista-s-Aero-NonClientArea-in-VB-淨)。 – 2014-09-09 19:46:56
請參見[如何使用Windows窗體在窗口標題欄中繪製自定義按鈕](http://stackoverflow.com/a/107437/3453226)。 – 2014-09-09 19:51:18
@Joiner謝謝,但你理解我的問題的根源?,是不是我正在尋找的解決方案,我已經在使用一個用戶控件,它不需要破解表單並與客戶端/客戶區添加一個按鈕。這是Telerik UI。 – ElektroStudios 2014-09-10 13:35:16