I am having an odd problem, and can't find the solution for it. I am trying
to customize the Print Dialog (not for a Doc/View printing). The problem is
the Icon image to the left of collate is not displaying correctly. The
CStatic is not resizing to show the entire image for some reason!
Here is the dialog template:
IDD_PRINTDLGORD DIALOGEX 32, 32, 288, 229
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CONTEXTHELP | WS_POPUP |
WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Print"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
GROUPBOX "Printer",1075,8,4,272,84,WS_GROUP
LTEXT "&Name:",1093,16,20,36,8
COMBOBOX 1139,52,18,152,152,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Properties",1025,212,17,60,14,WS_GROUP
LTEXT "Status:",1095,16,36,36,10,SS_NOPREFIX
CONTROL "",1099,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX |
WS_GROUP,52,36,224,10
LTEXT "Type:",1094,16,48,36,10,SS_NOPREFIX
CONTROL "",1098,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX |
WS_GROUP,52,48,224,10
LTEXT "Where:",1097,16,60,36,10,SS_NOPREFIX
CONTROL "",1101,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX |
WS_GROUP,52,60,224,10
LTEXT "Comment:",1096,16,72,36,10,SS_NOPREFIX
CONTROL "",1100,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX |
WS_GROUP,52,72,152,10
CONTROL "Print to fi&le",1040,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,212,70,64,12
GROUPBOX "Print range",1072,8,92,144,64,WS_GROUP
CONTROL "&All",1056,"Button",BS_AUTORADIOBUTTON | WS_GROUP |
WS_TABSTOP,16,106,64,12
CONTROL "Pa&ges",1058,"Button",BS_AUTORADIOBUTTON,16,122,36,12
CONTROL "&Selection",1057,"Button",BS_AUTORADIOBUTTON,16,138,64,
12
RTEXT "&from:",1089,52,124,20,8
EDITTEXT 1152,74,122,26,12,ES_NUMBER | WS_GROUP
RTEXT "&to:",1090,100,124,16,8
EDITTEXT 1153,118,122,26,12,ES_NUMBER | WS_GROUP
GROUPBOX "Copies",1073,160,92,120,64,WS_GROUP
LTEXT "Number of &copies:",1092,168,108,68,8
EDITTEXT 1154,240,106,32,12,ES_NUMBER | WS_GROUP
ICON "",1086,162,124,21,20,SS_CENTERIMAGE | WS_GROUP
CONTROL "C&ollate",1041,"Button",BS_AUTOCHECKBOX | WS_GROUP |
WS_TABSTOP,240,130,36,12
DEFPUSHBUTTON "OK",IDOK,196,171,48,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,196,193,48,14
END
Here is the constructor of my print dialog
LSPrintDialog::LSPrintDialog(BOOL bPrintSetupOnly, DWORD dwFlags,CWnd*
pParentWnd /*= NULL */)
: CPrintDialog(bPrintSetupOnly,dwFlags,pParentWnd)
{
m_pd.lpPrintTemplateName = (LPTSTR) MAKEINTRESOURCE(IDD);
m_pd.Flags |= PD_ENABLEPRINTTEMPLATE;
m_pd.hInstance = AfxGetInstanceHandle();
AfxGetApp()->GetPrinterDeviceDefaults(&m_pd);
}
Any ideas?
AliR.
Seems like when I did this, I had to make sure it was big enough in the
designer.
--
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm
"AliR" <Al...@online.nospam> wrote in message
news:4449543b$0$14951$a826...@reader.corenews.com...
AliR.
"Jonathan Wood" <jw...@softcircuits.com> wrote in message
news:un24ZglZ...@TK2MSFTNGP05.phx.gbl...
Based on my understanding, you have a custom print dialog for your MFC
application, its picture control couldn't display the whole image in the
runtime. Please let me know if I have misunderstood anything.
According to your description, the picture static control is not resizable
in the design-time, but it can display the whole icon image in the
designer. Would you please provide a screen-shot to illustrate the run-time
problem?
Thanks for your understanding!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Thanks for the response!
Based on that screenshot, the problem is the image's type--icon. All icon
images' shape format should be square, in your custom print dialog, its
size appears to be 48x48, I think this is an expected behavior for an icon
image.
In this regards, I suggest you don't use the icon type for that image, it
will fix this problem.
Thanks!
My extended CPrintDialog works exactly as it should in a Doc/View type
application (when I setup the new Template id of the CPrintDialog in
OnPreparePrinting method). But does not if I do that in the constructor of
my print dialog
This is all the code for my print dialog.
#pragma once
// LSPrintDialog dialog
class LSPrintDialog : public CPrintDialog
{
DECLARE_DYNAMIC(LSPrintDialog)
public:
LSPrintDialog(BOOL bPrintSetupOnly,
DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES |
PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_NOSELECTION,
CWnd* pParentWnd = NULL ); // standard constructor
virtual ~LSPrintDialog();
// Dialog Data
enum { IDD = IDD_PRINTDLGORD };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
BOOL m_PrintClues;
BOOL m_PrintFact;
BOOL m_PrintStatements;
};
////////////////////////////////////////////////////////////////
// LSPrintDialog.cpp : implementation file
//
#include "stdafx.h"
#include "LSEditor.h"
#include "LSPrintDialog.h"
// LSPrintDialog dialog
IMPLEMENT_DYNAMIC(LSPrintDialog, CPrintDialog)
LSPrintDialog::LSPrintDialog(BOOL bPrintSetupOnly,
DWORD dwFlags /*= PD_ALLPAGES |
PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_NOSELECTION*/,
CWnd* pParentWnd /*= NULL */)
: CPrintDialog(bPrintSetupOnly,dwFlags,pParentWnd)
, m_PrintClues(FALSE)
, m_PrintFact(FALSE)
, m_PrintStatements(FALSE)
{
m_pd.nMinPage = 1 ;
m_pd.nMaxPage = 0xffff ;
m_pd.hInstance = AfxGetInstanceHandle() ;
m_pd.lpPrintTemplateName = MAKEINTRESOURCE(IDD) ;
m_pd.Flags |= PD_ENABLEPRINTTEMPLATE ;
AfxGetApp()->GetPrinterDeviceDefaults(&m_pd);
}
LSPrintDialog::~LSPrintDialog()
{
}
void LSPrintDialog::DoDataExchange(CDataExchange* pDX)
{
CPrintDialog::DoDataExchange(pDX);
DDX_Check(pDX, IDC_CLUES, m_PrintClues);
DDX_Check(pDX, IDC_FACT, m_PrintFact);
DDX_Check(pDX, IDC_STANDARDS, m_PrintStatements);
}
BEGIN_MESSAGE_MAP(LSPrintDialog, CPrintDialog)
END_MESSAGE_MAP()
// LSPrintDialog message handlers
AliR.
""Gary Chang[MSFT]"" <v-ga...@online.microsoft.com> wrote in message
news:TZ9DSGPa...@TK2MSFTNGXA01.phx.gbl...
I got it. Since you cannot resize the picture control in the designer, have
you tried to edit that control's size in the resource file(.rc) directly?