Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
告知
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 ディスカッション

Toolbar Bitmaps on Menus

dannycat
新規コントリビューター I
1,503件の閲覧回数
Can anyone help me on the following?
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.

Any help with this will be appreciated.
0 件の賞賛
6 返答(返信)
Paul_Curtis
高評価コントリビューター I
1,503件の閲覧回数
Quoting - dannycat
Can anyone help me on the following?
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.

Any help with this will be appreciated.

I have not done this with toolbars, but it's very easy to load a dialog button with a bitmap:

hbitmap_start = LoadImageID (ghInstance, IDB_STARTRUN, IMAGE_BITMAP, 0,0,0)
hwndControl = GetDlgItem (hwnd, IDC_STARTRUN)
rval = SendMessage (hwndControl, BM_SETIMAGE, IMAGE_BITMAP, hbitmap_start)

wherein IDB_ is a bitmap created in the resource editor and IDC_ is the id of the corresponding button in the dialog. The above code would be placed under WM_INITDIALOG in your proc's (ie, hwnd in the above) message handler. Also, be sure to invoke DeleteObject (hbitmap_start) when the dialog exits.

If ButtonMessage (BM_) does not work for you as shown, the solution will surely look very similar; check MSDN for toolbar functions.



onkelhotte
新規コントリビューター II
1,503件の閲覧回数
Quoting - dannycat
Can anyone help me on the following?
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.

Any help with this will be appreciated.

Do you mean these icon next to "Save" or "Print"?






These are .NET components. I dont think, that you can use this IVF. When someone does know, how this can be done, please let us know :-)

Markus
Jugoslav_Dujic
高評価コントリビューター II
1,503件の閲覧回数
Quoting - dannycat
Can anyone help me on the following?
I have written an Windows application in fortranthat contains amenu and toolbars thatare use toactivate a series of commands. I have noticed that in several commercial Windows applications that the toolbar button imagesare displayed next to menu items thatrelate to the same command. This is a useful hint for users and I wondered if there a way to displaya toolbar buttonbitmap next toa menu item in afortran Windows applications? I assume the answer is yes, but have not found any documentation on how to do this.

Any help with this will be appreciated.

There is SetMenuItemBitmaps API, but it's only half-useful. Namely, Windows has a peculiar "idea" how to combine the bitmap colors with the menu (white in the .bmp gets gray in the actual image, and so on IIRC), so the end result is not particularly aesthetically pleasing (MSDN says that monochrome bitmaps should be used, but it works with 16 colors). See the attachment for an example (12x12 bitmaps are used, but I don't recall what happens with bigger ones).

The next best thing is to use owner-drawn menus and draw it all by yourself (both the text and bitmaps/icons). It's not particularly difficult to get in a first iteration, but the devil can be in the details, such as underlining Mnemonics, displaying very long strings, and getting it right in with Vista/XP themes... Google "owner-drawn menus" and you'll get several good tutorials.
dannycat
新規コントリビューター I
1,503件の閲覧回数
Follow Juguslav's suggestion, I had located some useful looking code at the following location.
http://www.rocscience.com/~corkum/bcmenu.html

This seems to cover what I'm looking for but unfortunately it is written in the form of the C++ object for use with MFC applications. I'm not at all familiar with these concepts so forgive me if I'm asking dumb questions,but here goes:-

1) Cansuch C++ objects be used directly from a fortran windows program? If so how? In general

2) Alternatively can the code be rewritten to be usable in non-object form?

The reason I ask is that the main object "bcmenu.cpp, bcmenu.h" contains a vast amount of code and it would make sense not to rewrite it all again in fortranwith probabilty of introducingbugs etc. Looks a bit daunting for non C++ progammer.
anthonyrichards
新規コントリビューター III
1,503件の閲覧回数
I have not used this, but.....
you could try using the API function GetMenuItemInfo, which populates a MENUITEMINFO structure for the menuitem, one component of which, FTYPE, when set to MFT_BITMAP,is a flaglets yousignal thatthe menu item should be displayed using a bitmap whose handle is then supplied in another component, DWTYPEDATA. By providing a modified MENUINFOstructure formed by setting FTYPE to MFT_BITMAP, and changing the DWTYPEDATA to point to a bitmap of your choice, you maybe able tochange the handle to a bitmap of your choice by using SetMenuItemInfo along with a pointer to the now-modified MENUITEMINFO Structure. This should then ensure that the menu item is drawn to your own specification. Note that MENUITEMINFO structure also allows you to specify bitmaps to provide your own checked/unchecked marks for each menu item.
Jugoslav_Dujic
高評価コントリビューター II
1,503件の閲覧回数
I also found this lengthy MSDN article, but it doesn't make it much simpler.

I find it rather bizarre that they made the menu item icons/bitmaps a de facto standard part of the Windows visual style, but they haven't provided a simple API to attach them. Sigh...
返信