I'm trying to display an empty text message inside a listview when I have no items inside it (that's when the form is initialized).
I've tried searching different method out of which one is using the `OnPaint() event , but that didn't work out well...
Can someone help me out ?` Edit: this is one of the methods I've tried:
protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == 20) { if (this.Items.Count == 0) { _b = true; Graphics g = this.CreateGraphics(); int w = (this.Width - g.MeasureString(_msg, this.Font).ToSize().Width) / 2; g.DrawString(_msg, this.Font, SystemBrushes.ControlText, w, 30); } else { if (_b) { this.Invalidate(); _b = false; } } } if (m.Msg == 4127) this.Invalidate(); }