To disable CMFCRibbonApplicationButton click and double-click events

Source: Internet
Author: User
<span id="Label3"></p><p><p><strong>in order to disable CMFCRibbonApplicationButton click and double-click Events</strong> , I overloaded the CMFCRibbonApplicationButton as Follows:</p></p><p><p>1. MyRibbonApplicationButton.h file Contents:</p></p><p><p>#pragma once</p></p><p><p>Class Cmyribbonapplicationbutton:<br>Public CMFCRibbonApplicationButton<br>{<br>Public<br>Cmyribbonapplicationbutton ();<br>~cmyribbonapplicationbutton ();</p></p><p><p>Protected<br>virtual void OnLButtonDown (CPoint point);<br>virtual void OnLButtonDblClk (CPoint point);<br>};</p></p><p><p></p></p><p><p>2. MyRibbonApplicationButton.cpp file Contents:</p></p><p><p></p></p><p><p>#include "stdafx.h"<br>#include "MyRibbonApplicationButton.h"</p></p><p><p><br>Cmyribbonapplicationbutton::cmyribbonapplicationbutton ()<br>{<br>}</p></p><p><p>Cmyribbonapplicationbutton::~cmyribbonapplicationbutton ()<br>//{<br>//}</p></p><p><p>Cmyribbonapplicationbutton member functions<br>void Cmyribbonapplicationbutton::onlbuttondblclk (CPoint Point)<br>{<br>Return<br>}</p></p><p><p>void Cmyribbonapplicationbutton::onlbuttondown (CPoint Point)<br>{<br>Return<br>}</p></p><p><p></p></p><p><p>3.</p></p><p><p>Found in the OnCreate function in CMainFrame</p></p><p><p>M_wndribbonbar.loadfromresource (idr_ribbon);</p></p><p><p>In this line, add the following</p></p><p><p>cmfcribbonapplicationbutton* Pmainbutton = M_wndribbonbar.getapplicationbutton ();<br>Delete pmainbutton; Delete Frame auto-generated Ribbonapplicationbutton</p></p><p><p>cmyribbonapplicationbutton* Pmymainbutton = new Cmyribbonapplicationbutton ();<br>Pmymainbutton->setimage (idb_main);<br>M_wndribbonbar.setapplicationbutton (pmymainbutton, CSize (45, 45));</p></p><p><p><span style="font-size: 14px; line-height: 1.5;">You can do it.</span></p></p><p><p>To disable CMFCRibbonApplicationButton click and double-click events</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.