Print the toolbar customization issues in preview

Source: Internet
Author: User
Customization issues in the print preview toolbar mainly include:
1. Translation between Chinese and English.
2. Use the icon button to replace the character button.

This article describes the first case and the second case later.

Steps:
1. Generate a cmypreviewview class inherited from the cpreviewview class.
2. Overload two message processing functions: onactivateview () and onupdatenumpagechange ().
In the actual development process, the author thought that as long as the first function is reloaded, the appearance of the numpage (two pages, one page button) button cannot be changed, since onactiveview actually calls the onupdatenumpagechange () function of the cpreviewview class, the onupdatenumpagechange () function of the cpreviewview class resets the appearance of the numpage modification in onactivateview.
3. In order to make the button updated according to the actual situation (when the zoom button is put to the maximum, the zoom button becomes grayed out ).

CorrespondingCode:
1. cmypreviewview: onactivateview (bool bactivate, cview *, cview *)
{
If (bactivate)
{
If (m_ptoolbar)
{
M_ptoolbar-> setdlgitemtext (afx_id_preview_print, _ T ("Print (& P )");
// Set other buttons

}
}
}

 2,  
 void mypreviewview :: onupdatenumpagechange (ccmdui * pcmdui) 

{< br> cpreviewview: onupdatenumpagechange (pcmdui );

uint npages = (m_nzoomstate = zoom_out? M_npages: m_nzoomoutpages );
If (npages = 1 )
pcmdui-> settext (_ T ("two pages (& T )");
else

 pcmdui-> settext (_ T (" one page (& O )"); 

}

3.
void cmypreviewview: ondraw (CDC * PDC)
{< br> cpreviewview: ondraw (PDC);
m_ptoolbar-> postmessage (wm_idleupdatecmdui, (wparam) True );
}< span style = "font-family: sans-serif;">
references:
localizing print preview
http://www.codeproject.com/printing/EbPrintPreviewTest.asp

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.