• <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 人生在于攀登! 閱讀(208) 評論(0)  編輯 收藏 引用
            <2009年8月>
            2627282930311
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345

            常用鏈接

            留言簿

            隨筆檔案

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品国产一区二区电影| 久久美女网站免费| 午夜精品久久久内射近拍高清| 久久精品亚洲男人的天堂| 久久精品综合一区二区三区| 亚洲日本久久久午夜精品| 91麻豆国产精品91久久久| 久久久久国产精品人妻| 狠狠狠色丁香婷婷综合久久俺| 国产精品久久久天天影视香蕉| 亚洲AV伊人久久青青草原| 久久精品无码专区免费东京热| 久久综合中文字幕| 国内精品伊人久久久久妇| 国产精品久久久久影院色| 一极黄色视频久久网站| 天天爽天天爽天天片a久久网| 久久久久一本毛久久久| 久久久噜噜噜久久熟女AA片| 久久天天躁狠狠躁夜夜av浪潮| 久久精品无码专区免费青青| 国内精品久久久久影院亚洲| 国产 亚洲 欧美 另类 久久| 久久国产色AV免费观看| 久久人人爽人人爽人人片AV麻烦| 久久久久久久尹人综合网亚洲| 熟妇人妻久久中文字幕| 亚洲日韩欧美一区久久久久我| 国产福利电影一区二区三区,免费久久久久久久精 | 99精品国产综合久久久久五月天| 亚洲午夜精品久久久久久人妖| 久久久噜噜噜www成人网| 97香蕉久久夜色精品国产| 久久精品综合一区二区三区| 国产高清美女一级a毛片久久w| 97久久国产亚洲精品超碰热| 久久精品国产第一区二区三区| 亚洲欧美日韩中文久久 | 99国产欧美久久久精品蜜芽| 久久精品国产99久久久古代| 精品一二三区久久aaa片|