@@ -144,6 +144,9 @@ private TreeNode CreateNode(Control control, string path, HashSet<Control> visit
144144 /// <summary>子コントロールを再帰的にノードに追加。名前のない中間コンテナは透過的にスキップして子をたどる</summary>
145145 private void AddChildNodes ( Control parent , string parentPath , HashSet < Control > visited , TreeNode parentNode )
146146 {
147+ // if (parent is NumericBox || parent is ColorControl) return; // 旧実装: 複合コントロールの内部 UI も個別ノード化していた
148+ if ( ShouldStopChildTraversal ( parent ) ) return ; // (260323Ch) NumericBox / ColorControl は本体のみキャプチャし、内部 UI は列挙しない
149+
147150 foreach ( Control child in parent . Controls )
148151 {
149152 if ( visited . Contains ( child ) ) continue ;
@@ -155,6 +158,11 @@ private void AddChildNodes(Control parent, string parentPath, HashSet<Control> v
155158 // ノードを作らずに、その子を親ノードに直接追加する
156159 AddChildNodes ( child , parentPath , visited , parentNode ) ;
157160 }
161+ else if ( ShouldSkipStandaloneCapture ( child ) )
162+ {
163+ // (260323Ch) 単体 Label / RadioButton は個別キャプチャ不要のためノード化しない
164+ continue ;
165+ }
158166 else
159167 {
160168 var childPath = $ "{ parentPath } .{ child . Name } ";
@@ -186,11 +194,35 @@ private void AddChildNodes(Control parent, string parentPath, HashSet<Control> v
186194 }
187195 }
188196
189- /// <summary>キャプチャ対象とすべきかの既定判定 (粒度の細かい画像まで総ざらいで保存する方針) </summary>
197+ /// <summary>キャプチャ対象とすべきかの既定判定</summary>
190198 private static bool ShouldCapture ( Control c )
191199 {
192- // 最小サイズ未満のみ除外。それ以外は全て対象とする。
193- return c . Width >= MinCaptureSize && c . Height >= MinCaptureSize ;
200+ // return c.Width >= MinCaptureSize && c.Height >= MinCaptureSize; // 旧実装: 最小サイズ以上はすべて個別キャプチャ対象
201+ return c . Width >= MinCaptureSize
202+ && c . Height >= MinCaptureSize
203+ && ! ShouldSkipStandaloneCapture ( c ) ; // (260323Ch) 単体 Label / RadioButton は既定で除外
204+ }
205+
206+ private static bool ShouldStopChildTraversal ( Control control )
207+ {
208+ // return control is NumericBox || control is ColorControl; // 旧実装: NumericBox / ColorControl のみ子 UI 列挙を止めていた
209+ return control is NumericBox
210+ || control is ColorControl
211+ || control is WaveLengthControl
212+ || control is TrackBarAdvanced
213+ || control is ScalablePictureBox
214+ || control is ScalablePictureBoxAdvanced
215+ || control is GraphControl
216+ || control is DistributionGraphControl
217+ || control is ChemicalFormulaInputControl
218+ || control is CheckedListboxAlpha
219+ || control is SaclaControl
220+ || control is HorizontalAxisUserControl ; // (260323Ch) 優先候補の複合 UserControl も本体のみキャプチャし、内部 UI は列挙しない
221+ }
222+
223+ private static bool ShouldSkipStandaloneCapture ( Control control )
224+ {
225+ return control . GetType ( ) == typeof ( Label ) || control . GetType ( ) == typeof ( RadioButton ) ; // (260323Ch) 単なる Label / RadioButton は個別キャプチャ不要
194226 }
195227
196228 /// <summary>ツリーのチェック連動: 親をチェックすると子もチェック</summary>
@@ -334,7 +366,8 @@ private void buttonCapture_Click(object sender, EventArgs e)
334366 /// <summary>単一コントロールをキャプチャ</summary>
335367 private static void CaptureControl ( Control control , string path , string outputDir , List < Dictionary < string , object > > infoList )
336368 {
337- if ( control . Width < MinCaptureSize || control . Height < MinCaptureSize ) return ;
369+ // if (control.Width < MinCaptureSize || control.Height < MinCaptureSize) return; // 旧実装: サイズだけ見てキャプチャ可否を決めていた
370+ if ( ! ShouldCapture ( control ) ) return ; // (260323Ch) ツリー外の Label / RadioButton が直接渡されても個別キャプチャしない
338371
339372 // 260323Cl: コントロールが TabPage の子孫なら、そのタブを選択して前面に出す
340373 EnsureAncestorTabsSelected ( control ) ;
0 commit comments