public void ran(Button emply, Button full, LoadSize getsize) { _size = getsize; int s = _size.getSize() * _size.getSize(); if (emply == full) { return; } else if (_MovePlay.UP(emply, full, _size) == true) { mang(full); } else if (_MovePlay.DOWN(emply, full, _size) == true) { mang(full); } else if (_MovePlay.LEFT(emply, full, _size) == true) { mang(full); } else if (_MovePlay.RIGHT(emply, full, _size) == true) { mang(full); } }
public bool LEFT(Button Emply, Button full, LoadSize getsize) { _size = getsize; emplyX = Emply.Location.X; emplyY = Emply.Location.Y; X = full.Location.X; Y = full.Location.Y; tabFull = full.TabIndex; tabEmply = Emply.TabIndex; if (tabFull == (tabEmply - 1) || tabFull == (tabEmply - _size.getSize()) || tabFull == (tabEmply + 1) || tabFull == (tabEmply + _size.getSize())) { if (emplyY == Y && emplyX == (X + 360 / _size.getSize())) { //swap(Emply, full); return(true); } else { return(false); } } return(false); }
public void Createbutton(LoadSize getsize) { _Loadsize = getsize; m_ButtonList.Clear(); int top = 0; int count = 0; for (int i = 0; i < _Loadsize.getSize(); i++) { int left = 0; for (int j = 0; j < _Loadsize.getSize(); j++) { Button btn = new Button(); btn.Name = string.Format(count.ToString(), i, j); btn.Size = new Size(360 / _Loadsize.getSize(), 360 / _Loadsize.getSize()); btn.TabIndex = count; btn.Text = count.ToString(); btn.TextAlign = ContentAlignment.TopLeft; btn.Top = top; btn.Left = left; left += 360 / _Loadsize.getSize(); count++; m_ButtonList.Add(btn); } top += 360 / _Loadsize.getSize(); } }
public void cropImageTomages(int w, int h, LoadSize getsize) { _Size = getsize; m_ImageList.Clear(); Bitmap bmp = new Bitmap(w, h); Graphics gra = Graphics.FromImage(bmp); gra.DrawImage(m_Image, 0, 0, w, h); gra.Dispose(); int movr = 0, movd = 0; for (int k = 0; k < _Size.getSize() * _Size.getSize(); k++) { Bitmap img = new Bitmap(w / _Size.getSize(), h / _Size.getSize()); for (int i = 0; i < w / _Size.getSize(); i++) { for (int j = 0; j < h / _Size.getSize(); j++) { img.SetPixel(i, j, bmp.GetPixel(i + movr, j + movd)); } } m_ImageList.Add(img); movr += w / _Size.getSize(); if (movr == w) { movr = 0; movd += h / _Size.getSize(); } } }