I guess, this is a diagonal red cross showing just in the design mode, meaning that the rendering cannot be performed at design time. Try to comment out rendering code, and you will see.
Your code sample has one
major bug: call to
Invalidate
from the rendering code.
It actually means "infinite" repetition of rendering, infinite recursion. Apparently, you have no clue how it works. Please see my past answers:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[
^].
Are you getting the idea? See some more of those answers:
capture the drawing on a panel[
^],
Drawing Lines between mdi child forms[
^],
How to speed up my vb.net application?[
^],
Zoom image in C# .net mouse wheel[
^].
Final advice: don't overuse the designer; doing so means a lot of dumb manual work, which is hard to maintain. And protect your code running under the designer from such disasters when a designer mode cannot show at all, which is a common case. You can execute as little of questionable code in design mode as possible, which can be achieved by using this check:
if (!DesignMode)
Please see:
https://msdn.microsoft.com/en-us/library/system.componentmodel.component.designmode(v=vs.110).aspx[
^].
—SA