Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Animation Control in MFC Pin
_AnsHUMAN_ 5-Sep-08 2:46
_AnsHUMAN_ 5-Sep-08 2:46 
AnswerRe: Animation Control in MFC Pin
Dhiraj kumar Saini5-Sep-08 3:03
Dhiraj kumar Saini5-Sep-08 3:03 
GeneralRe: Animation Control in MFC Pin
_AnsHUMAN_ 5-Sep-08 2:48
_AnsHUMAN_ 5-Sep-08 2:48 
GeneralRe: Animation Control in MFC Pin
Dhiraj kumar Saini5-Sep-08 3:02
Dhiraj kumar Saini5-Sep-08 3:02 
GeneralRe: Animation Control in MFC Pin
Cedric Moonen5-Sep-08 4:18
Cedric Moonen5-Sep-08 4:18 
AnswerRe: Animation Control in MFC Pin
_AnsHUMAN_ 5-Sep-08 0:10
_AnsHUMAN_ 5-Sep-08 0:10 
QuestionGet width and height in pixel of a paper before printing [modified] Pin
followait4-Sep-08 22:47
followait4-Sep-08 22:47 
AnswerRe: Get width and height in pixel of a paper before printing Pin
king'ori4-Sep-08 23:42
king'ori4-Sep-08 23:42 
hi, you need a to use a standard unit to define the size of ua graphic other than using pixels e.g inches, coz if you use pixels , each printer will come with different aspect ratios of the pixel units, and you cud have a printer whose one inch long on paper , is say 100 pixels while on the screen of your computer it could have been 150 pixels making an inch of your image so you end up having a different image on paper .
this is what i advise you to do. and i give an example of making some cells and they'll print same way thy appear on screean

define 2 variables in the header file of your view call them,

int m_nCellWidth and m_nCellHeight;

Inside the Draw function of your view

put this code.

m_nCellWidth = pDC->GetDeviceCaps(LOGPIXELSX);
m_nCellHeight = pDC->GetDeviceCaps(LOGPIXELSY)/4;

what does this function do before assingning some values in your integers.

the Function GetDeviceCaps(PARAMS) is a member of pDC (screen or printer) and it returns (depending on parameters) the number of pixels of the Devise context that make up one inch of y-axis (if PARAMS are LOGPIXELSY) or x - axis (if PARAMS are LOGPIXELSX);

now you have a unit that is equivalent to a quarter of an inch on y axis (vertical axis) of any printer m_nCellHeight and another m_nCellWidth representing a an inch on x-axis.

it's not a must you divide by 4, to make a quarter inch unit for y-axis, you can still use a full inch, it's olnly that the example i want to give you requires a quarter of an inch unit.

now put this code.

//////////////////////////////////////

int nMyPageHeight = (20 * m_nCellHeight ); // about 20 cells
int nMyPageWidth = (5* m_nCellWidth); // about 5 columns

for (int i=0; i <nmypageheight i="" mode="hold">{
// draw horizantal lines from left to right
pDC->MoveTo(0,i * m_nCellHeight);
pDC->LineTo(nMyPageWidth ,i * m_nCellHeight);


}

for (int j=0; j <nmypagewidth j="" mode="hold">{
// draw vertical lines top of page to bottom
pDC->MoveTo(j *m_nCellWidth ,0);
pDC->LineTo(j *m_nCellWidth ,nMyPageHeight);


}

////////////////////////////////////////////////////

now try to print your image and see what happens.

note that the print function calls the OnDraw() function of the view class and passes pDC, pointer to the printer, so if you call this code in another function other than the draw, make sure you call the Function from the OnDraw() function and pass pDC to it, dont use CClientDC(),
GeneralRe: Get width and height in pixel of a paper before printing Pin
followait5-Sep-08 3:44
followait5-Sep-08 3:44 
QuestionProblem with VC++ editor Pin
S_Murali4-Sep-08 22:42
S_Murali4-Sep-08 22:42 
AnswerRe: Problem with VC++ editor Pin
_AnsHUMAN_ 4-Sep-08 22:46
_AnsHUMAN_ 4-Sep-08 22:46 
AnswerRe: Problem with VC++ editor Pin
Iain Clarke, Warrior Programmer5-Sep-08 1:13
Iain Clarke, Warrior Programmer5-Sep-08 1:13 
GeneralRe: Problem with VC++ editor Pin
S_Murali5-Sep-08 2:39
S_Murali5-Sep-08 2:39 
QuestionDo I have to free the resource returned by CPrintDialog::GetDevMode Pin
followait4-Sep-08 22:35
followait4-Sep-08 22:35 
AnswerRe: Do I have to free the resource returned by CPrintDialog::GetDevMode Pin
_AnsHUMAN_ 4-Sep-08 22:43
_AnsHUMAN_ 4-Sep-08 22:43 
GeneralRe: Do I have to free the resource returned by CPrintDialog::GetDevMode Pin
followait4-Sep-08 22:57
followait4-Sep-08 22:57 
Questioncombine two .exe files [modified] Pin
Vincen Wang4-Sep-08 22:04
Vincen Wang4-Sep-08 22:04 
AnswerRe: combine two .exe files Pin
vikas amin5-Sep-08 6:47
vikas amin5-Sep-08 6:47 
GeneralRe: combine two .exe files Pin
Vincen Wang10-Sep-08 21:02
Vincen Wang10-Sep-08 21:02 
QuestionProblem with mt.exe Pin
T.RATHA KRISHNAN4-Sep-08 21:37
T.RATHA KRISHNAN4-Sep-08 21:37 
AnswerRe: Problem with mt.exe Pin
_AnsHUMAN_ 4-Sep-08 21:54
_AnsHUMAN_ 4-Sep-08 21:54 
Questionhow to get IDC_ control ids dynamically Pin
saksp4-Sep-08 21:17
saksp4-Sep-08 21:17 
AnswerRe: how to get IDC_ control ids dynamically Pin
Naveen4-Sep-08 21:22
Naveen4-Sep-08 21:22 
QuestionCopy File Data Pin
knowvc4-Sep-08 20:53
knowvc4-Sep-08 20:53 
AnswerRe: Copy File Data Pin
Rajesh R Subramanian4-Sep-08 20:55
professionalRajesh R Subramanian4-Sep-08 20:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.