亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? squares.cs

?? winmobile圖形操作代碼
?? CS
字號:
// Squares.cs - Handles details of game squares for 
// JasperDots game.
//
// Code from _Programming the .NET Compact Framework with C#_
// and _Programming the .NET Compact Framework with VB_
// (c) Copyright 2002-2004 Paul Yao and David Durant. 
// All rights reserved.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace JaspersDots
{
   /// <summary>
   /// Summary description for Squares.
   /// </summary>
   public class Squares
   {
      public int Width
      {   
         get   { return cxWidth; }  
      }
      public int Height
      {
         get   { return cyHeight; }  
      }

      private int cxLeft = 15;
      private int cyTop  = 15;
      private int cxWidth;
      private int cyHeight;
      const int cxLine = 20;
      const int cyLine = 20;
      const int cxyDelta = 5;
      private Square [,] m_asq;

      private Control m_ctrlParent;
      private Brush m_brPlayer1;
      private Brush m_brPlayer2;
      private Brush m_brBackground = new
         SolidBrush(SystemColors.Window);
      private Brush hbrBlack = new SolidBrush(Color.Black);
      private Point ptTest = new Point(0,0);
      Rectangle rc = new Rectangle(0, 0, 0, 0);
      private Size  szDot = new Size(4,4);
      
      Pen penLine = new Pen(Color.Black);

      public Squares(Control ctrlParent)
      {
         m_ctrlParent = ctrlParent;
      } // Squares()

      public bool SetGridSize(
         int cxNewWidth,     // Width of array.
         int cyNewHeight     // Height of array.
         )
      {
         // Temporary scratch space.
         Rectangle rcTemp = new Rectangle(0,0,0,0);
         Point     ptTemp = new Point(0,0);
         Size      szTemp = new Size(0,0);

         // Set up array to track squares.
         cxWidth = cxNewWidth;
         cyHeight = cyNewHeight;
         m_asq = new Square[cxWidth, cyHeight];
         if (m_asq == null)
            return false;

         int x, y;
         for (x = 0; x < cxWidth; x++)
         {
            for (y = 0; y < cyHeight; y++)
            {
               m_asq[x,y].iOwner = 0; // No owner.
               int xLeft = cxLeft + x * cxLine;
               int yTop = cyTop + y * cyLine;
               int xRight = cxLeft + (x+1) * cxLine;
               int yBottom = cyTop + (y+1) * cyLine;
               int cxTopBottom = cxLine - (2 * cxyDelta);
               int cyTopBottom = cxyDelta * 2;
               int cxLeftRight = cxyDelta * 2;
               int cyLeftRight = cxLine - (2 * cxyDelta);

               // Main rectangle.
               ptTemp.X = xLeft + 1;
               ptTemp.Y = yTop + 1;
               szTemp.Width = xRight - xLeft - 1;
               szTemp.Height = yBottom - yTop - 1;
               rcTemp.Location = ptTemp;
               rcTemp.Size = szTemp;
               m_asq[x,y].rcMain = rcTemp;

               // Top hit rectangle.
               m_asq[x,y].rcTop =
                  new Rectangle(xLeft + cxyDelta, 
                  yTop - cxyDelta,
                  cxTopBottom,
                  cyTopBottom);
               m_asq[x,y].bTop = false;

               // Right hit rectangle.
               m_asq[x,y].rcRight =
                  new Rectangle(xRight - cxyDelta,
                  yTop + cxyDelta,
                  cxLeftRight,
                  cyLeftRight);
               m_asq[x,y].bRight = false;

               // Bottom hit rectangle.
               m_asq[x,y].rcBottom =
                  new Rectangle(xLeft + cxyDelta, 
                  yBottom - cxyDelta,
                  cxTopBottom,
                  cyTopBottom);
               m_asq[x,y].bBottom = false;

               // Left hit rectangle.
               m_asq[x,y].rcLeft =
                  new Rectangle(xLeft - cxyDelta,
                  yTop + cxyDelta,
                  cxLeftRight,
                  cyLeftRight);
               m_asq[x,y].bLeft = false;

            } // for y
         } // for x

         return true;
      }

      public bool 
      SetPlayerBrushes(
         Brush br1,      // Brush color for player 1.
         Brush br2       // Brush color for player 2.
         )
      {
         m_brPlayer1 = br1;
         m_brPlayer2 = br2;

         return true;
      }

      //--------------------------------------------------------
      public void
      FillOneSquare(Graphics g, int x, int y)
      {
         Brush brCurrent = m_brBackground;
         if (m_asq[x,y].iOwner == 1)
            brCurrent = m_brPlayer1;
         else if (m_asq[x,y].iOwner == 2)
            brCurrent = m_brPlayer2;
         g.FillRectangle(brCurrent, m_asq[x,y].rcMain);
      }

      // FillSquares -- Fill owned squares with a player's color
      //
      public void 
      FillSquares(Graphics g)
      {
         int x, y;
         for (x = 0; x < cxWidth; x++)
         {
            for (y = 0; y < cyHeight; y++)
            {
               if (m_asq[x,y].iOwner != 0)
               {
                  FillOneSquare(g, x, y);
               }
            }
         }
      } // FillSquares()

      //
      // DrawOneLine
      //
      public void DrawOneLineSet(Graphics g, int x, int y)
      {
         int xLeft = cxLeft + x * cxLine;
         int yTop = cyTop + y * cyLine;
         int xRight = cxLeft + (x+1) * cxLine;
         int yBottom = cyTop + (y+1) * cyLine;
               
         if (m_asq[x,y].bTop)
            g.DrawLine(penLine, xLeft, yTop, xRight, yTop);
         if (m_asq[x,y].bRight)
            g.DrawLine(penLine, xRight, yTop, xRight, yBottom);
         if (m_asq[x,y].bBottom)
            g.DrawLine(penLine, xRight, yBottom, xLeft, yBottom);
         if (m_asq[x,y].bLeft)
            g.DrawLine(penLine, xLeft, yBottom, xLeft, yTop);
      } // DrawOneLineSet()

      //
      // DrawLines -- Draw lines which have been hit.
      //
      public void DrawLines(Graphics g)
      {
         int x, y;
         for (x = 0; x < cxWidth; x++)
         {
            for (y = 0; y < cyHeight; y++)
            {
               DrawOneLineSet(g, x, y);
            }
         }
      } // DrawLines()

      public void DrawDots (Graphics g)
      {
         // Draw array of dots.
         int x, y;
         for (x = 0; x <= cxWidth; x++)
         {
            for (y = 0; y <= cyHeight; y++)
            {
               ptTest.X = (cxLeft - 2) + x * cxLine;
               ptTest.Y = (cyTop - 2) + y * cyLine;
               rc.Location = ptTest;
               rc.Size = szDot;
               g.FillEllipse(hbrBlack, rc);
            }
         }
      } // DrawDots

      public enum Side
      {
         None,
         Left,
         Top,
         Right,
         Bottom
      }

      //
      // HitTest - check whether a point hits a line.
      //
      // Return values:
      // 0 = miss
      // 1 = hit a line
      // 2 = hit and completed a square.
      public int HitTest(int xIn, int yIn, int iPlayer)
      {
         int x, y;
         bool bHit1 = false;
         bool bHit2 = false;
         Side sideHit = Side.None;
         for (x = 0; x < cxWidth; x++)
         {
            for (y = 0; y < cyHeight; y++)
            {
               // If already owned, do not check
               if (m_asq[x,y].iOwner != 0)
                  continue;

               // Otherwise check for lines against point.
               if (m_asq[x,y].rcTop.Contains(xIn, yIn))
               {
                  // Line already hit?
                  if (m_asq[x,y].bTop) // Line already hit?
                     return 0;
                  // If not, set line as hit.
                  sideHit = Side.Top;
                  m_asq[x,y].bTop = true;
               }
               else if (m_asq[x,y].rcLeft.Contains(xIn, yIn))
               {
                  // Line already hit?
                  if (m_asq[x,y].bLeft) // Line already hit?
                     return 0;
                  // If not, set line as hit.
                  sideHit = Side.Left;
                  m_asq[x,y].bLeft = true;
               }
               else if (m_asq[x,y].rcRight.Contains(xIn, yIn))
               {
                  // Line already hit?
                  if (m_asq[x,y].bRight) // Line already hit?
                     return 0;
                  // If not, set line as hit.
                  sideHit = Side.Right;
                  m_asq[x,y].bRight = true;
               }
               else if (m_asq[x,y].rcBottom.Contains(xIn, yIn))
               {
                  // Line already hit?
                  if (m_asq[x,y].bBottom) // Line already hit?
                     return 0;
                  // If not, set line as hit.
                  sideHit = Side.Bottom;
                  m_asq[x,y].bBottom = true;
               }
               
               // No hit in current square -- keep looking
               if (sideHit == Side.None)
                  continue;

               // We hit a side
               bHit1 = true;

               // Draw sides
               Graphics g = m_ctrlParent.CreateGraphics();
               DrawOneLineSet(g, x, y);

               // Check whether square is now complete.
               // We hit a line - check for hitting a square.
               if (m_asq[x,y].bLeft &&
                     m_asq[x,y].bTop &&
                     m_asq[x,y].bRight &&
                     m_asq[x,y].bBottom)
               {
                  // Side is complete.
                  m_asq[x,y].iOwner = iPlayer;
                  bHit2 = true;

                  // Fill current square
                  FillOneSquare(g, x, y);
               }
               
               g.Dispose();

            } // for y
         } // for x

         if (bHit2) return 2;
         else if (bHit1) return 1;
         else return 0;

      } // HitTest

      //
      // GetScore - Get current score for player N
      //
      public int GetScore (int iPlayer)
      {
         int iScore = 0;
         int x, y;
         for (x = 0; x < cxWidth; x++)
         {
            for (y = 0; y < cyHeight; y++)
            {
               if (m_asq[x,y].iOwner == iPlayer)
                  iScore++;
            }
         }
         return iScore;
      } // GetScore

   } // class Squares

} // namespace

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
九九精品一区二区| 精品欧美一区二区久久| 欧美一区二区三区免费大片| 久久久不卡网国产精品一区| 亚洲影院免费观看| 福利电影一区二区| 日韩精品一区二区三区四区| 亚洲国产精品自拍| 91免费版pro下载短视频| 精品久久人人做人人爽| 日韩精品视频网站| 欧美少妇性性性| 亚洲精品写真福利| 成人av资源网站| 亚洲国产精品成人综合| 久草精品在线观看| 日韩精品在线网站| 日本不卡一区二区| 91精品欧美久久久久久动漫| 亚洲亚洲人成综合网络| 在线观看一区不卡| 一区二区三区在线观看视频| 91在线小视频| 亚洲欧美日韩一区| 91色在线porny| 亚洲色图20p| 色8久久精品久久久久久蜜| 中文字幕久久午夜不卡| 国产suv一区二区三区88区| 久久女同精品一区二区| 国产成人在线影院| 国产精品私人自拍| 9久草视频在线视频精品| 国产精品国产成人国产三级| 成人美女在线观看| 亚洲欧美日韩精品久久久久| 色综合久久中文字幕| 夜夜操天天操亚洲| 欧美精选在线播放| 青青草原综合久久大伊人精品优势| 91精品国产欧美一区二区18| 日韩av不卡一区二区| 精品国产第一区二区三区观看体验| 看片网站欧美日韩| 国产日韩视频一区二区三区| 成人爽a毛片一区二区免费| 综合av第一页| 在线不卡中文字幕| 国产在线视频一区二区三区| 久久久久九九视频| 一本一道波多野结衣一区二区| 一二三区精品视频| 欧美电视剧在线观看完整版| 国产99一区视频免费| 一区二区三区不卡视频在线观看| 欧美日韩精品免费| 国产一区二区免费视频| 亚洲欧洲精品天堂一级| 制服.丝袜.亚洲.中文.综合| 极品少妇xxxx精品少妇| 日韩码欧中文字| 欧美一区二区三区人| 粉嫩蜜臀av国产精品网站| 一区二区三区久久| 欧美www视频| 91浏览器在线视频| 美脚の诱脚舐め脚责91| 亚洲人成7777| 久久亚洲综合色| 色婷婷综合在线| 国产成人精品一区二区三区四区| 一区二区三区精品久久久| 2023国产精品| 精品视频免费在线| 成人av在线播放网址| 麻豆精品视频在线| 亚洲毛片av在线| 久久综合色婷婷| 欧美无乱码久久久免费午夜一区 | 欧美成va人片在线观看| 99久久伊人网影院| 久久成人精品无人区| 一区二区三区四区中文字幕| 久久精品网站免费观看| 欧美一区二区精品| 欧美性xxxxx极品少妇| 成人毛片在线观看| 久久爱www久久做| 亚洲动漫第一页| 亚洲免费观看高清完整版在线观看熊 | 免费成人在线播放| 亚洲另类在线制服丝袜| 国产夜色精品一区二区av| 91精品国产综合久久久久久漫画| 99精品在线观看视频| 国产69精品久久久久777| 激情小说亚洲一区| 日韩激情av在线| 午夜一区二区三区在线观看| 亚洲欧美视频在线观看视频| 亚洲欧美怡红院| 亚洲国产精品黑人久久久| 久久一二三国产| 欧美电影免费观看高清完整版| 欧美人与禽zozo性伦| 欧美色爱综合网| 欧美午夜精品久久久久久孕妇 | 日韩精品一区在线观看| 91精品国产欧美一区二区成人 | 中文字幕av一区二区三区| wwww国产精品欧美| 久久久精品日韩欧美| 久久久国产一区二区三区四区小说| 欧美变态口味重另类| 日韩一卡二卡三卡| 日韩精品专区在线影院重磅| 欧美成人aa大片| 久久先锋资源网| 国产精品电影一区二区三区| 中文字幕一区不卡| 一区2区3区在线看| 丝袜美腿高跟呻吟高潮一区| 蜜臂av日日欢夜夜爽一区| 久久精品二区亚洲w码| 国产精品系列在线观看| 成人免费看视频| 一本色道**综合亚洲精品蜜桃冫| 欧美亚洲国产一区二区三区va| 欧美日本在线一区| 欧美成人一区二区三区在线观看| 欧美va亚洲va在线观看蝴蝶网| 久久一区二区三区四区| 亚洲婷婷综合色高清在线| 亚洲一区二区中文在线| 美女视频免费一区| 成人免费观看男女羞羞视频| 91精品1区2区| 欧美一二三四区在线| 国产日韩成人精品| 一区二区三区在线视频播放| 青青草97国产精品免费观看 | 久久精品国产亚洲高清剧情介绍 | 国产精品乱人伦中文| 一级精品视频在线观看宜春院| 日本亚洲三级在线| 粉嫩在线一区二区三区视频| 欧美性猛交xxxxxx富婆| 精品av综合导航| 亚洲一区视频在线观看视频| 韩国精品主播一区二区在线观看| gogo大胆日本视频一区| 欧美一区二区三区视频免费| 国产精品乱码人人做人人爱| 天堂久久久久va久久久久| 国产精品影视网| 精品视频一区二区不卡| 欧美极品少妇xxxxⅹ高跟鞋| 日韩中文字幕区一区有砖一区| 成人网在线免费视频| 欧美电视剧在线看免费| 亚洲精品欧美在线| 国产盗摄女厕一区二区三区| 欧美日韩国产电影| 国产精品国产三级国产aⅴ无密码| 蜜臀久久99精品久久久久宅男 | 日韩免费观看高清完整版 | 一区二区三区不卡视频在线观看| 麻豆精品国产91久久久久久| av在线不卡电影| 久久久一区二区| 日本午夜一本久久久综合| 92国产精品观看| 中文字幕免费在线观看视频一区| 免费人成黄页网站在线一区二区| 91影院在线观看| 国产精品区一区二区三区| 蓝色福利精品导航| 制服丝袜激情欧洲亚洲| 亚洲免费观看高清完整| 成人午夜电影久久影院| 久久久亚洲综合| 国产一区二区调教| 精品欧美一区二区久久| 美女视频黄久久| 欧美一区二区三区视频免费播放| 亚洲成在人线免费| 在线免费一区三区| 一级特黄大欧美久久久| 色婷婷激情一区二区三区| 亚洲欧美日韩中文字幕一区二区三区| 国产jizzjizz一区二区| 国产欧美一区二区精品久导航 | 伊人色综合久久天天| 99re在线精品| 亚洲精品美国一| 91免费精品国自产拍在线不卡| 亚洲欧美在线观看| 91女厕偷拍女厕偷拍高清| 亚洲欧美日韩成人高清在线一区| 99v久久综合狠狠综合久久|