OSDN Git Service

[DTXC] #24264 BPMレーンから左にドラッグしてもエラーにならないよう修正。
authoryyagi <yyagi@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Thu, 27 Jan 2011 16:57:12 +0000 (16:57 +0000)
committeryyagi <yyagi@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Thu, 27 Jan 2011 16:57:12 +0000 (16:57 +0000)
git-svn-id: http://svn.osdn.jp/svnroot/dtxmania/trunk@97 16f42ceb-6dc6-49c8-ba94-f2d53467949d

DTXCreatorプロジェクト/コード/05.譜面/C編集モード管理.cs

index 4561398..22ed454 100644 (file)
@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Text;\r
 using System.Drawing;\r
 using System.Windows.Forms;\r
+using System.Diagnostics;\r
 using DTXCreator.UndoRedo;\r
 using DTXCreator.WAV_BMP_AVI;\r
 using DTXCreator.Properties;\r
@@ -69,17 +70,28 @@ namespace DTXCreator.譜面
                        Rectangle rectangle = new Rectangle( this.rc現在のチップカーソル領域.Location, this.rc現在のチップカーソル領域.Size );\r
                        this.n現在のチップカーソルがあるレーン番号0to = this.mgr譜面管理者ref.nX座標dotが位置するレーン番号を返す( e.X );\r
                        this.n現在のチップカーソルの譜面先頭からの位置grid = this.mgr譜面管理者ref.nY座標dotが位置するgridを返す・ガイド幅単位( e.Y );\r
+                       bool bOutOfLanes = false;\r
                        if( e.Y < ( C譜面管理.nレーン割付チップ番号表示高さdot + 10 ) )\r
                        {\r
                                this.rc現在のチップカーソル領域 = new Rectangle( 0, 0, 0, 0 );\r
                        }\r
                        else\r
                        {\r
-                               this.rc現在のチップカーソル領域 = new Rectangle( this.mgr譜面管理者ref.nレーンの左端X座標dotを返す( this.n現在のチップカーソルがあるレーン番号0to ), this.mgr譜面管理者ref.n譜面先頭からの位置gridから描画領域内のY座標dotを返す( this.n現在のチップカーソルの譜面先頭からの位置grid, this._Form.pictureBox譜面パネル.ClientSize ) - Cチップ.nチップの高さdot, this.mgr譜面管理者ref.listレーン[ this.n現在のチップカーソルがあるレーン番号0to ].n幅dot, Cチップ.nチップの高さdot );\r
+                               int nLaneNo = this.n現在のチップカーソルがあるレーン番号0to;\r
+                               if ( nLaneNo < 0 )                              // #24264 2011.1.27 yyagi; to avoid ArgumentOutOfExceptions in x and width.\r
+                               {\r
+                                       bOutOfLanes = true;\r
+                                       nLaneNo = 0;\r
+                               }\r
+                               int x = this.mgr譜面管理者ref.nレーンの左端X座標dotを返す( nLaneNo );\r
+                               int y = this.mgr譜面管理者ref.n譜面先頭からの位置gridから描画領域内のY座標dotを返す( this.n現在のチップカーソルの譜面先頭からの位置grid, this._Form.pictureBox譜面パネル.ClientSize ) - Cチップ.nチップの高さdot;\r
+                               int width = this.mgr譜面管理者ref.listレーン[ nLaneNo ].n幅dot;\r
+                               int height = Cチップ.nチップの高さdot;\r
+                               this.rc現在のチップカーソル領域 = new Rectangle( x, y, width, height );\r
                        }\r
-                       if( !rectangle.Equals( this.rc現在のチップカーソル領域 ) )\r
+                       if ( !rectangle.Equals( this.rc現在のチップカーソル領域 ) && !bOutOfLanes ) // #24264 2011.1.27 yyagi add condition !bOutOfLanes to avoid ArgumentOutOfException in Refresh().\r
                        {\r
-                               this._Form.pictureBox譜面パネル.Refresh();\r
+                               this._Form.pictureBox譜面パネル.Refresh(); \r
                        }\r
                }\r
                internal void Paint( PaintEventArgs e )\r