⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imageeditform.cs

📁 C#纸牌游戏,做的还是比较精致的.值得学习.
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Resources;
namespace CardGame
{
	/// <summary>
	/// ImageEditForm 的摘要说明。
	/// </summary>
	public class ImageEditForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.PictureBox pictureBox1;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public ImageEditForm()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.SuspendLayout();
			// 
			// pictureBox1
			// 
			this.pictureBox1.BackColor = System.Drawing.Color.Green;
			this.pictureBox1.Location = new System.Drawing.Point(64, 48);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(176, 160);
			this.pictureBox1.TabIndex = 0;
			this.pictureBox1.TabStop = false;
			// 
			// ImageEditForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.Color.Green;
			this.ClientSize = new System.Drawing.Size(292, 266);
			this.Controls.Add(this.pictureBox1);
			this.Name = "ImageEditForm";
			this.Text = "ImageEditForm";
			this.Load += new System.EventHandler(this.ImageEditForm_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void ImageEditForm_Load(object sender, System.EventArgs e)
		{
			Size size=new Size(70,95);
			Bitmap img=new Bitmap(71,96);
			Graphics g=Graphics.FromImage(img);
			Pen pen=new Pen(Color.Black);

			Pen _pen=new Pen(Color.Black,0.1f);


			Point[] points=new Point[]{
											 new Point(0,2),

											 new Point(2,0),
											 new Point(size.Width-2,0),

											 new Point(size.Width,2),
											 new Point(size.Width,size.Height-2),

											 new Point(size.Width-2,size.Height),
											 new Point(2,size.Height),

											 new Point(0,size.Height-2),
											 new Point(0,2)
			};

			g.FillPolygon(new SolidBrush(Color.White),points);
			g.DrawPolygon(pen,points);

			Bitmap bmp=new Bitmap(@"E:\image\设计\扑克牌\xw.bmp");
			

			g.DrawImage(bmp,new Rectangle(2,2,size.Width-4,size.Height-4),2,2,size.Width-4,size.Height-4,GraphicsUnit.Pixel);
			pictureBox1.Image=img;


//			string path=@"E:\design\windows\c#\Game\CardGame\CardsResources.resx";
//			ResXResourceSet resx=new ResXResourceSet(path);
//			ResXResourceWriter reswriter=new ResXResourceWriter(path);
//
//			IDictionaryEnumerator idic=resx.GetEnumerator();
//			while(idic.MoveNext())
//			{
//				DictionaryEntry dic=idic.Entry;
//				reswriter.AddResource(dic.Key+"",(Image)dic.Value);
//			}
//			reswriter.AddResource("52",img);
//
//			resx.Close();
//			reswriter.Close();

			
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -