OOP Beginner question

  • Thread starter Thread starter shachar
  • Start date Start date
S

shachar

hi all.
i'm writing a simple board game and i have 3 classes:
1)MyGameForm - a vb form
2)BoardGame - class
3)Cell - class
MyGameForm Contains BoardGame.
BoardGame Contains Cell.
on the MyGameForm Form i have a picturebox with the
pictur of the board, and another picturebox (pic1)that
moves when the player clicks on the board.
on the click event i want to call the "DrawCell" method
of the Cell class, and move the pic1 to a certain
cordinates.
BUT - how can i move controls(pic1) on MyGameForm from
Cell?
 
Shachar,

First something basic, in my opinion is a control painted on a screen and
therefore is for us the form the layer.

Cor
 
This is the wrong way to think about it.

You would be better getting the paint event of the form to call a DrawBoard
method in the Board class which called the Drawcell in the cell class. The
Paint event would pass its Graphics to the board which would then pass it to
the cell.
 
shachar said:
BUT - how can i move controls(pic1) on MyGameForm from
Cell?

You can either set the control's 'Left' and 'Top' properties or its
'Location' property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top