中华网校

系列网站: 中华网校 | www.网校.com | 3D模型 | 中华网校教育

电脑网校 | 业界新闻 | 职业网校 | 网校宝典 | 软件下载 | 网校论坛 | 网校联盟

电脑入门 | 网页设计 | 网络编程 | 图形图象 | 三维空间 | 多媒体 | 程序语言 | 操作系统 | 系统专题 | 办公应用 | 软件宝典 | 硬件天下 | 

 

您的位置:首页 >> 网络编程 >> C#.NET >> 新闻正文

c#写的五子棋程序,供学习WinForms的鼠标事件和使用GDI+  

作者:  时间:2004-7-13  来自:  责任编辑:  阅读次数:

nt p)

{

//get witch rectangle click

for(int i = 0;i < 225;i++)

{

if(pointSquares[i].Contains( p ))

{

return i;

}

}

return -1;

}

private void OnRButtonDown(Point p)

{

//regret chess

int nPos,x,y;

if(chessIndex.Count != 0)

{

nPos = (int)chessIndex.Pop();

x = nPos%15;

y = nPos/15;

chessTable[nPos] = 0;

nextTurn = (int)chessIndex.Pop();

this.Invalidate(new Rectangle(new Point(8+x*20,5+y*20),new Size(20,20)));

}

}

private void DrawBlack(Graphics g,int nPos)

{

//draw Black chess

int x,y;

x = nPos%15;

y = nPos/15;

imageListbw.DrawImage(g,8+20*x,5+20*y,20,20,0,0);

}

private void DrawWhite(Graphics g,int nPos)

{

//draw White chess

int x,y;

x = nPos%15;

y = nPos/15;

imageListbw.DrawImage(g,8+20*x,5+20*y,20,20,0,1);

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

public override void Dispose()

{

base.Dispose();

components.Dispose();

}

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

System.Resources.ResourceManager resources = new System.Resources.ResourceManager (typeof(FiveForm));

this.components = new System.ComponentModel.Container ();

this.imageListbw = new System.WinForms.ImageList ();

//@this.TrayHeight = 90;

//@this.TrayLargeIcon = false;

//@this.TrayAutoArrange = true;

//@imageListbw.SetLocation (new System.Drawing.Point (7, 7));

imageListbw.ImageSize = new System.Drawing.Size (20, 20);

imageListbw.ImageStream = (System.WinForms.ImageListStreamer) resources.GetObject ("imageListbw.ImageStream");

imageListbw.ColorDepth = System.WinForms.ColorDepth.Depth8Bit;

imageListbw.TransparentColor = System.Drawing.Color.Yellow;

this.Text = "FiveForm";

this.MaximizeBox = false;

this.AutoScaleBaseSize = new System.Drawing.Size (6, 14);

this.BorderStyle = System.WinForms.FormBorderStyle.FixedSingle;

this.BackgroundImage = (System.Drawing.Image) resources.GetObject ("$this.BackgroundImage");

this.TransparencyKey = System.Drawing.Color.White;

this.ClientSize = new System.Drawing.Size (314, 311);

}


/// <summary>

/// The main entry point for the application.

/// </summary>

public static int Main(string[] args)

{

Application.Run(new FiveForm());

return 0;

}

}

}

   c#写的五子棋程序,供学习WinForms的鼠标事件和使用GDI+   共有2页  1  2 页

相关文章 最新文章 推荐文章

  中华网校依法保护知识产权,如果我们的文章有涉及或侵犯您的有关权益,请即时与我们 联系, 注明网址及文章,我们会即时处理或删除,感谢您的合作!中华网校email
  中华网校由广州市中六电脑城智锐计算机专业培训学院及中华网校技术中心提供网络支持未经本站许可任何个人网站、书刊报社一律不得私自复制,转载本站内容!

关于中华网校 | 广告服务 | 版权声明 | 投稿指南 | 网站合作 | 友情链接 | 网站地图

 

版权所有 中华网校 & 智锐网校 1999-2004 COPYRIGHT (C) 1999-2004 www.ZhiRui.com ALL RIGHTS RESERVED

 
/**/