@@ -477,7 +477,6 @@ private void DrawStereoNet(Graphics g)
477477 if ( radioButtonAxes . Checked || radioButtonPlanes . Checked )
478478 {
479479 var v = matBase * index ;
480- //var v = rot * vec;
481480 if ( radioButtonLowerSphere . Checked )
482481 v . Z = - v . Z ;
483482 var srcPt = conv ( v ) ;
@@ -495,7 +494,7 @@ private void DrawStereoNet(Graphics g)
495494 {
496495 string str ;
497496 if ( HexagonalLattice && checkBoxUseMillerBravaisIndex . Checked && radioButtonPlanes . Checked )
498- str = $ "({ index . X } { index . Y } { delimiter } { - index . X - index . Y } { delimiter } { index . Z } )";
497+ str = $ "({ index . X } { delimiter } { index . Y } { delimiter } { - index . X - index . Y } { delimiter } { index . Z } )";
499498 else
500499 str = radioButtonAxes . Checked ? $ "[{ index . X } { delimiter } { index . Y } { delimiter } { index . Z } ]" : $ "({ index . X } { delimiter } { index . Y } { delimiter } { index . Z } )";
501500
@@ -583,7 +582,7 @@ private void DrawStereoNet(Graphics g)
583582 }
584583
585584 var list = dic . OrderByDescending ( e => e . Value ) . ToArray ( ) ;
586- var max = Math . Min ( allIndices . Length / 2 , list . Length ) ;
585+ var max = Min ( allIndices . Length / 2 , list . Length ) ;
587586 while ( max + 1 < list . Length && list [ max - 1 ] . Value == list [ max ] . Value )
588587 max ++ ;
589588
@@ -1193,6 +1192,47 @@ private void buttonRemoveIndex_Click(object sender, EventArgs e)
11931192 setVector ( ) ;
11941193 Draw ( ) ;
11951194 }
1195+
1196+ /// <summary>
1197+ /// 指数リストボックスの項目描画
1198+ /// </summary>
1199+ /// <param name="sender"></param>
1200+ /// <param name="e"></param>
1201+ private void listBoxSpecifiedIndices_DrawItem ( object sender , DrawItemEventArgs e )
1202+ {
1203+ //背景を描画する
1204+ //項目が選択されている時は強調表示される
1205+ e . DrawBackground ( ) ;
1206+
1207+ var ih = listBoxSpecifiedIndices . ItemHeight ;
1208+ var margin = 1 ;
1209+
1210+ //ListBoxが空のときにListBoxが選択されるとe.Indexが-1になる
1211+ if ( e . Index > - 1 )
1212+ {
1213+ var row = ( IndexInfo ) ( ( ListBox ) sender ) . Items [ e . Index ] ;
1214+ //スポットの色を表示
1215+ e . Graphics . FillRectangle ( new SolidBrush ( Color . FromArgb ( row . ARGB ) ) , new Rectangle ( e . Bounds . X + margin , e . Bounds . Y + margin , ih - margin , ih - margin ) ) ;
1216+ //文字を描画する色の選択
1217+ Brush b = new SolidBrush ( e . ForeColor ) ;
1218+
1219+ //文字列の描画
1220+ if ( HexagonalLattice && checkBoxUseMillerBravaisIndex . Visible && checkBoxUseMillerBravaisIndex . Checked && radioButtonPlanes . Checked ) //ミラー・ブレイビス指数で表示
1221+ {
1222+ var ( h , k , l ) = row . Indices [ 0 ] ;
1223+ e . Graphics . DrawString ( $ "{ h } { k } { - h - k } { l } ", e . Font , b , new Rectangle ( e . Bounds . X + ih , e . Bounds . Y , e . Bounds . Width - ih , e . Bounds . Height ) ) ;
1224+ }
1225+ else //通常の表示
1226+ e . Graphics . DrawString ( row . ToString ( ) , e . Font , b , new Rectangle ( e . Bounds . X + ih , e . Bounds . Y , e . Bounds . Width - ih , e . Bounds . Height ) ) ;
1227+
1228+ //後始末
1229+ b . Dispose ( ) ;
1230+ }
1231+
1232+ //フォーカスを示す四角形を描画
1233+ e . DrawFocusRectangle ( ) ;
1234+ }
1235+
11961236 #endregion
11971237
11981238 #region 面、軸のベクトルを計算 SetVector
@@ -1495,45 +1535,6 @@ private void radioButtonDelimiterNone_CheckedChanged(object sender, EventArgs e)
14951535 Draw ( ) ;
14961536 }
14971537
1498- /// <summary>
1499- /// 指数リストボックスの項目描画
1500- /// </summary>
1501- /// <param name="sender"></param>
1502- /// <param name="e"></param>
1503- private void listBoxSpecifiedIndices_DrawItem ( object sender , DrawItemEventArgs e )
1504- {
1505- //背景を描画する
1506- //項目が選択されている時は強調表示される
1507- e . DrawBackground ( ) ;
1508-
1509- var ih = listBoxSpecifiedIndices . ItemHeight ;
1510- var margin = 1 ;
1511-
1512- //ListBoxが空のときにListBoxが選択されるとe.Indexが-1になる
1513- if ( e . Index > - 1 )
1514- {
1515- var row = ( IndexInfo ) ( ( ListBox ) sender ) . Items [ e . Index ] ;
1516- //スポットの色を表示
1517- e . Graphics . FillRectangle ( new SolidBrush ( Color . FromArgb ( row . ARGB ) ) , new Rectangle ( e . Bounds . X + margin , e . Bounds . Y + margin , ih - margin , ih - margin ) ) ;
1518- //文字を描画する色の選択
1519- Brush b = new SolidBrush ( e . ForeColor ) ;
1520-
1521- //文字列の描画
1522- if ( HexagonalLattice && checkBoxUseMillerBravaisIndex . Visible && checkBoxUseMillerBravaisIndex . Checked && radioButtonPlanes . Checked ) //ミラー・ブレイビス指数で表示
1523- {
1524- var ( h , k , l ) = row . Indices [ 0 ] ;
1525- e . Graphics . DrawString ( $ "{ h } { k } { - h - k } { l } ", e . Font , b , new Rectangle ( e . Bounds . X + ih , e . Bounds . Y , e . Bounds . Width - ih , e . Bounds . Height ) ) ;
1526- }
1527- else //通常の表示
1528- e . Graphics . DrawString ( row . ToString ( ) , e . Font , b , new Rectangle ( e . Bounds . X + ih , e . Bounds . Y , e . Bounds . Width - ih , e . Bounds . Height ) ) ;
1529-
1530- //後始末
1531- b . Dispose ( ) ;
1532- }
1533-
1534- //フォーカスを示す四角形を描画
1535- e . DrawFocusRectangle ( ) ;
1536- }
1537-
1538+
15381539
15391540}
0 commit comments