Advertisement
j4ggi

peg solitaire

Aug 6th, 2015
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 39.88 KB | None | 0 0
  1. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. ///FORM1.CS
  3. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  4.  
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Windows.Forms;
  14.  
  15. namespace PegSolitaire
  16. {
  17.     public partial class Form1 : Form
  18.     {
  19.         static bool clicked = false;
  20.         static Point click1, click2;
  21.         static State firstClick;
  22.         public static Image empty_img, occupied_img, temp_img;
  23.         public static Color empty_col = Color.Black, occupied_col = Color.BlueViolet, temp_col = Color.DarkGray, backcolor = Color.DodgerBlue;
  24.         public static bool picBack = false;
  25.         string moves = "";
  26.         public Form1()
  27.         {
  28.             InitializeComponent();
  29.             if (planszaToolStripMenuItem.Checked)
  30.             {
  31.                 try
  32.                 {
  33.                     empty_img = new Bitmap("empty.png");
  34.                     occupied_img = new Bitmap("occupied.png");
  35.                     temp_img = new Bitmap("temp.png");
  36.                 }
  37.                 catch (ArgumentException e)
  38.                 {
  39.                     MessageBox.Show("Nie znaleziono plików! \nWskaż katalog z plikami: \"occupied.png\", \"empty.png\" oraz \"temp.png\".");
  40.                     FolderBrowserDialog dir = new FolderBrowserDialog();
  41.                     dir.ShowDialog();
  42.                     string cat = dir.SelectedPath;
  43.                     try
  44.                     {
  45.                         empty_img = new Bitmap(cat + "/empty.png");
  46.                         occupied_img = new Bitmap(cat + "/occupied.png");
  47.                         temp_img = new Bitmap(cat + "/temp.png");
  48.                         planszaToolStripMenuItem.Checked = true;
  49.                     }
  50.                     catch (ArgumentException e1)
  51.                     {
  52.                         MessageBox.Show("Błąd!");
  53.                         empty_img = null;
  54.                         occupied_img = null;
  55.                         temp_img = null;
  56.                     }
  57.                 }
  58.             }
  59.             else
  60.             {
  61.                 empty_img = null;
  62.                 occupied_img = null;
  63.                 temp_img = null;
  64.             }
  65.             this.BackColor = backcolor;
  66.             board(7, 7);
  67.             plikToolStripMenuItem_Click(new object(), new EventArgs());
  68.         }
  69.         public void button5_Click(object sender, EventArgs e)
  70.         {
  71.             this.BackColor = backcolor;
  72.             redraw();
  73.         }
  74.  
  75.         private void board(int x, int y)
  76.         {
  77.             cofnijToolStripMenuItem.Enabled = false;
  78.             tableLayoutPanel1.Location = new System.Drawing.Point(12, 27);
  79.             tableLayoutPanel1.RowCount = x;
  80.             tableLayoutPanel1.ColumnCount = y;
  81.             tableLayoutPanel1.Size = new System.Drawing.Size(550, 550);
  82.             for (int i = 0; i < x; i++)
  83.                 tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  84.             for (int i = 0; i < y; i++)
  85.                 tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  86.  
  87.             for (int i = 0; i < x; i++)
  88.             {
  89.                 for (int j = 0; j < y; j++)
  90.                 {
  91.                     if ((i == 0 || i == 1 || i == 5 || i == 6) && (j == 0 || j == 1 || j == 5 || j == 6))
  92.                     {
  93.                         State status = new State(State.state.Unavaliable, new Size((int)(tableLayoutPanel1.GetColumnWidths()[0] * 0.9), (int)(tableLayoutPanel1.GetRowHeights()[0] * 0.9)));
  94.                         tableLayoutPanel1.Controls.Add(status, i, j);
  95.                         continue;
  96.                     }
  97.                     else
  98.                     {
  99.                         State status = new State(State.state.Occupied, new Size((int)(tableLayoutPanel1.GetColumnWidths()[0] * 0.9), (int)(tableLayoutPanel1.GetRowHeights()[0] * 0.9)));
  100.                         status.AddClickHandler(field_Click);
  101.                         tableLayoutPanel1.Controls.Add(status, i, j);
  102.                     }
  103.                 }
  104.             }
  105.         }
  106.         public void field_Click(object sender, EventArgs e)
  107.         {
  108.             PictureBox tmp = (PictureBox)sender;
  109.             State temp = (State)tmp.Parent;
  110.             if (!clicked)
  111.             {
  112.                 if (temp.GetState() == State.state.Empty) return;
  113.                 firstClick = temp;
  114.                 temp.SetState(State.state.Temp);
  115.                 click1 = new Point(tableLayoutPanel1.GetPositionFromControl(temp).Column, tableLayoutPanel1.GetPositionFromControl(temp).Row);
  116.                 clicked = true;
  117.             }
  118.             else
  119.             {
  120.                 click2 = new Point(tableLayoutPanel1.GetPositionFromControl(temp).Column, tableLayoutPanel1.GetPositionFromControl(temp).Row);
  121.                 if (ruch(click1, click2, tableLayoutPanel1))
  122.                 {
  123.                     clicked = false;
  124.                     if (sprawdz() > 0)
  125.                     {
  126.                         MessageBox.Show("Gratulacje!");
  127.                         cofnijToolStripMenuItem.Enabled = false;
  128.                         for (int i = 0; i < tableLayoutPanel1.ColumnCount; i++)
  129.                             for (int j = 0; j < tableLayoutPanel1.RowCount; j++)
  130.                             {
  131.                                 State temp1 = (State)tableLayoutPanel1.GetControlFromPosition(i, j);
  132.                                 temp1.RemoveHandler(field_Click);
  133.                             }
  134.  
  135.                     }
  136.                     else if (sprawdz() < 0)
  137.                     {
  138.                         MessageBox.Show(":(\n Spróbuj jeszcze raz");
  139.                         cofnijToolStripMenuItem.Enabled = false;
  140.                         for (int i = 0; i < tableLayoutPanel1.ColumnCount; i++)
  141.                             for (int j = 0; j < tableLayoutPanel1.RowCount; j++)
  142.                             {
  143.                                 State temp1 = (State)tableLayoutPanel1.GetControlFromPosition(i, j);
  144.                                 temp1.RemoveHandler(field_Click);
  145.                             }
  146.                     }
  147.                 }
  148.                 else
  149.                 {
  150.                     clicked = false;
  151.                     firstClick.SetState(State.state.Occupied);
  152.                 }
  153.             }
  154.         }
  155.         int sprawdz()
  156.         {
  157.             int pawn = 0;
  158.             bool pawn_alone = true;
  159.             for (int i = 0; i < tableLayoutPanel1.ColumnCount; i++)
  160.                 for (int j = 0; j < tableLayoutPanel1.RowCount; j++)
  161.                 {
  162.                     State field = (State)tableLayoutPanel1.GetControlFromPosition(i, j);
  163.                     if (field.GetState() == State.state.Occupied)
  164.                         pawn++;
  165.                 }
  166.             if (pawn == 1)
  167.                 return 1;
  168.             if (pawn > 1)
  169.             {
  170.                 for (int i = 0; i < tableLayoutPanel1.ColumnCount; i++)
  171.                     for (int j = 0; j < tableLayoutPanel1.RowCount; j++)
  172.                     {
  173.                         State field = (State)tableLayoutPanel1.GetControlFromPosition(i, j);
  174.                         if (field.GetState() == State.state.Occupied)
  175.                         {
  176.                             try
  177.                             {
  178.                                 State field1 = (State)tableLayoutPanel1.GetControlFromPosition(i + 1, j);
  179.                                 if (field1.GetState() != State.state.Occupied) ;
  180.                                 else pawn_alone = false;
  181.                             }
  182.                             catch (ArgumentException e) { }
  183.                             catch (NullReferenceException e1) { }
  184.                             try
  185.                             {
  186.                                 State field2 = (State)tableLayoutPanel1.GetControlFromPosition(i - 1, j);
  187.                                 if (field2.GetState() != State.state.Occupied) ;
  188.                                 else pawn_alone = false;
  189.                             }
  190.                             catch (ArgumentException e) { }
  191.                             catch (NullReferenceException e1) { }
  192.                             try
  193.                             {
  194.                                 State field3 = (State)tableLayoutPanel1.GetControlFromPosition(i, j - 1);
  195.                                 if (field3.GetState() != State.state.Occupied) ;
  196.                                 else pawn_alone = false;
  197.                             }
  198.                             catch (ArgumentException e) { }
  199.                             catch (NullReferenceException e1) { }
  200.                             try
  201.                             {
  202.                                 State field4 = (State)tableLayoutPanel1.GetControlFromPosition(i, j + 1);
  203.                                 if (field4.GetState() != State.state.Occupied) ;
  204.                                 else pawn_alone = false;
  205.                             }
  206.                             catch (ArgumentException e) { }
  207.                             catch (NullReferenceException e1) { }
  208.                         }
  209.                     }
  210.                 if (pawn_alone) return -1;
  211.                 else return 0;
  212.             }
  213.             return 0;
  214.         }
  215.         bool ruch(Point p1, Point p2, TableLayoutPanel table1)
  216.         {
  217.             int a = p1.X, b = p1.Y, c = p2.X, d = p2.Y;
  218.             State temp1 = (State)tableLayoutPanel1.GetControlFromPosition(a, b);
  219.             State temp2 = (State)tableLayoutPanel1.GetControlFromPosition(c, d);
  220.             State temp3 = (State)tableLayoutPanel1.GetControlFromPosition((a + c) / 2, b);
  221.             State temp4 = (State)tableLayoutPanel1.GetControlFromPosition(a, (b + d) / 2);
  222.             if (temp2.GetState() != State.state.Empty || temp1.GetState() != State.state.Temp) return false;
  223.             if (a == c && Math.Abs(b - d) == 2)
  224.             {
  225.                 if (temp4.GetState() == State.state.Empty) return false;
  226.                 temp4.SetState(State.state.Empty);
  227.                 temp1.SetState(State.state.Empty);
  228.                 temp2.SetState(State.state.Occupied);
  229.                 if (cofnijToolStripMenuItem.Enabled == false)
  230.                     cofnijToolStripMenuItem.Enabled = true;
  231.                 moves += a.ToString() + b.ToString() + c.ToString() + d.ToString();
  232.                 return true;
  233.             }
  234.             else if (b == d && Math.Abs(a - c) == 2)
  235.             {
  236.                 if (temp3.GetState() == State.state.Empty) return false;
  237.                 temp3.SetState(State.state.Empty);
  238.                 temp1.SetState(State.state.Empty);
  239.                 temp2.SetState(State.state.Occupied);
  240.                 if (cofnijToolStripMenuItem.Enabled == false)
  241.                     cofnijToolStripMenuItem.Enabled = true;
  242.                 moves += a.ToString() + b.ToString() + c.ToString() + d.ToString();
  243.                 return true;
  244.             }
  245.             else return false;
  246.         }
  247.  
  248.         private void plikToolStripMenuItem_Click(object sender, EventArgs e)
  249.         {
  250.             clicked = false;
  251.             tableLayoutPanel1.Dispose();
  252.             tableLayoutPanel1 = new TableLayoutPanel();
  253.             this.Controls.Add(tableLayoutPanel1);
  254.             board(7, 7);
  255.             State temp = (State)tableLayoutPanel1.GetControlFromPosition(3, 3);
  256.             temp.SetState(State.state.Empty);
  257.         }
  258.  
  259.         private void timer1_Tick(object sender, EventArgs e)
  260.         {
  261.             //this.BackColor = colorDialog1.Color;
  262.         }
  263.  
  264.         private void planszaToolStripMenuItem_Click(object sender, EventArgs e)
  265.         {
  266.             if (planszaToolStripMenuItem.Checked)
  267.             {
  268.                 planszaToolStripMenuItem.Checked = false;
  269.                 empty_img = null;
  270.                 occupied_img = null;
  271.                 temp_img = null;
  272.                 redraw();
  273.             }
  274.             else
  275.             {
  276.                 try
  277.                 {
  278.                     empty_img = new Bitmap("empty.png");
  279.                     occupied_img = new Bitmap("occupied.png");
  280.                     temp_img = new Bitmap("temp.png");
  281.                     planszaToolStripMenuItem.Checked = true;
  282.                     redraw();
  283.                 }
  284.                 catch (ArgumentException e1)
  285.                 {
  286.                     MessageBox.Show("Nie znaleziono plików! \nWskaż katalog z plikami: \"occupied.png\", \"empty.png\" oraz \"temp.png\".");
  287.                     FolderBrowserDialog dir = new FolderBrowserDialog();
  288.                     dir.ShowDialog();
  289.                     string cat = dir.SelectedPath;
  290.                     try
  291.                     {
  292.                         empty_img = new Bitmap(cat + "/empty.png");
  293.                         occupied_img = new Bitmap(cat + "/occupied.png");
  294.                         temp_img = new Bitmap(cat + "/temp.png");
  295.                         planszaToolStripMenuItem.Checked = true;
  296.                         redraw();
  297.                     }
  298.                     catch (ArgumentException)
  299.                     {
  300.                         MessageBox.Show("Błąd!");
  301.                         empty_img = null;
  302.                         occupied_img = null;
  303.                         temp_img = null;
  304.                     }
  305.                 }
  306.             }
  307.         }
  308.         void redraw()
  309.         {
  310.             this.BackColor = backcolor;
  311.             for (int i = 0; i < tableLayoutPanel1.ColumnCount; i++)
  312.             {
  313.                 for (int j = 0; j < tableLayoutPanel1.RowCount; j++)
  314.                 {
  315.                     if ((i == 0 || i == 1 || i == 5 || i == 6) && (j == 0 || j == 1 || j == 5 || j == 6))
  316.                     {
  317.                         State status1 = (State)tableLayoutPanel1.GetControlFromPosition(i, j);
  318.                         status1.SetState(status1.GetState());
  319.                         continue;
  320.                     }
  321.                     else
  322.                     {
  323.                         State status = (State)tableLayoutPanel1.GetControlFromPosition(i, j);
  324.                         status.SetState(status.GetState());
  325.                     }
  326.                 }
  327.             }
  328.         }
  329.  
  330.         private void KoloryToolStripMenuItem_Click(object sender, EventArgs e)
  331.         {
  332.             Form2 kolor = new Form2(this);
  333.             kolor.Show();
  334.         }
  335.  
  336.         private void cofnijToolStripMenuItem_Click(object sender, EventArgs e)
  337.         {
  338.             string move = moves.Substring(moves.Length - 4);
  339.             State f1 = (State)tableLayoutPanel1.GetControlFromPosition(int.Parse(move[0].ToString()), int.Parse(move[1].ToString()));
  340.             f1.SetState(State.state.Occupied);
  341.  
  342.             State f2 = (State)tableLayoutPanel1.GetControlFromPosition(int.Parse(move[2].ToString()), int.Parse(move[3].ToString()));
  343.             f2.SetState(State.state.Empty);
  344.  
  345.             if (move[0] == move[2])
  346.             {
  347.                 State f3 = (State)tableLayoutPanel1.GetControlFromPosition(int.Parse(move[2].ToString()), ( int.Parse(move[3].ToString()) + int.Parse(move[1].ToString()) )/2 );
  348.                 f3.SetState(State.state.Occupied);
  349.             }
  350.             else
  351.             {
  352.                 State f3 = (State)tableLayoutPanel1.GetControlFromPosition( ((int.Parse(move[0].ToString()) + int.Parse(move[2].ToString())) / 2), int.Parse(move[3].ToString()));
  353.                 f3.SetState(State.state.Occupied);
  354.             }
  355.             moves = moves.Remove(moves.Length - 4);
  356.             if (moves.Length == 0) cofnijToolStripMenuItem.Enabled = false;
  357.         }
  358.     }
  359.     class State : Control
  360.     {
  361.         private state status;
  362.         private PictureBox picture;
  363.         public State(state s, Size size)
  364.         {
  365.             this.Size = size;
  366.             status = s;
  367.             picture = new PictureBox();
  368.             picture.SizeMode = PictureBoxSizeMode.StretchImage;
  369.             picture.Size = size;
  370.             picture.Parent = this;
  371.             SetState(s);
  372.         }
  373.         public enum state { Unavaliable = 0, Empty = 1, Occupied = 2, Temp = 3 }
  374.         public void SetState(state s)
  375.         {
  376.             status = s;
  377.             if (s == state.Unavaliable)
  378.                 picture.Image = null;
  379.             else if (s == state.Occupied)
  380.             {
  381.                 picture.Image = Form1.occupied_img;
  382.                 if (picture.Image == null)
  383.                     picture.BackColor = Form1.occupied_col;
  384.                 else if (Form1.picBack)
  385.                     picture.BackColor = Form1.occupied_col;
  386.                 else picture.BackColor = Color.Transparent;
  387.             }
  388.             else if (s == state.Empty)
  389.             {
  390.                 picture.Image = Form1.empty_img;
  391.                 if (picture.Image == null)
  392.                     picture.BackColor = Form1.empty_col;
  393.                 else if (Form1.picBack)
  394.                     picture.BackColor = Form1.empty_col;
  395.                 else
  396.                     picture.BackColor = Color.Transparent;
  397.             }
  398.             else
  399.             {
  400.                 picture.Image = Form1.temp_img;
  401.                 if (picture.Image == null)
  402.                     picture.BackColor = Form1.temp_col;
  403.                 else if (Form1.picBack)
  404.                     picture.BackColor = Form1.temp_col;
  405.                 else picture.BackColor = Color.Transparent;
  406.             }
  407.         }
  408.         public state GetState()
  409.         {
  410.             return status;
  411.         }
  412.         public void AddClickHandler(EventHandler e)
  413.         {
  414.             picture.Click += e;
  415.         }
  416.  
  417.         public void RemoveHandler(EventHandler e)
  418.         {
  419.             picture.Click -= e;
  420.         }
  421.     }
  422. }
  423.  
  424.  
  425. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  426. ///FORM2.cs
  427. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  428.  
  429. using System;
  430. using System.Collections.Generic;
  431. using System.ComponentModel;
  432. using System.Data;
  433. using System.Drawing;
  434. using System.Linq;
  435. using System.Text;
  436. using System.Threading.Tasks;
  437. using System.Windows.Forms;
  438.  
  439. namespace PegSolitaire
  440. {
  441.     public partial class Form2 : Form
  442.     {
  443.         Form1 Parent1;
  444.         public Form2(Form1 parent)
  445.         {
  446.             InitializeComponent();
  447.             button1.BackColor = Form1.empty_col;
  448.             button2.BackColor = Form1.occupied_col;
  449.             button3.BackColor = Form1.temp_col;
  450.             button4.BackColor = Form1.backcolor;
  451.             colorDialog1.Color = button1.BackColor;
  452.             colorDialog2.Color = button2.BackColor;
  453.             colorDialog3.Color = button3.BackColor;
  454.             colorDialog4.Color = button4.BackColor;
  455.             Parent1 = parent;
  456.         }
  457.  
  458.         private void button5_Click(object sender, EventArgs e)
  459.         {
  460.             Form1 p = (Form1)Parent1;
  461.             p.button5_Click(sender, e);
  462.         }
  463.  
  464.         private void checkBox1_CheckedChanged(object sender, EventArgs e)
  465.         {
  466.             if (checkBox1.Checked)
  467.                 Form1.picBack = true;
  468.             else Form1.picBack = false;
  469.         }
  470.  
  471.         private void button1_Click(object sender, EventArgs e)
  472.         {
  473.             colorDialog1.ShowDialog();
  474.             button1.BackColor = colorDialog1.Color;
  475.             Form1.empty_col = colorDialog1.Color;
  476.         }
  477.  
  478.         private void button2_Click(object sender, EventArgs e)
  479.         {
  480.             colorDialog2.ShowDialog();
  481.             button2.BackColor = colorDialog2.Color;
  482.             Form1.occupied_col = colorDialog2.Color;
  483.         }
  484.  
  485.         private void button3_Click(object sender, EventArgs e)
  486.         {
  487.             colorDialog3.ShowDialog();
  488.             button3.BackColor = colorDialog3.Color;
  489.             Form1.temp_col = colorDialog3.Color;
  490.         }
  491.  
  492.         private void button4_Click(object sender, EventArgs e)
  493.         {
  494.             colorDialog4.ShowDialog();
  495.             button4.BackColor = colorDialog4.Color;
  496.             Form1.backcolor = colorDialog4.Color;
  497.         }
  498.  
  499.         private void button5_Click_1(object sender, EventArgs e)
  500.         {
  501.             this.Close();
  502.         }
  503.  
  504.         private void button7_Click(object sender, EventArgs e)
  505.         {
  506.             Form1.empty_col = Color.Black;
  507.             Form1.occupied_col = Color.BlueViolet;
  508.             Form1.temp_col = Color.DarkGray;
  509.             Form1.backcolor = Color.DodgerBlue;
  510.             button1.BackColor = Form1.empty_col;
  511.             button2.BackColor = Form1.occupied_col;
  512.             button3.BackColor = Form1.temp_col;
  513.             button4.BackColor = Form1.backcolor;
  514.             colorDialog1.Color = button1.BackColor;
  515.             colorDialog2.Color = button2.BackColor;
  516.             colorDialog3.Color = button3.BackColor;
  517.             colorDialog4.Color = button4.BackColor;
  518.         }
  519.     }
  520. }
  521.  
  522. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  523. ///Form1.Designer.cs
  524. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  525. namespace PegSolitaire
  526. {
  527.     partial class Form1
  528.     {
  529.         /// <summary>
  530.         /// Required designer variable.
  531.         /// </summary>
  532.         private System.ComponentModel.IContainer components = null;
  533.  
  534.         /// <summary>
  535.         /// Clean up any resources being used.
  536.         /// </summary>
  537.         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  538.         protected override void Dispose(bool disposing)
  539.         {
  540.             if (disposing && (components != null))
  541.             {
  542.                 components.Dispose();
  543.             }
  544.             base.Dispose(disposing);
  545.         }
  546.  
  547.         #region Windows Form Designer generated code
  548.  
  549.         /// <summary>
  550.         /// Required method for Designer support - do not modify
  551.         /// the contents of this method with the code editor.
  552.         /// </summary>
  553.         private void InitializeComponent()
  554.         {
  555.             this.menuStrip1 = new System.Windows.Forms.MenuStrip();
  556.             this.plikToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
  557.             this.ustawieniaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
  558.             this.KoloryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
  559.             this.planszaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
  560.             this.cofnijToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
  561.             this.pictureBox1 = new System.Windows.Forms.PictureBox();
  562.             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
  563.             this.menuStrip1.SuspendLayout();
  564.             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
  565.             this.tableLayoutPanel1.SuspendLayout();
  566.             this.SuspendLayout();
  567.             //
  568.             // menuStrip1
  569.             //
  570.             this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
  571.             this.plikToolStripMenuItem,
  572.             this.ustawieniaToolStripMenuItem,
  573.             this.cofnijToolStripMenuItem});
  574.             this.menuStrip1.Location = new System.Drawing.Point(0, 0);
  575.             this.menuStrip1.Name = "menuStrip1";
  576.             this.menuStrip1.Size = new System.Drawing.Size(709, 24);
  577.             this.menuStrip1.TabIndex = 1;
  578.             this.menuStrip1.Text = "menuStrip1";
  579.             //
  580.             // plikToolStripMenuItem
  581.             //
  582.             this.plikToolStripMenuItem.Name = "plikToolStripMenuItem";
  583.             this.plikToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
  584.             this.plikToolStripMenuItem.Size = new System.Drawing.Size(70, 20);
  585.             this.plikToolStripMenuItem.Text = "&Nowa gra";
  586.             this.plikToolStripMenuItem.Click += new System.EventHandler(this.plikToolStripMenuItem_Click);
  587.             //
  588.             // ustawieniaToolStripMenuItem
  589.             //
  590.             this.ustawieniaToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
  591.             this.KoloryToolStripMenuItem,
  592.             this.planszaToolStripMenuItem});
  593.             this.ustawieniaToolStripMenuItem.Name = "ustawieniaToolStripMenuItem";
  594.             this.ustawieniaToolStripMenuItem.Size = new System.Drawing.Size(76, 20);
  595.             this.ustawieniaToolStripMenuItem.Text = "Ustawienia";
  596.             //
  597.             // KoloryToolStripMenuItem
  598.             //
  599.             this.KoloryToolStripMenuItem.Name = "KoloryToolStripMenuItem";
  600.             this.KoloryToolStripMenuItem.Size = new System.Drawing.Size(111, 22);
  601.             this.KoloryToolStripMenuItem.Text = "Kolory";
  602.             this.KoloryToolStripMenuItem.Click += new System.EventHandler(this.KoloryToolStripMenuItem_Click);
  603.             //
  604.             // planszaToolStripMenuItem
  605.             //
  606.             this.planszaToolStripMenuItem.Name = "planszaToolStripMenuItem";
  607.             this.planszaToolStripMenuItem.Size = new System.Drawing.Size(111, 22);
  608.             this.planszaToolStripMenuItem.Text = "Grafika";
  609.             this.planszaToolStripMenuItem.Click += new System.EventHandler(this.planszaToolStripMenuItem_Click);
  610.             //
  611.             // cofnijToolStripMenuItem
  612.             //
  613.             this.cofnijToolStripMenuItem.Enabled = false;
  614.             this.cofnijToolStripMenuItem.Name = "cofnijToolStripMenuItem";
  615.             this.cofnijToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
  616.             this.cofnijToolStripMenuItem.Size = new System.Drawing.Size(51, 20);
  617.             this.cofnijToolStripMenuItem.Text = "Cofnij";
  618.             this.cofnijToolStripMenuItem.Click += new System.EventHandler(this.cofnijToolStripMenuItem_Click);
  619.             //
  620.             // pictureBox1
  621.             //
  622.             this.pictureBox1.Location = new System.Drawing.Point(3, 3);
  623.             this.pictureBox1.Name = "pictureBox1";
  624.             this.pictureBox1.Size = new System.Drawing.Size(16, 12);
  625.             this.pictureBox1.TabIndex = 0;
  626.             this.pictureBox1.TabStop = false;
  627.             //
  628.             // tableLayoutPanel1
  629.             //
  630.             this.tableLayoutPanel1.ColumnCount = 7;
  631.             this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  632.             this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
  633.             this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
  634.             this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
  635.             this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
  636.             this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28572F));
  637.             this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  638.             this.tableLayoutPanel1.Controls.Add(this.pictureBox1, 0, 0);
  639.             this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 27);
  640.             this.tableLayoutPanel1.Name = "tableLayoutPanel1";
  641.             this.tableLayoutPanel1.RowCount = 7;
  642.             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  643.             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  644.             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  645.             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  646.             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  647.             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  648.             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
  649.             this.tableLayoutPanel1.Size = new System.Drawing.Size(161, 132);
  650.             this.tableLayoutPanel1.TabIndex = 2;
  651.             //
  652.             // Form1
  653.             //
  654.             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  655.             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  656.             this.AutoSize = true;
  657.             this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
  658.             this.ClientSize = new System.Drawing.Size(709, 637);
  659.             this.Controls.Add(this.tableLayoutPanel1);
  660.             this.Controls.Add(this.menuStrip1);
  661.             this.MainMenuStrip = this.menuStrip1;
  662.             this.Name = "Form1";
  663.             this.Text = "Form1";
  664.             this.menuStrip1.ResumeLayout(false);
  665.             this.menuStrip1.PerformLayout();
  666.             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
  667.             this.tableLayoutPanel1.ResumeLayout(false);
  668.             this.ResumeLayout(false);
  669.             this.PerformLayout();
  670.  
  671.         }
  672.  
  673.         #endregion
  674.  
  675.         private System.Windows.Forms.MenuStrip menuStrip1;
  676.         private System.Windows.Forms.ToolStripMenuItem plikToolStripMenuItem;
  677.         private System.Windows.Forms.ToolStripMenuItem ustawieniaToolStripMenuItem;
  678.         private System.Windows.Forms.ToolStripMenuItem KoloryToolStripMenuItem;
  679.         private System.Windows.Forms.ToolStripMenuItem planszaToolStripMenuItem;
  680.         private System.Windows.Forms.PictureBox pictureBox1;
  681.         public System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
  682.         private System.Windows.Forms.ToolStripMenuItem cofnijToolStripMenuItem;
  683.     }
  684. }
  685.  
  686. /////////////////////////////////////////////////////////////////////////////////////////
  687. ///Form2.Designer.cs
  688. /////////////////////////////////////////////////////////////////////////////////////////
  689. namespace PegSolitaire
  690. {
  691.     partial class Form2
  692.     {
  693.         /// <summary>
  694.         /// Required designer variable.
  695.         /// </summary>
  696.         private System.ComponentModel.IContainer components = null;
  697.  
  698.         /// <summary>
  699.         /// Clean up any resources being used.
  700.         /// </summary>
  701.         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  702.         protected override void Dispose(bool disposing)
  703.         {
  704.             if (disposing && (components != null))
  705.             {
  706.                 components.Dispose();
  707.             }
  708.             base.Dispose(disposing);
  709.         }
  710.  
  711.         #region Windows Form Designer generated code
  712.  
  713.         /// <summary>
  714.         /// Required method for Designer support - do not modify
  715.         /// the contents of this method with the code editor.
  716.         /// </summary>
  717.         private void InitializeComponent()
  718.         {
  719.             this.checkBox1 = new System.Windows.Forms.CheckBox();
  720.             this.label1 = new System.Windows.Forms.Label();
  721.             this.label2 = new System.Windows.Forms.Label();
  722.             this.label3 = new System.Windows.Forms.Label();
  723.             this.button1 = new System.Windows.Forms.Button();
  724.             this.button2 = new System.Windows.Forms.Button();
  725.             this.button3 = new System.Windows.Forms.Button();
  726.             this.label4 = new System.Windows.Forms.Label();
  727.             this.button4 = new System.Windows.Forms.Button();
  728.             this.button5 = new System.Windows.Forms.Button();
  729.             this.colorDialog1 = new System.Windows.Forms.ColorDialog();
  730.             this.colorDialog2 = new System.Windows.Forms.ColorDialog();
  731.             this.colorDialog3 = new System.Windows.Forms.ColorDialog();
  732.             this.colorDialog4 = new System.Windows.Forms.ColorDialog();
  733.             this.button6 = new System.Windows.Forms.Button();
  734.             this.button7 = new System.Windows.Forms.Button();
  735.             this.SuspendLayout();
  736.             //
  737.             // checkBox1
  738.             //
  739.             this.checkBox1.AutoSize = true;
  740.             this.checkBox1.Location = new System.Drawing.Point(29, 189);
  741.             this.checkBox1.Name = "checkBox1";
  742.             this.checkBox1.Size = new System.Drawing.Size(160, 17);
  743.             this.checkBox1.TabIndex = 0;
  744.             this.checkBox1.Text = "Kolory jako tło pod grafikami";
  745.             this.checkBox1.UseVisualStyleBackColor = true;
  746.             this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
  747.             //
  748.             // label1
  749.             //
  750.             this.label1.AutoSize = true;
  751.             this.label1.Location = new System.Drawing.Point(97, 33);
  752.             this.label1.Name = "label1";
  753.             this.label1.Size = new System.Drawing.Size(98, 13);
  754.             this.label1.TabIndex = 1;
  755.             this.label1.Text = "Kolor pustego pola:";
  756.             //
  757.             // label2
  758.             //
  759.             this.label2.AutoSize = true;
  760.             this.label2.Location = new System.Drawing.Point(95, 69);
  761.             this.label2.Name = "label2";
  762.             this.label2.Size = new System.Drawing.Size(100, 13);
  763.             this.label2.TabIndex = 1;
  764.             this.label2.Text = "Kolor zajętego pola:";
  765.             //
  766.             // label3
  767.             //
  768.             this.label3.AutoSize = true;
  769.             this.label3.Location = new System.Drawing.Point(26, 105);
  770.             this.label3.Name = "label3";
  771.             this.label3.Size = new System.Drawing.Size(169, 13);
  772.             this.label3.TabIndex = 1;
  773.             this.label3.Text = "Kolor pola z podniesionym pionem:";
  774.             //
  775.             // button1
  776.             //
  777.             this.button1.Location = new System.Drawing.Point(201, 28);
  778.             this.button1.Name = "button1";
  779.             this.button1.Size = new System.Drawing.Size(63, 23);
  780.             this.button1.TabIndex = 2;
  781.             this.button1.UseVisualStyleBackColor = true;
  782.             this.button1.Click += new System.EventHandler(this.button1_Click);
  783.             //
  784.             // button2
  785.             //
  786.             this.button2.Location = new System.Drawing.Point(201, 64);
  787.             this.button2.Name = "button2";
  788.             this.button2.Size = new System.Drawing.Size(63, 23);
  789.             this.button2.TabIndex = 2;
  790.             this.button2.UseVisualStyleBackColor = true;
  791.             this.button2.Click += new System.EventHandler(this.button2_Click);
  792.             //
  793.             // button3
  794.             //
  795.             this.button3.Location = new System.Drawing.Point(201, 100);
  796.             this.button3.Name = "button3";
  797.             this.button3.Size = new System.Drawing.Size(63, 23);
  798.             this.button3.TabIndex = 2;
  799.             this.button3.UseVisualStyleBackColor = true;
  800.             this.button3.Click += new System.EventHandler(this.button3_Click);
  801.             //
  802.             // label4
  803.             //
  804.             this.label4.AutoSize = true;
  805.             this.label4.Location = new System.Drawing.Point(145, 139);
  806.             this.label4.Name = "label4";
  807.             this.label4.Size = new System.Drawing.Size(50, 13);
  808.             this.label4.TabIndex = 1;
  809.             this.label4.Text = "Kolor tła:";
  810.             //
  811.             // button4
  812.             //
  813.             this.button4.Location = new System.Drawing.Point(201, 134);
  814.             this.button4.Name = "button4";
  815.             this.button4.Size = new System.Drawing.Size(63, 23);
  816.             this.button4.TabIndex = 2;
  817.             this.button4.UseVisualStyleBackColor = true;
  818.             this.button4.Click += new System.EventHandler(this.button4_Click);
  819.             //
  820.             // button5
  821.             //
  822.             this.button5.Location = new System.Drawing.Point(185, 298);
  823.             this.button5.Name = "button5";
  824.             this.button5.Size = new System.Drawing.Size(79, 31);
  825.             this.button5.TabIndex = 3;
  826.             this.button5.Text = "Zamknij";
  827.             this.button5.UseVisualStyleBackColor = true;
  828.             this.button5.Click += new System.EventHandler(this.button5_Click_1);
  829.             //
  830.             // colorDialog1
  831.             //
  832.             this.colorDialog1.AnyColor = true;
  833.             //
  834.             // colorDialog2
  835.             //
  836.             this.colorDialog2.AnyColor = true;
  837.             //
  838.             // colorDialog3
  839.             //
  840.             this.colorDialog3.AnyColor = true;
  841.             //
  842.             // colorDialog4
  843.             //
  844.             this.colorDialog4.AnyColor = true;
  845.             //
  846.             // button6
  847.             //
  848.             this.button6.Location = new System.Drawing.Point(29, 298);
  849.             this.button6.Name = "button6";
  850.             this.button6.Size = new System.Drawing.Size(79, 31);
  851.             this.button6.TabIndex = 3;
  852.             this.button6.Text = "Zastosuj";
  853.             this.button6.UseVisualStyleBackColor = true;
  854.             this.button6.Click += new System.EventHandler(this.button5_Click);
  855.             //
  856.             // button7
  857.             //
  858.             this.button7.Location = new System.Drawing.Point(185, 234);
  859.             this.button7.Name = "button7";
  860.             this.button7.Size = new System.Drawing.Size(79, 45);
  861.             this.button7.TabIndex = 3;
  862.             this.button7.Text = "Przywróć domyślne";
  863.             this.button7.UseVisualStyleBackColor = true;
  864.             this.button7.Click += new System.EventHandler(this.button7_Click);
  865.             //
  866.             // Form2
  867.             //
  868.             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  869.             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  870.             this.ClientSize = new System.Drawing.Size(276, 352);
  871.             this.Controls.Add(this.button6);
  872.             this.Controls.Add(this.button7);
  873.             this.Controls.Add(this.button5);
  874.             this.Controls.Add(this.button4);
  875.             this.Controls.Add(this.button3);
  876.             this.Controls.Add(this.button2);
  877.             this.Controls.Add(this.label4);
  878.             this.Controls.Add(this.button1);
  879.             this.Controls.Add(this.label3);
  880.             this.Controls.Add(this.label2);
  881.             this.Controls.Add(this.label1);
  882.             this.Controls.Add(this.checkBox1);
  883.             this.Name = "Form2";
  884.             this.Text = "Form2";
  885.             this.ResumeLayout(false);
  886.             this.PerformLayout();
  887.  
  888.         }
  889.  
  890.         #endregion
  891.  
  892.         private System.Windows.Forms.Label label1;
  893.         private System.Windows.Forms.Label label2;
  894.         private System.Windows.Forms.Label label3;
  895.         private System.Windows.Forms.Button button1;
  896.         private System.Windows.Forms.Button button2;
  897.         private System.Windows.Forms.Button button3;
  898.         private System.Windows.Forms.Label label4;
  899.         private System.Windows.Forms.Button button4;
  900.         private System.Windows.Forms.Button button5;
  901.         public System.Windows.Forms.CheckBox checkBox1;
  902.         private System.Windows.Forms.ColorDialog colorDialog1;
  903.         private System.Windows.Forms.ColorDialog colorDialog2;
  904.         private System.Windows.Forms.ColorDialog colorDialog3;
  905.         private System.Windows.Forms.ColorDialog colorDialog4;
  906.         private System.Windows.Forms.Button button6;
  907.         private System.Windows.Forms.Button button7;
  908.     }
  909. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement