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