I have a Font option in my PropertyGrid wher the user can set the font.
Is there a way to filter fonts for selection?
For example, say I don't want the user to be able to pick an Arial or Sans Serif font.
I am using the standard PropertyGrid (System.Windows.Forms.PropetyGrid), for this settings window:
I simply included a property based on Drawing.Font to the object:
<Category("Display"), Description("The font of the text displayed in the grid.")>
Public Property Font() As Drawing.Font Implements IGridSetting.Font
Get
Return FontConverter.FromBase64(_font)
End Get
Set(ByVal value As Drawing.Font)
_font = FontConverter.ToBase64(value)
OnPropertyChanged("Font")
End Set
End Property
that I add to the PropertyGrid through SelectedObject.
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
Me.PropertyEditor.SelectedObject = <object>
End Sub
This causes the above PropertyGrid to include the standard Font settings for that object.
However, I have yet to find a way to filter the Font Names that are offered in that PropetyGrid.
This approach may well not be as customizable as I like, but want to check before I look into creating a totally custom PropertyGrid.