
Introduction
The sample image shows what it is all about. I wanted to write
a kind of osql.exe-with-a-GUI (osql is the command line utility which comes with the
Microsoft MSDE database). I don't like the .NET tab controls:
it's like they are a toolbar. So, I decided to write my own. It's a very simple
control: there is no scrollbar to the right nor arrows to the left, to change the
current selected tab.
The source code contains a demo project as well. SqlPad.cs
shows you how to use the class SheetView.
Usage
...
_SheetView = new SheetView();
_SheetView.Dock = DockStyle.Bottom;
_SheetView.Height = 18;
_SheetView.Font = new Font("verdana", 8, GraphicsUnit.Point);
_SheetView.Sheets.Add(new Sheet("Output 1"));
_SheetView.Sheets.Add(new Sheet("Output 2"));
_SheetView.OnSelectionChanged += new EventHandler(OnOutputWindowChanged);
...
void OnOutputWindowChanged(Object sender, EventArgs e)
{
_Output[0].Visible = false;
_Output[1].Visible = false;
_Output[_SheetView.SelectedIndex].Visible = true;
}
Note 1: SqlPad also shows you how to handle the typical File New,
Open, Save and Save As menu items. Take a look at Document.cs and SqlDocument.cs.
However, Document needs a little polishing if you want to use it in your own projects:
for example, there're no property filters. The project also shows how to deal with the
Undo Bug in RichTextBox: examine RichTextBoxBase.cs if you're interested.
Note 2: SqlPad isn't finished at all. I thought it would be easy to create
a syntax color text box based on RichTextBox, but it isn't. I would have to write
my own editor from scratch, but on my computer, it seems that
it would be better to implement one in C, .NET is too slow.