I have a DataGridView with a column of text box cells that need to have watermark text. I also have a static class that uses DLLImport to add a watermark to a TextBox using SendMessage with a IntPtr hWnd as one of parameters, like this:
public static void SetWatermark(TextBox textBox, string watermarkText)
{
SendMessage(textBox.Handle, EM_SETCUEBANNER, 0, watermarkText);
}
Problem is, while the TextBox inherits the Control.Handle property, DataGridViewTextBoxCell does not, so I can't get that IntPtr parameter. It is my understanding that the cell uses a TextBox control to edit the value, so shouldn't there be some way to get to that Handle?
I am using .NET 2.0 and C#