This control is better than MS Paints
Transparent Textbox: http://www.codeproject.com/Articles/4390/AlphaBlendTextBox-A-transparent-translucent-textbo
Alex Fr provided an excellent set of drawing tools in his DrawTools article and these tools serve as a basis for Draw Tool Redux. In the articles you can see the project is based on MSPaint's code as a C++ port to C#.
I did a drawing tool with these tools in a commercial app and the result was very high quality.
In the DrawTools Redux projects' DrawArea.cs file I made this adjustment to provide users with a Transparent Textbox:
public DrawToolType ActiveTool
{
get { return activeTool; }
set
{
if (activeTool == value) return;
if (activeTool == DrawToolType.Text)
{
alphaBlendTextBox txt = null;
foreach (var ctrl in Controls)
{
if (ctrl as alphaBlendTextBox!= null)
{
txt = (alphaBlendTextBox)ctrl;
break;
}
}
if (txt != null) ((ToolText)tools[(int)activeTool]).txt_Leave(txt, null);
}
activeTool = value;
}
}
I also supported Symbols and colouring, again this code in DrawArea.cs:
public void InsertSymbol(string symbolSyntax)
{
foreach (var obj in Controls)
{
if (obj as AlphaBlendTextBox.AlphaBlendTextBox != null)
{
var txt = ((AlphaBlendTextBox.AlphaBlendTextBox)obj);
var selectionIndex = txt.SelectionStart;
int value = int.Parse(symbolSyntax, System.Globalization.NumberStyles.HexNumber);
symbolSyntax = char.ConvertFromUtf32(value).ToString();
txt.Text = txt.Text.Insert(selectionIndex, symbolSyntax);
txt.SelectionStart = selectionIndex + symbolSyntax.Length;
break;
}
}
Invalidate();
}
public void ApplyColorToSelected()
{
int activeLayer = 0;
foreach (var obj in TheLayers[activeLayer].Graphics.Selection)
{
obj.Color = LineColor;
}
foreach (var obj in Controls)
{
if (obj as AlphaBlendTextBox.AlphaBlendTextBox != null)
{
((AlphaBlendTextBox.AlphaBlendTextBox)obj).ForeColor = LineColor;
}
}
Invalidate();
}
The EyeDropper Colour Picker I got from http://www.codeproject.com/Articles/36540/Adobe-Eyedropper-Control