The workaround provided by Neville is correct. Another thing that you can
do is to set the ToolBar.ImageList property to null before doing anything
that can cause the native toolbar control to destroy its image list and
then restore the property to the original value when you are done.
Thank you,
Sergiy.
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Reply-To: "Neville Lang" <neville@MAPS_ONnjlsoftware.com>
| From: "Neville Lang" <neville@MAPS_ONnjlsoftware.com>
| References: <
[email protected]>
<uPQN#
[email protected]>
| Subject: Re: .Net Compact Framework for Pocket PC 2003 SE
| Date: Fri, 1 Oct 2004 10:33:29 +1000
| Lines: 94
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: cpe-144-136-29-110.vic.bigpond.net.au 144.136.29.110
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:62364
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
|
| In addition to Peter's link that explains why there is a difference for
SE
| for the ToolBar ImageList, you do need to change your present code
| especially if you have created the ToolBar button image list assignment
| using the Designer, like I did.
|
| In SE, it seems there are a number of things that will break the linkage
| from the ToolBar to the ImageList, after the Designer has set it. Even
| worse, once it is broken, it can never be re-assigned at runtime. This is
| something I picked up on a post in Google. I never actually tested this
| myself but if it is true then maybe the MS team needs to fix this up.
|
| What I did was code around the problem since some of my customers now have
| the Dell Axim X30 that has the Windows Mobile 2003 SE loaded.
|
| Here is how I solved the problem in my app in case it is helpful to you:
|
| i) Using Designer, blank out the ToolBar's ImageList property. This breaks
| this link in the Designer ready for your code.
| ii) Create a new method on your MainForm, an example is shown below.
|
| private void SetToolBar()
| {
| // From my information, this can only be set once per
| // app session. Re-assigning it at runtime does not work
| this.myToolBar.ImageList = this.myImageList;
|
| // The ImageIndexes always need to follow the assignment of the
| ImageList
| this.myToolBarButton1.ImageIndex = 0;
| this.myToolBarButton2.ImageIndex = 1;
| ...
| ...
| }
|
|
| iii) Though the next thing I did is poor code, I intend fixing it up next
| time. In the Windows Form Designer generated code of the MainForm, I
simply
| commented out the ImageIndex assignments that were moved to the above
| method. The reason we know this is poor style is that every time you make
a
| change in the Designer on this form, this code gets refreshed and so you
| will lose the commenting out of the ImageIndex assignments. For the long
| term, it is probably advisable to move all of the ToolBarButton creation
and
| property assignments out of the Designer and into that new method.
|
| iii) Finally, you need to place the call to SetToolBar() at the very end
of
| the MainForm's constructor. That way, it ensures that some of the Form's
| property settings that can break the ImageList assignment are processed
| before the call.
|
|
| After implementing this code change, the ToolBar images in my app now work
| correctly on PPC 2002, WM2003 and WM2003 SE.
|
| Regards,
| Neville Lang
|
|
|
| | > There is an explaination of this behaviour here:-
| >
http://blogs.msdn.com/windowsmobile/archive/2004/08/03/207311.aspx
| > This is a change from previous releases of Pocket PC
| >
| > Peter
| >
| > --
| > Peter Foot
| > Windows Embedded MVP
| >
www.inthehand.com |
www.opennetcf.org
| >
| > Do have an opinion on the effectiveness of Microsoft Windows Mobile and
| > Embedded newsgroups? Let us know!
| >
https://www.windowsembeddedeval.com/community/newsgroups
| >
message
| > | > > Hello,
| > >
| > > Recently, I develop an application using .net compact framework for
| Pocket
| > > PC 2003 SE. However, the image of icon on toolbar cannot be displayed
in
| > > either emulator or physical HW. I tried to change the size and format
of
| > > the
| > > image, but it cannot still be shown. How can I solve this problem?
| > >
| > > Thanks a lot
| > >
| > >
| >
| >
|
|
|