Need help on the game
Need help on the game
Need help on the game
Need help on the game
Need help on the game
Need help on the game Need help on the game Need help on the game Need help on the game Need help on the game Need help on the game Need help on the game Need help on the game
Need help on the game Need help on the game
Need help on the game
Go Back  Xtreme Visual Basic Talk > > > Need help on the game


Reply
 
Thread Tools Display Modes
  #1  
Old 01-09-2006, 08:56 AM
16killer 16killer is offline
Newcomer
 
Join Date: Jan 2006
Posts: 4
Default Need help on the game


I need help on this code



Dim mpen As Pen = New Pen(Color.Black, 3)
Dim cruz As Pen = New Pen(Color.Red, 3)


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtbox.Click
PictureBox1.CreateGraphics.DrawLine(mpen, 0, CInt(PictureBox1.Height / 3), PictureBox1.Width, CInt(PictureBox1.Height / 3))
PictureBox1.CreateGraphics.DrawLine(mpen, 0, CInt(PictureBox1.Height * 2 / 3), PictureBox1.Width, CInt(PictureBox1.Height * 2 / 3))
PictureBox1.CreateGraphics.DrawLine(mpen, CInt(PictureBox1.Width / 3), 0, CInt(PictureBox1.Width / 3), PictureBox1.Height)
PictureBox1.CreateGraphics.DrawLine(mpen, CInt(PictureBox1.Width * 2 / 3), 0, CInt(PictureBox1.Width * 2 / 3), PictureBox1.Height)

End Sub

Private Sub PictureBox1_MouseDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
Dim Dimx As Integer = CInt(PictureBox1.Width / 3)
Dim Dimy As Integer = CInt(PictureBox1.Height / 3)
If (e.X <= Dimx And e.Y <= Dimy) Then '1
PictureBox1.CreateGraphics.DrawLine(cruz, 0, 0, Dimx, Dimy)
PictureBox1.CreateGraphics.DrawLine(cruz, 0, Dimy, Dimx, 0)

End If
End Sub

and i want the other code tu put the x in the outrer box
http://img446.imageshack.us/img446/4316/f1nk.jpg
Reply With Quote
  #2  
Old 01-12-2006, 06:34 PM
Iceplug's Avatar
IceplugNeed help on the game Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

From eyeballing the code, I would guess that you'd add 2 * PictureBox.Width or 2 * PictureBox.Height to the corresponding coordinates.

A big problem I see is that you are creating graphics every time you want to draw something. You should only create one Graphics object.
Dim GFX As Graphics
assign it in the Form_Load from your PictureBox.CreateGraphics() function.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
Reply


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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Need help on the game
Need help on the game
Need help on the game Need help on the game
Need help on the game
Need help on the game
Need help on the game Need help on the game Need help on the game Need help on the game Need help on the game Need help on the game Need help on the game
Need help on the game
Need help on the game
 
Need help on the game
Need help on the game
 
-->