الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ما المشكلة بهذا الكود ؟؟؟

بدأه Petro في 20 أكتوبر 2008 · 2 رد · 422 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

كود عبارة عن node class

و يتم عمل array of objects

و هذة الـ Array عبارة عن Multidimensional array

عند calling node methods فانها لا تعمل

اريد ان اعرف ما المشكلة

وشكرا

SnakeAndLadders.zip

#2

أرجو ألا تقوم بوضع الكود بهذا الشكل

يوجد خاصية فى الرد تسمى إدراج كود سوف تسهل الامر أكثر من الوضع الحالى

أرجو أن تستخدمها

لا إله إلا الله محمد رسول الله

アッラー以外に神はなし。ムハンマドはアッラーの使徒である

#3

شكرا على الرد

واليكم الكود

node class:

using System;

namespace SnakeAndLadders
{
	/// <summary>
	/// 
	/// </summary>
	public class node
	{
		public int x;
		public int y;

		public node()
		{



		}
		public void setxy ( int xx,int yy)
		{
			x = xx;
			y = yy;
		}

		public int getx()
		{
			return x;
		}

		public int gety()
		{
			return y;
		}
	}
}

Form1 class:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace SnakeAndLadders
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.PictureBox pictureBox2;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		node[,] Node1 = new node[8,8];

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <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(Form1));
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.pictureBox2 = new System.Windows.Forms.PictureBox();
			this.SuspendLayout();
			// 
			// pictureBox1
			// 
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(8, 8);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(312, 296);
			this.pictureBox1.TabIndex = 0;
			this.pictureBox1.TabStop = false;
			this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
			// 
			// pictureBox2
			// 
			this.pictureBox2.Location = new System.Drawing.Point(24, 244);
			this.pictureBox2.Name = "pictureBox2";
			this.pictureBox2.Size = new System.Drawing.Size(34, 31);
			this.pictureBox2.TabIndex = 1;
			this.pictureBox2.TabStop = false;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(336, 334);
			this.Controls.Add(this.pictureBox2);
			this.Controls.Add(this.pictureBox1);
			this.Name = "Form1";
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void allocationingNodes()
		{



			for (int i = 1;i< 8;i ++)
			{
			   Node1[1,i].x = pictureBox2.Left * i;
			   Node1[1,i].y = pictureBox2.Top;

			}


		}
		private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			Graphics gx = this.CreateGraphics();

		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
		 allocationingNodes();
		 pictureBox2.Left = Node1[1,2].x;
		}
	}
}

مواضيع مشابهة