65.9K
CodeProject is changing. Read more.
Home

Minesweeper

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.39/5 (13 votes)

Feb 25, 2006

viewsIcon

53053

downloadIcon

3752

It is a game like Window minesweeper of microsoft

Sample Image - Net_framework.gif

Introduction

It is a game program like Window Minesweeper.Perhaps someone write their program like this. But I want to write agian.This is the first program of mine in C# and VS.Net, so it isn't really completely .I hope I'll get many opinions from people who read it

Using the Code

I use 4 main components to make this program 1:GraphicsItem 2:MinemouseEventhandler 3:mathbase 4:MineResorceSet

GraphicsItem
//
//It is some method
//
//
//constructor 
//
        public GraphicsItem(Image beginImage,int _Columns,int _Rows,int _GrItemWidth,int _GrItemHeight)
        {
//img is a Image of mine map
ResetAttribute(_Columns,_Rows,_GrItemWidth,_GrItemHeight);
            Img=new Bitmap(width,height);
            g=Graphics.FromImage(Img);
            ResetBeginImage(beginImage);
        }
//
//DrawItem in position x,y
//
        public void DrawItem(Image image,int column,int row)
        {
            g.DrawImage(image,column*grItemWidth,row*grItemHeight,grItemWidth,grItemHeight);
        }

MinemouseEventhandler
//
//This is class to decode MouseEventHandler of Winform to //Event-handler of this game
//
//
//sample method
//
        public void MouseMove(object sender,MouseEventArgs me)
        {
            if((me.X>=(MX+1)*_ItemWeight) || (me.X=(MY+1)*_ItemHeight)||(me.Y=0 && x=0 && y

class mathbase

It contains all method that processes property of mine map some method like makeminemap(),leftclick(x,y),...

class MineResourceSet

It is a class cotain all method read,write the set of game is load last game,and save new property