Partial Public Class TestPictureBox : Inherits UserControl
Public Sub New()
MyBase.New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint, True)
UpdateStyles()
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MessageBox.Show("2")
DrawNewCharacterSprite()
MessageBox.Show("2.1")
End Sub
Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
MessageBox.Show("1")
End Sub
End Class
DrawNewCharacterSprite renders the DirectX texture, and it does fine, it just gets overriden by User Control.
Here's what happens when I run it:
1, 2, Character Drawn, 2.1, Back to back color, 1, 2, Character Drawn, 2.1, Back to back color.
If I use e.Graphics.Draw___ then it is fine and it will render it completely, but it does not pay attention to DirectX.