예제 #1
0
파일: Board.cs 프로젝트: enesyteam/EChess
        public void AddLines()
        {
            for(int i=0; i<17; i++)
            {
                this.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
            }

            for (int i = 0; i < 20; i++)
            {
                this.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
            }

            //
            for (int iRow = 0; iRow < 20; iRow++)
            {
                for (int iCol = 0; iCol < 18; iCol++)
                {
                    BoardLines border = new BoardLines();
                    if (iRow == 0)
                    {
                    }
                    else if (iRow == 19)
                    {
                        if (iCol == 0 || iCol == 17)
                        {
                            border.BorderThickness = new Thickness(0);
                        }
                        else
                        {
                            border.BorderThickness = new Thickness(0, 0.5, 0, 0);
                        }
                    }
                    else if (iRow % 2 != 0)
                    {
                        if (iCol == 0)
                        {
                            border.BorderThickness = new Thickness(0, 0, 0, 0);
                        }
                        else if (iCol == 17)
                        {
                            border.BorderThickness = new Thickness(0.5, 0, 0, 0);
                        }
                        else
                        {
                            if (iCol % 2 == 0)
                            {

                                border.BorderThickness = new Thickness(0, 0.5, 0, 0);
                            }
                            else
                            {
                                border.BorderThickness = new Thickness(0.5, 0.5, 0, 0);
                            }

                        }
                    }
                    else
                    {
                        if (iCol % 2 != 0)
                        {
                            border.BorderThickness = new Thickness(0.5, 0, 0, 0);
                        }
                    }
                    border.Opacity = 0.65;
                    border.SetValue(Grid.ColumnProperty, iCol);
                    border.SetValue(Grid.RowProperty, iRow);
                    this.Children.Add(border);
                }
            }
        }
예제 #2
0
        public void AddLines()
        {
            for (int i = 0; i < 17; i++)
            {
                this.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }

            for (int i = 0; i < 20; i++)
            {
                this.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }

            //
            for (int iRow = 0; iRow < 20; iRow++)
            {
                for (int iCol = 0; iCol < 18; iCol++)
                {
                    BoardLines border = new BoardLines();
                    if (iRow == 0)
                    {
                    }
                    else if (iRow == 19)
                    {
                        if (iCol == 0 || iCol == 17)
                        {
                            border.BorderThickness = new Thickness(0);
                        }
                        else
                        {
                            border.BorderThickness = new Thickness(0, 0.5, 0, 0);
                        }
                    }
                    else if (iRow % 2 != 0)
                    {
                        if (iCol == 0)
                        {
                            border.BorderThickness = new Thickness(0, 0, 0, 0);
                        }
                        else if (iCol == 17)
                        {
                            border.BorderThickness = new Thickness(0.5, 0, 0, 0);
                        }
                        else
                        {
                            if (iCol % 2 == 0)
                            {
                                border.BorderThickness = new Thickness(0, 0.5, 0, 0);
                            }
                            else
                            {
                                border.BorderThickness = new Thickness(0.5, 0.5, 0, 0);
                            }
                        }
                    }
                    else
                    {
                        if (iCol % 2 != 0)
                        {
                            border.BorderThickness = new Thickness(0.5, 0, 0, 0);
                        }
                    }
                    border.Opacity = 0.65;
                    border.SetValue(Grid.ColumnProperty, iCol);
                    border.SetValue(Grid.RowProperty, iRow);
                    this.Children.Add(border);
                }
            }
        }