サイズが 16x16、24x24、および 32x32 の 32 ビット イメージを含むアイコンがあります。3 つの異なるサイズの画像を含む 3 つの ImageList オブジェクトを作成し、ユーザーが選択したサイズを指定して、ToolStrip に ImageList プロパティを割り当てます。ただし、ToolStrip オブジェクトに表示される画像はすべて、32x32 の画像を拡大縮小したものです。たとえば、16x16 の ImageList を作成するときに、アイコンから 16x16 の画像が抽出されない理由がわかりません。私のコードは基本的に次のようになります。
ImageList m_imageList16 = new ImageList();
m_imageList16.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
m_imageList16.ImageSize = new System.Drawing.Size(16, 16);
m_imageList16.TransparentColor = System.Drawing.Color.Transparent;
// Open is an icon in my resources that contains various sizes of images.
m_imageList16 .Images.Add(global::MyTestApp.Properties.Resources.Open);
// Later when the user selects the 16 size from a menu, I change the toolbar:
m_toolbar.ImageScalingSize = new Size(16, 16);
m_toolbar.ImageList = m_imageList16;
これは、アイコンで定義された 16x16 の画像を使用するのではなく、アイコンで 32x32 サイズの画像を取得して 16x16 に縮小するだけのようです。誰でもこれを手伝ってもらえますか?ご意見をお寄せいただきありがとうございます。
- スティーブ