Quantcast
Channel: OKWAVE 最新質問(Visual Basic/257)【本日】
Viewing all articles
Browse latest Browse all 7264

ImageListでの例外発生について

$
0
0
VB2005(.Netframwork:ver2.0)のアプリで原因不明の問題にぶち当たっています。 デザイン時にフォームにImageListを貼り付け(ImageList1)、ImageList1にはアイコンとgifファイルを全部で5つ設定しています。 さらに、同じくフォームに貼り付けたTreeViewのImageListプロパティにImageList1を設定しています。 以下がDesigner.vbで自動生成されたコードです。  '  'ImageList1  '  Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)  Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent  Me.ImageList1.Images.SetKeyName(0, "FolderClosed.ico")  Me.ImageList1.Images.SetKeyName(1, "Folder_Black.ico")  Me.ImageList1.Images.SetKeyName(2, "Recipe_NoError.ico")  Me.ImageList1.Images.SetKeyName(3, "Recipe_UnCheck.gif")  Me.ImageList1.Images.SetKeyName(4, "Recipe_Error.gif")  '  'TreeView1  '  Me.TreeView1.ImageList = Me.ImageList1  '(以下省略) このプログラムを実行させると、当然問題なく動くのですが、先日エンドユーザよりフォームの起動時に例外がトラップされた旨の連絡がありました。「インデックス範囲の境界外です」という例外です。 上記の自動生成コードで、Me.ImageList1.Images.SetKeyNameが実行される時に例外が発生したものと思われます。 普通にフォームを起動しても全く再現がとれませんので、おそらく何千回、何万回に1回といった頻度のエラーだと想像していますが、なぜこの様なことが起こってしまうのかが分かりません。どなたかご教授いただけないでしょうか。 以下が問題が起こった時のスタックトレースです。 問題の画面(frmCodeSelect)を初期化する際(InitializeComponent)に問題が起こった様です。 << Error Contents >> Index was outside the bounds of the array. << Stack Trace >> at System.Windows.Forms.ImageList.ImageCollection.SetKeyName(Int32 index, String name) at myApp.frmCodeSelect.InitializeComponent() at myApp.frmCodeSelect..ctor() at myApp.frmMain.btnCodeSelect_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 関係があるかどうかは分かりませんが、エンドユーザのPCの動作環境は以下となります。   OS: Windows7 Professional, 英語   .Netframework: Ver3.5(3.5.30729.4926) CPU: DualCore Intel Celeron 少しでも何か分かることがあれば教えていただけると助かります。 どうぞよろしくお願い致します。

Viewing all articles
Browse latest Browse all 7264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>