Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Apr 19th, 2005, 9:55 AM   #1
Gapper
Newbie
 
Join Date: Mar 2005
Location: Ireland
Posts: 5
Rep Power: 0 Gapper is on a distinguished road
Smile creating a chess board(Have first row)

Am able to draw first line of eight squares but cannot create next rows:
Here is the code that im using.


Private Rects() As Rectangle

Protected Overrides Sub OnLoad(ByVal e As EventArgs)
MyBase.OnLoad(e)

Dim w As Integer = Me.pbMain.Width
Dim h As Integer = Me.pbMain.Height

Dim numVlines As Integer = CInt(w / 8)
Dim numHLines As Integer = CInt(h / 8)
Dim b As New Bitmap(w, h)
Dim ppi As Single = w / 8
Dim startX As Integer = 0
Dim clr As Color = Color.Black
Dim switchClr As Boolean = False
Dim g As Graphics = Graphics.FromImage(b)
g.Clear(Color.White)
For i As Integer = 1 To numVlines
If switchClr Then
clr = Color.Green
switchClr = False
Else
clr = Color.GreenYellow
switchClr = True
End If

Dim rect As New Rectangle(startX, 0, ppi, ppi)
g.FillRectangle(New SolidBrush(clr), rect)
g.DrawRectangle(New Pen(Color.White), rect)
ReDim Preserve Rects(i)
Rects(i) = rect
startX += rect.Width
Next

Me.pbMain.Image = b
Gapper is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:09 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC