About not implement painting for control class

  • Thread starter Thread starter Frank Lee
  • Start date Start date
F

Frank Lee

According to .NET framework document about control class: "It defines the
bounds of a control (its position and size), although it does not implement
painting."

I don't understand what it means "not implement painting". Does it mean
that It does not paint?

For understanding what it means "not implement painting", I coded an simple
sample.

I put two control on the main form, one is UserControl and the other is
Control, with same size to (100, 100). The UserControl.BackColor is
Color.Blue, and the Control don't set any color. They are in same location.

In my sample, I find that the control will cover the usercontrol with the
same color of main form just like the control implment a simple painting:
graphics.fillrectangle(solidbrush, clientrectangle). Why does the document
say it doesn't implement painting?

---frank
 
I think that they're simply implying that there is no special painting done
to, let's say, render the Text value. It's just a plain control that can
occupy space. In addition, the basic painting that you're seeing is done in
the OnPaintBackground method. The OnPaint method simply fires the Paint
event, if applicable.
 
Back
Top