• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 11,  comments - 12,  trackbacks - 0

            主要源代碼:

            void CSpellGraphicDlg::OnUp() 
            {
             
            // TODO: Add your control notification handler code here

             
            if (p.currentPoint/3==0)
             
            {
              MessageBox(
            "無法移動!");
             }

             
            else{
              p.beforePoint
            =p.currentPoint;
              p.currentPoint
            -=3;
              
            int temp=a[p.currentPoint/3][p.currentPoint-3*(p.currentPoint/3)];
              a[p.currentPoint
            /3][p.currentPoint-3*(p.currentPoint/3)]=a[p.beforePoint/3][p.beforePoint-3*(p.beforePoint/3)];
              a[p.beforePoint
            /3][p.beforePoint-3*(p.beforePoint/3)]=temp;
              drawCurrentPoint();
              drawBeforPoint();
             }

             
            if (isFinished())
             
            {
              
            if (MessageBox("恭喜你,成功了!","繼續?",MB_YESNO)==IDOK)
              
            {
               inintial();
              }

              
            else{
               MessageBox(
            "謝謝您的支持,歡迎再次使用!");
              }

             }

            }


            void CSpellGraphicDlg::OnDown() 
            {
             
            // TODO: Add your control notification handler code here
             if (p.currentPoint/3==2)
             
            {
              MessageBox(
            "無法移動!");
             }

             
            else{
              p.beforePoint
            =p.currentPoint;
              p.currentPoint
            +=3;
              
            int temp=a[p.currentPoint/3][p.currentPoint-3*(p.currentPoint/3)];
              a[p.currentPoint
            /3][p.currentPoint-3*(p.currentPoint/3)]=a[p.beforePoint/3][p.beforePoint-3*(p.beforePoint/3)];
              a[p.beforePoint
            /3][p.beforePoint-3*(p.beforePoint/3)]=temp;
              drawCurrentPoint();
              drawBeforPoint();
             }

             
            if (isFinished())
             
            {
              
            if (MessageBox("恭喜你,成功了!","繼續?",MB_YESNO)==IDOK)
              
            {
               inintial();
              }

              
            else{
               MessageBox(
            "謝謝您的支持,歡迎再次使用!");
              }

             }

            }


            void CSpellGraphicDlg::OnLeft() 
            {
             
            // TODO: Add your control notification handler code here
             if (p.currentPoint%3==0)
             
            {
              MessageBox(
            "無法移動!");
             }

             
            else{
              p.beforePoint
            =p.currentPoint;
              p.currentPoint
            -=1;
              
            int temp=a[p.currentPoint/3][p.currentPoint-3*(p.currentPoint/3)];
              a[p.currentPoint
            /3][p.currentPoint-3*(p.currentPoint/3)]=a[p.beforePoint/3][p.beforePoint-3*(p.beforePoint/3)];
              a[p.beforePoint
            /3][p.beforePoint-3*(p.beforePoint/3)]=temp;
              drawCurrentPoint();
              drawBeforPoint();
             }

             
            if (isFinished())
             
            {
              
            if (MessageBox("恭喜你,成功了!","繼續?",MB_YESNO)==IDOK)
              
            {
               inintial();
              }

              
            else{
               MessageBox(
            "謝謝您的支持,歡迎再次使用!");
              }

             }

             
            }


            void CSpellGraphicDlg::OnRight() 
            {
             
            // TODO: Add your control notification handler code here
             if (p.currentPoint%3==2)
             
            {
              MessageBox(
            "無法移動!");
             }

             
            else{
              p.beforePoint
            =p.currentPoint;
              p.currentPoint
            +=1;
              
            int temp=a[p.currentPoint/3][p.currentPoint-3*(p.currentPoint/3)];
              a[p.currentPoint
            /3][p.currentPoint-3*(p.currentPoint/3)]=a[p.beforePoint/3][p.beforePoint-3*(p.beforePoint/3)];
              a[p.beforePoint
            /3][p.beforePoint-3*(p.beforePoint/3)]=temp;
              drawCurrentPoint();
              drawBeforPoint();
             }

             
            if (isFinished())
             
            {
              
            if (MessageBox("恭喜你,成功了!","繼續?",MB_YESNO)==IDOK)
              
            {
               inintial();
              }

              
            else{
               MessageBox(
            "謝謝您的支持,歡迎再次使用!");
              }

             }

             
            }


            bool CSpellGraphicDlg::isExit(int n){
             
            bool exit=false;
             
            for (int i=0;i<3;i++)
             
            {
              
            for (int j=0;j<3;j++)
              
            {
               
            if (a[i][j]==n)
               
            {
                exit
            =true;
                
            break;
               }

              }

              
            if (exit==true)
              
            {
               
            break;
              }

             }

             
            return exit;
            }


            bool CSpellGraphicDlg::isFinished(){
             CString str;
             CString strnum;
             
            for (int i=1;i<9;i++)
             
            {
              
            switch(i)
              
            {
              
            case 1:
               m_1.GetWindowText(str);
               strnum
            =""+i;
               
            if (strcmp(str,strnum)!=0)
               
            {
                
            goto returnfalse;
               }

               
            break;
              
            case 2:
               m_2.GetWindowText(str);
               strnum
            =""+i;
               
            if (strcmp(str,strnum)!=0)
               
            {
                
            goto returnfalse;
               }

               
            break;
              
            case 3:
               m_3.GetWindowText(str);
               strnum
            =""+i;
               
            if (strcmp(str,strnum)!=0)
               
            {
                
            goto returnfalse;
               }

               
            break;
              
            case 4:
               m_4.GetWindowText(str);
               strnum
            =""+i;
               
            if (strcmp(str,strnum)!=0)
               
            {
                
            goto returnfalse;
               }

               
            break;
              
            case 5:
               m_5.GetWindowText(str);
               strnum
            =""+i;
               
            if (strcmp(str,strnum)!=0)
               
            {
                
            goto returnfalse;
               }

               
            break;
              
            case 6:
               m_6.GetWindowText(str);
               strnum
            =""+i;
               
            if (strcmp(str,strnum)!=0)
               
            {
                
            goto returnfalse;
               }

               
            break;
              
            case 7:
               m_7.GetWindowText(str);
               strnum
            =""+i;
               
            if (strcmp(str,strnum)!=0)
               
            {
                
            goto returnfalse;
               }

               
            break;
              
            case 8:
               m_8.GetWindowText(str);
               strnum
            =""+i;
               
            if (strcmp(str,strnum)!=0)
               
            {
                
            goto returnfalse;
               }

               
            break;
              }

             }

             
            return true;
             returnfalse: 
            return false;
            }


            void CSpellGraphicDlg::inintial(){
             
            for (int i=0;i<3;i++)
             
            {
              
            for (int j=0;j<3;j++)
              
            {
               a[i][j]
            =9;
              }

             }


             
            int number=0;
             srand( (unsigned)time( NULL ) );
             
            while (true)
             
            {
              
            int num=rand()%9;
              
              
            if (number==8)
              
            {
               
            break;
              }


              
            if (num!=0 && !isExit(num))
              
            {
               a[number
            /3][(number-3*(number/3))%3]=num;
               number
            ++;
              }

             }

             
             CString str;
             
            for(int m=0;m<3;m++)
             
            {
              
            for (int n=0;n<3;n++)
              
            {
               
            int point=3*m+n+1;
               str.Format(_T(
            "%d"),a[m][n]);
               
            switch(point)
               
            {
               
            case 1:
                
            if (a[m][n]==9)
                
            {
                 m_1.SetWindowText(
            "");
                 
            break;
                }

                m_1.SetWindowText(str);
                
            break;
               
            case 2:
                
            if (a[m][n]==9)
                
            {
                 m_2.SetWindowText(
            "");
                 
            break;
                }

                m_2.SetWindowText(str);
                
            break;
               
            case 3:
                
            if (a[m][n]==9)
                
            {
                 m_3.SetWindowText(
            "");
                 
            break;
                }

                m_3.SetWindowText(str);
                
            break;
               
            case 4:
                
            if (a[m][n]==9)
                
            {
                 m_4.SetWindowText(
            "");
                 
            break;
                }

                m_4.SetWindowText(str);
                
            break;
               
            case 5:
                
            if (a[m][n]==9)
                
            {
                 m_5.SetWindowText(
            "");
                 
            break;
                }

                m_5.SetWindowText(str);
                
            break;
               
            case 6:
                
            if (a[m][n]==9)
                
            {
                 m_6.SetWindowText(
            "");
                 
            break;
                }

                m_6.SetWindowText(str);
                
            break;
               
            case 7:
                
            if (a[m][n]==9)
                
            {
                 m_7.SetWindowText(
            "");
                 
            break;
                }

                m_7.SetWindowText(str);
                
            break;
               
            case 8:
                
            if (a[m][n]==9)
                
            {
                 m_8.SetWindowText(
            "");
                 
            break;
                }

                m_8.SetWindowText(str);
                
            break;
               
            case 9:
                
            if (a[m][n]==9)
                
            {
                 m_9.SetWindowText(
            "");
                 
            break;
                }

                m_9.SetWindowText(str);
                
            break;
               }

              }

             }

            }


            void CSpellGraphicDlg::drawCurrentPoint(){
               
            int pp=p.currentPoint+1;
               
            switch(pp)
               
            {
               
            case 1:
                m_1.SetWindowText(
            "");
                
            break;
               
            case 2:
                m_2.SetWindowText(
            "");
                
            break;
               
            case 3:
                m_3.SetWindowText(
            "");
                
            break;
               
            case 4:
                m_4.SetWindowText(
            "");
                
            break;
               
            case 5:
                m_5.SetWindowText(
            "");
                
            break;
               
            case 6:
                m_6.SetWindowText(
            "");
                
            break;
               
            case 7:
                m_7.SetWindowText(
            "");
                
            break;
               
            case 8:
                m_8.SetWindowText(
            "");
                
            break;
               
            case 9:
                m_9.SetWindowText(
            "");
                
            break;
               }

              
            }


            void CSpellGraphicDlg::drawBeforPoint(){
             
            int pp=p.beforePoint+1;
             CString str;
             str.Format(_T(
            "%d"),a[p.beforePoint/3][p.beforePoint-3*(p.beforePoint/3)]);
               
            switch(pp)
               
            {
               
            case 1:
                m_1.SetWindowText(str);
                
            break;
               
            case 2:
                m_2.SetWindowText(str);
                
            break;
               
            case 3:
                m_3.SetWindowText(str);
                
            break;
               
            case 4:
                m_4.SetWindowText(str);
                
            break;
               
            case 5:
                m_5.SetWindowText(str);
                
            break;
               
            case 6:
                m_6.SetWindowText(str);
                
            break;
               
            case 7:
                m_7.SetWindowText(str);
                
            break;
               
            case 8:
                m_8.SetWindowText(str);
                
            break;
               
            case 9:
                m_9.SetWindowText(str);
                
            break;
               }

            }


            void CSpellGraphicDlg::OnreStart() 
            {
             
            // TODO: Add your control notification handler code here
             if (MessageBox("確定開始嗎?","確定",MB_OKCANCEL)==IDOK)
             
            {
              inintial();
             }

             
            else{
             
             }

            }


            void CSpellGraphicDlg::Onclose() 
            {
             
            // TODO: Add your control notification handler code here
             CDialog::OnCancel();
            }


            void CSpellGraphicDlg::OnTimer(UINT nIDEvent) 
            {
             
            // TODO: Add your message handler code here and/or call default
             CTime time=CTime::GetCurrentTime();
             CString str
            =time.Format("%H:%M:%S");
             m_time.SetWindowText(str);
             CDialog::OnTimer(nIDEvent);
            }

            posted on 2009-08-03 15:37 人生在于攀登! 閱讀(205) 評論(0)  編輯 收藏 引用
            <2009年8月>
            2627282930311
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345

            常用鏈接

            留言簿

            隨筆檔案

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            香蕉久久夜色精品国产尤物| 99久久人人爽亚洲精品美女| 青青草原综合久久大伊人精品| 久久ww精品w免费人成| 久久99精品久久久久子伦| …久久精品99久久香蕉国产| 72种姿势欧美久久久久大黄蕉| www亚洲欲色成人久久精品| 国产午夜福利精品久久| 欧美伊人久久大香线蕉综合69| 精品一二三区久久aaa片| 久久99国产精品尤物| 久久精品无码专区免费| 麻豆AV一区二区三区久久| 91精品国产色综久久| 久久久亚洲裙底偷窥综合| 国产成人精品久久亚洲高清不卡 | 大香伊人久久精品一区二区| 亚洲αv久久久噜噜噜噜噜| 777久久精品一区二区三区无码| 午夜视频久久久久一区| 狠狠色婷婷综合天天久久丁香| 亚洲综合久久夜AV | 久久综合久久综合九色| 性高朝久久久久久久久久| 国产精品国色综合久久| 亚洲国产视频久久| 国产精品无码久久久久| 99999久久久久久亚洲| 一本一道久久综合狠狠老 | 91精品国产91久久| 国产成人久久精品一区二区三区| 亚洲欧洲中文日韩久久AV乱码| 久久99精品国产麻豆宅宅| 五月丁香综合激情六月久久 | 久久青青国产| 久久精品一区二区影院 | 亚洲乱亚洲乱淫久久| 精品一区二区久久| 国产精品九九九久久九九| 国产精品久久久久9999|