当前位置:网站首页>MFC interface development help document -- BCG how to place controls on the toolbar
MFC interface development help document -- BCG how to place controls on the toolbar
2020-11-10 10:51:00 【FILA6666】
BCGControlBar ("Business Components Gallery ControlBar") yes MFC expanded memory bank , Enables you to create with fully custom options ( Functional area 、 Customizable toolbar 、 Menu, etc ) And a rich set of professional design Microsoft Office and Microsoft Visual Studio Applications for GUI Control , For example, chart 、 The calendar 、 grid 、 Editor 、 Gantt chart and many other controls .
BCGControlBar The library owns 500 Many have been fully designed 、 Tested and fully documented MFC The extension class . Our components can be easily integrated into your application , And save you hundreds of development and debugging time .
This article will show you how to place various controls on the toolbar , Such as combo box or edit box .
for example , You want to create a "Find" Combo box , The combo box appears on the toolbar and contains the most recently used search string . The user will be able to enter a string in the combo box edit control , Then press Enter Key to search for documents , Or press Escape Key to return the focus to the main frame , The document is displayed in CEditView - derived In the view .
The following steps are "setup" Work , Handle the creation of combo box button and the processing of its commands :
1. Open application resources , Will have ID_EDIT_FIND command ID Add a new button to the desired (IDR_MAINFRAME) The toolbar , And create with the same ID New menu items for . Use ID_EDIT_FIND_COMBO command ID Put the new string “ Find the text \ nFind” Add to string table , The ID Will be used as find Combo box button command ID. Be careful ID_EDIT_FIND yes CEditView Standard commands for processing , So you don't need to implement a special handler for this command , But it needs to be for ID_EDIT_FIND_COMBO Command implementation handler .
2. from CBCGPComboBox Class derives a class , We named it CFindComboBox.
3. stay CFindComboBox Class , rewrite PreTranslateMessage Virtual member functions , This will allow you to deal with WM_KEYDOWN News and take appropriate measures . When the user presses the exit key (VK_ESCAPE) when , Returns the focus to the main frame window . When the user presses Enter key (VK_ENTER) when , Will have ID_EDIT_FIND_COMBO command ID Of WM_COMMAND The message is posted to the main frame window ( The command will be routed to the view ).
4. from CBCGPToolbarComboBoxButton Class derives a class , We named it CFindComboButton.
5. CBCGPToolbarComboBoxButton The constructor of takes three parameters : Button command ID、 Button image all and combo box styles , You should ID_EDIT_FIND_COMBO As command ID Pass on , And you can put CImageHash :: GetImageOfCommand And ID_EDIT_FIND Together to get an image index .
6. rewrite CBCGPToolbarComboBoxButton :: CreateCombo Member functions , Here you should create CFindComboBox Object and returns a pointer to it .
7. Use IMPLEMENT_SERIAL Macro makes the combo button durable , The workspace manager will automatically be in Windows The state of the load and save button in the registry .
8. Implement... In your view ID_EDIT_FIND_COMBO The handler , Use a ID_EDIT_FIND_COMBO ID Of CBCGPToolBar::GetCommandButtons You can retrieve all of "Find" Combo box button , Due to customization , It can be with the same command ID Multiple copies of combo box buttons of .
9. Use CBCGPToolBar::IsLastCommandFromButton To determine whether or not sent from our combo box button "Find" command , To do this, find the text and add the search string to the combo box .
You should perform the following steps , take find Put the combo box button on the toolbar :
1. In the main frame window BCGM_RESETTOOLBAR Message handler (OnToolbarReset), Note that when the toolbar is initialized ( When the application starts ), Or when the toolbar is reset during customization , The message is sent from the frame to the main frame window . In either case , All need to use "custom" find The combo box button replaces the standard toolbar button ( See step 2).
2. stay OnToolbarReset In process , Analyze the toolbar ID( It is BCGM_RESETTOOLBAR News WPARAM). encounter IDR_MAINFRAME On the toolbar , Just use ID_EDIT_FIND And for CFindComboButton Object reference calls CBCGPToolBar::ReplaceButton. Note that you can construct... On the stack CFindComboButton object , because ReplaceButton Copy the button object and maintain the copy .
3. If you enable custom , Then realize "customize" The handler (OnViewCustomize) And create CBCGPToolbarCustomize Dialog box , You must use ID_EDIT_FIND And for CFindComboButton Object to call CBCGPToolbarCustomize::ReplaceButton . Note that the custom dialog contains "Commands" List box "Commands" page , Users can drag and drop commands onto the toolbar . By default , The custom dialog handles the application menu and builds a list of standard toolbar buttons for each category . If not used when needed CBCGPToolbarButton - derived Button to replace the standard toolbar button , The extension function provided by the derived object will be lost .
If you are right about BCGSoft We are interested in , You can also consult directly “ Online Service ”!
版权声明
本文为[FILA6666]所创,转载请带上原文链接,感谢
边栏推荐
- What does the mremote variable in servicemanagerproxy refer to?
- [论文阅读笔记] Community-oriented attributed network embedding
- How to use Xdebug for single step debugging
- csdn bug1:待加
- python math类
- File初相识
- csdn bug4:待加
- Q & A and book donation activities of harbor project are in hot progress
- 2020-11-07
- 拼多多版滴滴,花小猪还能“香”多久?
猜你喜欢

Leetcode 5561. Get the maximum value in the generated array

C++ STL容器篇
![[technical course] peerconnection in webrtc self built by visual studio 2017_ The client program reported an external symbol error that LNK2019 could not resolve](/img/3b/00bc81122d330c9d59909994e61027.jpg)
[technical course] peerconnection in webrtc self built by visual studio 2017_ The client program reported an external symbol error that LNK2019 could not resolve

寻找性能更优秀的不可变小字典

MultiBank Group宣布创纪录的财务业绩,2020年前三季度毛利达到9,400万美元

2020-11-07

How to view the establishment of the new retail business department of Alibaba cloud?

Farfetch、阿里巴巴集团和历峰集团结成全球合作伙伴关系,将加速奢侈品行业数字化进程

不用懂代码,会打字就可以建站?1111 元礼包帮你一站配齐!

STATISTICS STATS 380
随机推荐
[paper reading notes] community oriented attributed network embedding
微服务授权应该怎么做?
2020-11-07
网络时间服务器(医院时钟系统)相关问题汇总
ASP.NET Core framework revealed [blog Summary - continuous update]
[operation tutorial] introduction and opening steps of easygbs subscription function of national standard gb28181 protocol security video platform
Custom annotation! Absolutely is the sharp weapon that programmer installs force!!
How to use Xdebug for single step debugging
从大专生到蚂蚁金服CTO,他写下“支付宝”第一行代码:逆风的方向,更适合飞翔!...
One accidentally drew 24 diagrams to analyze the network application layer protocol!
Hystrix 如何解决 ThreadLocal 信息丢失
Api: tiktok: Video Review List
GNU assembly language uses inline assembly to extend ASM
The use of Python PIP command
Summary of basic concepts and common operations of elasticsearch cluster (recommended Collection)
[论文阅读笔记] Community-oriented attributed network embedding
《Python Cookbook 3rd》笔记(2.4):字符串匹配和搜索
【技术教程】Visual Studio 2017自建WebRTC中peerconnection_client程序报LNK2019 无法解析的外部符号错误
带劲!饿了么软件测试python自动化岗位核心面试题出炉,你全程下来会几个?
Collection of blockchain theory [31]