1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      c#編寫中國象棋棋盤的思想-創(chuàng)新互聯(lián)

       

      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Text;
      using System.Threading;
      using System.IO;
      using System.Windows.Forms;

      創(chuàng)新互聯(lián)基于成都重慶香港及美國等地區(qū)分布式IDC機(jī)房數(shù)據(jù)中心構(gòu)建的電信大帶寬,聯(lián)通大帶寬,移動(dòng)大帶寬,多線BGP大帶寬租用,是為眾多客戶提供專業(yè)服務(wù)器機(jī)柜租用報(bào)價(jià),主機(jī)托管價(jià)格性價(jià)比高,為金融證券行業(yè)服務(wù)器托管,ai人工智能服務(wù)器托管提供bgp線路100M獨(dú)享,G口帶寬及機(jī)柜租用的專業(yè)成都idc公司。

      namespace Chess
      {
         public partial class Form1 : Form
         {
             public Form1()
             {
                 InitializeComponent();
             }

             private const int _outterStartLeft = 25;//棋盤的外框距離panel的左邊距
             private const int _outterStartTop = 25;//棋盤的外框距離panel的上邊距
             private const int _distance = 6;//棋盤的內(nèi)框與外框的距離
             private const int _riverFontFromBorder = 40;//“楚河”或“漢界”距離邊框的長度
             private const int _locationLength = 10;//標(biāo)示“炮”“卒”位置的線長度
             private const int _locationFromBorder = 2;//標(biāo)示“炮”“卒”位置的線

             //畫筆
             Pen drawOutterRecPen = new Pen(Color.Black, 4);//棋盤外邊框用到的畫筆黑色4pt
             Pen drawInnerRecPen = new Pen(Color.Black, 2);//棋盤內(nèi)邊框用黑色2pt畫筆
             Pen drawBasicLine = new Pen(Color.Black, 1);//棋盤基線用黑色1pt畫筆
             Pen drawOutterR = new Pen(Color.Red,2);

             //字體
             Font drawRiverFont = new Font("幼圓", 25);

             private void panel1_Paint(object sender, PaintEventArgs e)
             {

                 Graphics gh = e.Graphics;//獲取繪制圖形對(duì)象
                 //畫棋盤邊框

                 int _chessBoardWidth = panel1.Width - 2 * _outterStartLeft - 2 * _distance;//棋盤的寬度
                 int _chessBoardHeight = panel1.Height - 2 * _outterStartTop - 2 * _distance;//棋盤的高度
                 //畫棋盤外邊框
                 gh.DrawRectangle(drawOutterRecPen, new Rectangle(new Point(_outterStartLeft, _outterStartTop), new Size(_chessBoardWidth + 2 * _distance, _chessBoardHeight + 2 * _distance)));
                 //畫棋盤內(nèi)邊框
                 gh.DrawRectangle(drawInnerRecPen, new Rectangle(new Point(_outterStartLeft + _distance, _outterStartTop + _distance), new Size(_chessBoardWidth, _chessBoardHeight)));

                 //畫棋盤

                 //畫棋盤線
                 int _xStart = _outterStartLeft + _distance;//線的起始x坐標(biāo)
                 int _yStart = _outterStartTop + _distance;//線的起始y坐標(biāo)
                 int gridWidth = (panel1.Width - 2 * _outterStartLeft - 2 * _distance) / 8;
                 int gridHeight = (panel1.Height - 2 * _outterStartTop - 2 * _distance) / 9;
                 //畫豎線(8列7條線)
                 for (int i = 1; i <= 7; i++)
                 {
                     //分開畫,避開“楚河漢界”一行的豎線
                     gh.DrawLine(drawBasicLine, new Point(_xStart + i * gridWidth, _yStart), new Point(_xStart + i * gridWidth, _yStart + 4 * gridHeight));
                     gh.DrawLine(drawBasicLine, new Point(_xStart + i * gridWidth, _yStart + 5 * gridHeight), new Point(_xStart + i * gridWidth, _yStart + _chessBoardHeight));
                 }
                 //畫橫線(9行8條線)
                 for (int i = 1; i <= 8; i++)
                 {
                     gh.DrawLine(drawBasicLine, new Point(_xStart, _yStart + i * gridHeight), new Point(_xStart + _chessBoardWidth, _yStart + i * gridHeight));
                 }
                 //畫“楚河漢界”
                 SizeF fRiver = gh.MeasureString("楚 河", drawRiverFont);
                 SizeF fBound = gh.MeasureString("漢 界", drawRiverFont);
                 gh.DrawString("楚 河", drawRiverFont, Brushes.Red, new PointF(_xStart + _chessBoardWidth - _riverFontFromBorder - fRiver.Width, _yStart + 4 * gridHeight + (float)(gridHeight - fRiver.Height) / 2));
                 gh.DrawString("漢 界", drawRiverFont, Brushes.Red, new PointF(_xStart + _riverFontFromBorder, _yStart + 4 * gridHeight + (float)(gridHeight - fBound.Height) / 2));
                 //gh.DrawString("楚 河", drawRiverFont, Brushes.Red, new PointF((_xStart + _chessBoardWidth)/2 - _riverFontFromBorder, _yStart + 4 * gridHeight + (float)(gridHeight - fRiver.Height) / 2));
                 //畫將/帥的皇宮
                 gh.DrawLine(drawBasicLine, new Point(_xStart + 3 * gridWidth, _yStart), new Point(_xStart + 5 * gridWidth, _yStart + 2 * gridHeight));
                 gh.DrawLine(drawBasicLine, new Point(_xStart + 3 * gridWidth, _yStart + 2 * gridHeight), new Point(_xStart + 5 * gridWidth, _yStart));

                 gh.DrawLine(drawBasicLine, new Point(_xStart + 3 * gridWidth, _yStart + 7 * gridHeight), new Point(_xStart + 5 * gridWidth, _yStart + _chessBoardHeight));
                 gh.DrawLine(drawBasicLine, new Point(_xStart + 3 * gridWidth, _yStart + _chessBoardHeight), new Point(_xStart + 5 * gridWidth, _yStart + 7 * gridHeight));
                 //畫“炮”的位置
                 for (int i = 0; i <= 1; i++)
                 {
                     for (int j = 0; j <= 1; j++)
                     {
                         gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + gridWidth - _locationLength - _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight - _locationFromBorder+i*5*gridHeight),
                             new Point(_xStart + gridWidth - _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight - _locationFromBorder+i*5*gridHeight),
                             new Point(_xStart + gridWidth - _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight - _locationLength - _locationFromBorder+i*5*gridHeight) });
                         gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + gridWidth - _locationLength - _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight + 2 * _locationFromBorder+i*5*gridHeight),
                             new Point(_xStart + gridWidth - _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight + 2 * _locationFromBorder+i*5*gridHeight),
                             new Point(_xStart + gridWidth - _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight + _locationLength + 2 * _locationFromBorder+i*5*gridHeight) });
                         gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + gridWidth + 2 * _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight + _locationLength + 2 * _locationFromBorder+i*5*gridHeight),
                             new Point(_xStart + gridWidth + 2 * _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight + 2 * _locationFromBorder+i*5*gridHeight),
                             new Point(_xStart + gridWidth + _locationLength + 2 * _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight + 2 * _locationFromBorder+i*5*gridHeight) });
                         gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + gridWidth + 2 * _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight - _locationLength - _locationFromBorder+i*5*gridHeight),
                             new Point(_xStart + gridWidth + 2 * _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight - _locationFromBorder+i*5*gridHeight),
                             new Point(_xStart + gridWidth + _locationLength + 2 * _locationFromBorder + j * 6 * gridWidth, _yStart + 2 * gridHeight - _locationFromBorder+i*5*gridHeight) });

                     }
                 }
                 //畫“卒”的位置
                 for (int i = 0; i <= 1; i++)
                 {
                     for (int j = 0; j <= 2; j++)
                     {
                         gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + 2*gridWidth - _locationLength - _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight - _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2*gridWidth - _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight - _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2*gridWidth - _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight - _locationLength - _locationFromBorder+i*3*gridHeight) });
                         gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + 2*gridWidth - _locationLength - _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight + 2 * _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2*gridWidth - _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight + 2 * _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2*gridWidth - _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight + _locationLength + 2 * _locationFromBorder+i*3*gridHeight) });
                         gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + 2*gridWidth + 2 * _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight + _locationLength + 2 * _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2*gridWidth + 2 * _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight + 2 * _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2*gridWidth + _locationLength + 2 * _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight + 2 * _locationFromBorder+i*3*gridHeight) });
                         gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + 2*gridWidth + 2 * _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight - _locationLength - _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2*gridWidth + 2 * _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight - _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2*gridWidth + _locationLength + 2 * _locationFromBorder + j *2 * gridWidth, _yStart + 3 * gridHeight - _locationFromBorder+i*3*gridHeight) });

                     }
                 }
                 for (int i = 0; i <= 1; i++)
                 {
                     gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + 2 * _locationFromBorder, _yStart + 3 * gridHeight + _locationLength + 2 * _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2 * _locationFromBorder, _yStart + 3 * gridHeight + 2 * _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + _locationLength + 2 * _locationFromBorder, _yStart + 3 * gridHeight + 2 * _locationFromBorder+i*3*gridHeight) });
                     gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + 2 * _locationFromBorder, _yStart + 3 * gridHeight - _locationLength - _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + 2 * _locationFromBorder, _yStart + 3 * gridHeight - _locationFromBorder+i*3*gridHeight),
                             new Point(_xStart + _locationLength + 2 * _locationFromBorder, _yStart + 3 * gridHeight - _locationFromBorder+i*3*gridHeight) });
                 }
                 for (int j = 0; j <= 1; j++)
                 {
                     gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + _chessBoardWidth - _locationLength - 2*_locationFromBorder, _yStart + 3 * gridHeight - _locationFromBorder+j*3*gridHeight),
                             new Point(_xStart + _chessBoardWidth - 2*_locationFromBorder , _yStart + 3 * gridHeight - _locationFromBorder+j*3*gridHeight),
                             new Point(_xStart + _chessBoardWidth - 2*_locationFromBorder, _yStart + 3 * gridHeight - _locationLength - _locationFromBorder+j*3*gridHeight) });
                     gh.DrawLines(drawInnerRecPen, new Point[] {
                             new Point(_xStart + _chessBoardWidth - _locationLength - 2*_locationFromBorder , _yStart + 3 * gridHeight + 2 * _locationFromBorder+j*3*gridHeight),
                             new Point(_xStart + _chessBoardWidth - 2*_locationFromBorder, _yStart + 3 * gridHeight + 2 * _locationFromBorder+j*3*gridHeight),
                             new Point(_xStart + _chessBoardWidth - 2*_locationFromBorder, _yStart + 3 * gridHeight + _locationLength + 2 * _locationFromBorder+j*3*gridHeight) });
                 }

                 gh.Flush();
             }

             private void Form1_Load(object sender, EventArgs e)
             {

                 panel1.Size = new System.Drawing.Size(462, 512);
                 panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(205)))), ((int)(((byte)(170)))));

                 for (int i = 0; i <= 2; i++)
                 {
                     for (int j = 0; j < 8; j++)
                     {
                         //gh.DrawEllipse(drawOutterR,);
                     }
                 }
             }

         }
      }

      另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。


      網(wǎng)站題目:c#編寫中國象棋棋盤的思想-創(chuàng)新互聯(lián)
      網(wǎng)頁URL:http://www.ef60e0e.cn/article/gedco.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        花垣县| 万州区| 梅河口市| 无极县| 谷城县| 博乐市| 临漳县| 龙游县| 澄迈县| 资源县| 澜沧| 友谊县| 乌苏市| 封开县| 神木县| 遂宁市| 陆丰市| 金沙县| 色达县| 鱼台县| 五大连池市| 澎湖县| 唐河县| 河东区| 响水县| 克什克腾旗| 抚州市| 涟源市| 昌江| 甘德县| 洪洞县| 山阴县| 白水县| 隆子县| 阳山县| 元朗区| 凉城县| 枣阳市| 汪清县| 连南| 定西市|