⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globalfun.cpp

📁 《C++Builder程序设计范例--中国象棋》配书盘自述文件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
      MoveToEx(hDC, p.x+ SQUARE_SIZE /2 ,p.y+ SQUARE_SIZE /2,NULL);
      LineTo(hDC, p.x +SQUARE_SIZE, p.y +SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE/2, p.y+ SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y  );
     }
   if (rank==0)         //第一行
    if ((line==1)||(line==2)||(line==4)||(line==6)||(line==7))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE, p.y +SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE/2, p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y );
     }

   if ((rank==0)&&(line==3))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE , p.y + SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE/2 , p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE/2, p.y );
      MoveToEx( hDC, p.x + SQUARE_SIZE/2, p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE , p.y );
     }
   if ((rank==0)&&(line==5))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE, p.y + SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE/2 , p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE/2, p.y );
      MoveToEx( hDC, p.x + SQUARE_SIZE/2, p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x , p.y );
     }
    if (line==0)          //     第一列
   
     if ((rank==1)||(rank==2)||(rank==4)||(rank==5)||(rank==7)||(rank==8))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE/2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2 , p.y +SQUARE_SIZE);
      MoveToEx( hDC, p.x + SQUARE_SIZE/2 , p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE/2  );
     }
     if (line==0)
        if ((rank==3)||(rank==6))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE/2 , p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE/2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*3/8 , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*5/8 , p.y + SQUARE_SIZE/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*7/8 , p.y + SQUARE_SIZE*3/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*7/8 , p.y + SQUARE_SIZE*5/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*5/8 , p.y + SQUARE_SIZE*7/8 );
     }
    
    if (line==8)          // 第九列
 
       if ((rank==1)||(rank==2)||(rank==4)||(rank==5)||(rank==7)||(rank==8))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE/2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2 , p.y +SQUARE_SIZE);
      MoveToEx( hDC, p.x + SQUARE_SIZE/2 , p.y + SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x ,p.y + SQUARE_SIZE/2  );
     }

     if (line==8)   //第九列
        if ((rank==3)||(rank==6))
     {
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*3/8 , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*3/8 , p.y + SQUARE_SIZE/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/8 , p.y + SQUARE_SIZE*3/8 );

      MoveToEx( hDC, p.x , p.y +SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE/2 );
      MoveToEx( hDC, p.x +SQUARE_SIZE/2, p.y, NULL );
      LineTo(hDC, p.x +SQUARE_SIZE/2 , p.y + SQUARE_SIZE );

      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/8, p.y + SQUARE_SIZE*5/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*3/8, p.y + SQUARE_SIZE*7/8 );
     }

    if (rank==9)          // 第十行
    
     if ((line==1)||(line==2)||(line==4)||(line==6)||(line==7))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL );
      LineTo(hDC, p.x + SQUARE_SIZE , p.y +SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE  );
     }
     if ((rank==9)&&(line==3))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE  );
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2 , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE);
     }
      if ((rank==9)&&(line==5))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE , p.y + SQUARE_SIZE /2 , NULL);
      LineTo(hDC, p.x , p.y +SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE  );
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL );
      LineTo(hDC, p.x , p.y +SQUARE_SIZE);
     }
     if ((rank==9)&&(line==0))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE  );
     }

     if ((rank==9)&&(line==8))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2 , p.y +SQUARE_SIZE);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x  , p.y + SQUARE_SIZE/2  );
     }

      if ((rank==0)&&(line==8))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2 , p.y);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x , p.y + SQUARE_SIZE/2  );
     }

     if (rank==5)      //第六行
       if ((line==1)||(line==2)||(line==3)||(line==4)||(line==5)||(line==6)||(line==7))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE /2, p.y  );
     }
      if (rank==4)    //第五行
	 if ((line==1)||(line==2)||(line==3)||(line==4)||(line==5)||(line==6)||(line==7))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2 , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE  );
     }

     if ((rank==1)|| (rank==8))
      if  ((line==1)||(line==2)||(line==3)||(line==5)||(line==6)||(line==7))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y, NULL );
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
     }     
     if ((rank==1)||(rank==8))
       if (line==4)      //第五列
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
      MoveToEx( hDC, p.x ,p.y, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE );
      MoveToEx( hDC, p.x ,p.y + SQUARE_SIZE, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE, p.y );
     }
     if ((rank==2) || (rank==7))
       if  ((line==1) ||(line==7))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);

      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*3/8 , p.y + SQUARE_SIZE/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/8 , p.y + SQUARE_SIZE*3/8 );

      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*5/8 , p.y + SQUARE_SIZE/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*7/8 , p.y + SQUARE_SIZE*3/8 );

      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/8 , p.y + SQUARE_SIZE*5/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*3/8 , p.y + SQUARE_SIZE*7/8 );

      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*7/8 , p.y + SQUARE_SIZE*5/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*5/8 , p.y + SQUARE_SIZE*7/8 );
     }
     if ((rank==3) || (rank==6))
       if  ((line==2) ||(line==4)||(line==6))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x  + SQUARE_SIZE /2 , p.y, NULL );
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);

      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*3/8 , p.y + SQUARE_SIZE/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/8 , p.y + SQUARE_SIZE*3/8 );

      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*5/8 , p.y + SQUARE_SIZE/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*7/8 , p.y +  SQUARE_SIZE*3/8 );

      MoveToEx( hDC, p.x  +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/8 , p.y + SQUARE_SIZE*5/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8,  p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*3/8 , p.y + SQUARE_SIZE*7/8 );

      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*7/8 , p.y + SQUARE_SIZE*5/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*5/8 , p.y + SQUARE_SIZE*7/8 );
     }

      if (rank==7)      //第八行
       if  ((line==2)||(line==4)||(line==6))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y, NULL );
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
     }

     if ((rank==7)&&(line==3))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y, NULL );
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y +SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE, p.y );
     }

     if ((rank==7)&&(line==5))
     {
      MoveToEx( hDC,  p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y +SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x , p.y );
     }

     if (rank==2)   //第三行
       if  ((line==2)||(line==4)||(line==6))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x  + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y  + SQUARE_SIZE);
     }
     if ((rank==2)&&(line==3))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y +SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE, p.y + SQUARE_SIZE);
     }
     if ((rank==2)&&(line==5))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y +SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x , p.y + SQUARE_SIZE);
     }

     if (rank==6)    //第七行
       if  ((line==1)||(line==3)||(line==5)||(line==7))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x  +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
     }

     if (rank==3)    //第四行
       if  ((line==1)||(line==3)||(line==5)||(line==7))
     {
      MoveToEx( hDC,  p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
     }
      square = 0x98 -  square ;
   }
     hOldBrush = SelectObject(hDC, hColorBrush);
     PatBlt(hDC, p.x, p.y , SQUARE_SIZE, SQUARE_SIZE, PATCOPY);
     MainForm->Canvas->Pen->Color=clBlack;
     MainForm->Canvas->Pen->Width=2;
   if ((rank==0)&&(line==0))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE /2, p.y  );
     }
   if (rank==0)     //第一行
    if ((line==1)||(line==2)||(line==4)||(line==6)||(line==7))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE /2, p.y  );
     }
   if ((rank==0)&&(line==3))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE /2, p.y  );
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y  );
     }
   if ((rank==0)&&(line==5))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE /2, p.y  );
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x , p.y  );
     }

    if (line==0)    //第一列
      if ((rank==1)||(rank==2)||(rank==4)||(rank==5)||(rank==7)||(rank==8))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2 , p.y +SQUARE_SIZE);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2  );
     }
     if (line==0)        //第一列
        if ((rank==3)||(rank==6))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y + SQUARE_SIZE /2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y, NULL );
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE);
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*5/8 , p.y + SQUARE_SIZE/8 );
      MoveToEx( hDC, p.x + SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*7/8 , p.y + SQUARE_SIZE*3/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*7/8 , p.y + SQUARE_SIZE*5/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*5/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*5/8 , p.y + SQUARE_SIZE*7/8 );
     }
    
    if (line==8)      //第九列
     if ((rank==1)||(rank==2)||(rank==4)||(rank==5)||(rank==7)||(rank==8))
     {
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2 , p.y +SQUARE_SIZE);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x , p.y + SQUARE_SIZE /2  );
     }

     if (line==8)   //第九列
        if ((rank==3)||(rank==6))
     {
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*3/8 , p.y + SQUARE_SIZE/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*3/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/8 , p.y + SQUARE_SIZE*3/8 );

      MoveToEx( hDC, p.x , p.y +SQUARE_SIZE/2, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2, p.y + SQUARE_SIZE/2 );
      MoveToEx( hDC, p.x +SQUARE_SIZE/2, p.y , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/2 , p.y + SQUARE_SIZE );

      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE/8 , p.y + SQUARE_SIZE*5/8 );
      MoveToEx( hDC, p.x +SQUARE_SIZE*3/8, p.y +SQUARE_SIZE*5/8, NULL);
      LineTo(hDC, p.x +SQUARE_SIZE*3/8  , p.y + SQUARE_SIZE*7/8 );
     }

    if (rank==9)      //第十行
     if ((line==1)||(line==2)||(line==4)||(line==6)||(line==7))
     {
      MoveToEx( hDC, p.x  , p.y + SQUARE_SIZE /2 , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);
      LineTo(hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE  );
     }
     if ((rank==9)&&(line==3))
     {
      MoveToEx( hDC, p.x , p.y + SQUARE_SIZE /2 , NULL);
      LineTo(hDC, p.x +SQUARE_SIZE , p.y +SQUARE_SIZE/2);
      MoveToEx( hDC, p.x + SQUARE_SIZE /2 , p.y + SQUARE_SIZE /2, NULL);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -