Hello Everyone,
Branching out in my programming skills and working on creating a simple tetris game in vb.net (going through a tutorial Creating your own Tetris game using VB.NET). Everything works fine until I add labels to the form. They are not overlapping anything and the only code I am running is the initial splash. When I add the labels, the graphics in the panel do not appear anymore. I have verified this behaviour on 3 different attempts in different starter projects. Anyone know what is going on????
code and setup for anyone that doesn't want to go to the site:
1 form (form name: frmTet)
7 labels (text not important right now, default is fine)
2 panels, 1 large, 1 small (large panel is labeled: pnlTetGame, small panel is labeled: pnlTetPreview)
Thanks for any help!!!
Branching out in my programming skills and working on creating a simple tetris game in vb.net (going through a tutorial Creating your own Tetris game using VB.NET). Everything works fine until I add labels to the form. They are not overlapping anything and the only code I am running is the initial splash. When I add the labels, the graphics in the panel do not appear anymore. I have verified this behaviour on 3 different attempts in different starter projects. Anyone know what is going on????
code and setup for anyone that doesn't want to go to the site:
1 form (form name: frmTet)
7 labels (text not important right now, default is fine)
2 panels, 1 large, 1 small (large panel is labeled: pnlTetGame, small panel is labeled: pnlTetPreview)
VB.NET:
Public Class frmTet
Private Sub frmTet_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Splash()
End Sub
Private Sub Splash()
Dim gStart As Graphics = pnlTetGame.CreateGraphics() 'Enable Drawing Onto Panel
gStart.Clear(Color.Black) 'Clear If There Was Something
'Create H Shape
gStart.FillRectangle(New SolidBrush(Color.Red), 25, 100, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 25, 100, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 25, 105, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 25, 105, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 25, 110, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 25, 110, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 25, 115, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 25, 115, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 25, 120, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 25, 120, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 30, 110, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 30, 110, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 35, 110, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 35, 110, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 40, 100, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 40, 100, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 40, 105, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 40, 105, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 40, 110, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 40, 110, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 40, 115, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 40, 115, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Red), 40, 120, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 40, 120, 5, 5)
'Create T Shape
gStart.FillRectangle(New SolidBrush(Color.Green), 55, 100, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 55, 100, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Green), 60, 100, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 60, 100, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Green), 65, 100, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 65, 100, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Green), 60, 105, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 60, 105, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Green), 60, 110, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 60, 110, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Green), 60, 115, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 60, 115, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Green), 60, 120, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 60, 120, 5, 5)
'Create G Shape
gStart.FillRectangle(New SolidBrush(Color.Blue), 85, 100, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 85, 100, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Blue), 90, 100, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 90, 100, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Blue), 80, 105, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 80, 105, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Blue), 80, 110, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 80, 110, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Blue), 80, 115, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 80, 115, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Blue), 85, 120, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 85, 120, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Blue), 90, 120, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 90, 120, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Blue), 95, 115, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 95, 115, 5, 5)
gStart.FillRectangle(New SolidBrush(Color.Blue), 100, 115, 5, 5)
gStart.DrawRectangle(New Pen(Color.White, 1), 100, 115, 5, 5)
End Sub
End Class
Thanks for any help!!!