[RESOLVED] [1.0/1.1] Converting
I thought a good way to learn C# would be to re-write all the VB.NET apps i've already written. To start small, i went with a RichText editor, but i can't get the font dialog to work. It shows up, but it won't change the text. Heres the code im using:
VB Code:
private void fontDialog1_Apply(object sender, System.EventArgs e)
{
rtb.SelectionFont = fontDialog1.Font;
}
Re: [RESOLVED] [1.0/1.1] Converting
Apply is the default event for the FontDialog, thus a handler is created for it when you double-click it, just like every component. The same would happen in the Microsoft VB IDE. With most dialogues though, it's the return value of ShowDialog that you're most interested in.
Re: [RESOLVED] [1.0/1.1] Converting
It funny that its default event is Apply, yet, by default it doesn't add an apply button...
Re: [RESOLVED] [1.0/1.1] Converting
The FontDialog only has two events: Apply and HelpRequest. It doesn't show a Help button by default either, and I guess they judged that Apply would be used more often so that should be the default. I guess you would expect that it would have an event that corresponded to the OK button being pressed, like the FileDialogs do. Not that that event gets used much anyway as most people just test the return value of ShowDialog anyway. It would be a bit more intuitive though.