Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
E

Eversman

@Eversman
About
Posts
26
Topics
14
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Help with Printing
    E Eversman

    Well, I am using this example that I found in the printing section. This is what the tutorial has it as. CRect rect; rect.left = (JRECT.Width() - size.cx)/2; rect.right = rect.left + size.cx; rect.top = (JRECT.Height() - size.cy)/2; rect.bottom = rect.top + size.cy; JDC.DrawText(str, &rect, DT_SINGLELINE); so I kinda modified it to fit what I already had. No where in the example that I see is that stuff initialized. But I need to initialize it to the printer page resolution right? So would I have to initialize it to HORZRES and VERTRES?

    C / C++ / MFC help question

  • Help with Printing
    E Eversman

    Well it doesn't print, it prints the old stuff that I had hard coded in, but when I change it to the new way I just showed, it doesn't print, well maybe it does but it would be off the page when it printed. I am not sure if I am using the GetDeviceCaps and that such correctly.

    C / C++ / MFC help question

  • Help with Printing
    E Eversman

    Hey all, I need a little help with printing. I have it all ready to print and it print fines, but I coded it stupidly. I hard coded the coordinates of where the text is printed, so it only prints correctly on certain printers, on others it prints all messed up. So now I am trying to change it so that it works right with all printers. This is what I have done so far. CPrintDialog dlg(FALSE); CDC dc; #if 0 if (dlg.DoModal() == IDCANCEL) return; dc.Attach(dlg.GetPrinterDC()); #else PRINTDLG prtDlg; AfxGetApp()->GetPrinterDeviceDefaults(&prtDlg); dlg.m_pd.hDevMode = prtDlg.hDevMode; dlg.m_pd.hDevNames = prtDlg.hDevNames; dc.Attach(dlg.CreatePrinterDC()); #endif dc.m_bPrinting = TRUE; CRect printArea; printArea.SetRect(printArea.left/2, printArea.top/2, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); CString str("Delayed Entry"); dc.DrawText(str, printArea, DT_NOPREFIX | DT_WORDBREAK); When I try that out it compiles fine, but when I print it it doesn't work, can anyone help me out here? Thanks

    C / C++ / MFC help question

  • Getting Page Size and then Printing Text.
    E Eversman

    Hey all, I am trying to get the page size of the page and then printing certain words on the page. This is what I have so far. //// Create a printer DC CPrintDialog dlg(FALSE); CDC dc; #if 0 //Show print dialog. if (dlg.DoModal() == IDCANCEL) return; dc.Attach(dlg.GetPrinterDC()); #else //Don't show print dialog. PRINTDLG prtDlg; AfxGetApp()->GetPrinterDeviceDefaults(&prtDlg); //Should check for error. dlg.m_pd.hDevMode = prtDlg.hDevMode; dlg.m_pd.hDevNames = prtDlg.hDevNames; dc.Attach(dlg.CreatePrinterDC()); #endif dc.m_bPrinting = TRUE; //// Now use the DC. //Get the page size. dc.GetDeviceCaps(LOGPIXELSX/LOGPIXELSY); CRect printArea; printArea.SetRect(LOGPIXELSX/3, LOGPIXELSY/3, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); CString str("Delayed Entry"); dc.DrawText(str, printArea, DT_NOPREFIX | DT_WORDBREAK); It is printing, but not where I need it to print. Am I doing it wrong or is there something I am missing? Thanks

    C / C++ / MFC help question

  • Printing on a laser printer
    E Eversman

    Hey, When I print on a normal Printer, all the text prints fine, but when I have it print on a Laser Printer, all the text gets squahsed together, and text is wirrten over other text, it is a whole mess. Anyone know why it is doing it? Here is the code. //// Create a printer DC CPrintDialog dlg(FALSE); CDC dc; #if 0 //Show print dialog. if (dlg.DoModal() == IDCANCEL) return; dc.Attach(dlg.GetPrinterDC()); #else //Don't show print dialog. PRINTDLG prtDlg; AfxGetApp()->GetPrinterDeviceDefaults(&prtDlg); //Should check for error. dlg.m_pd.hDevMode = prtDlg.hDevMode; dlg.m_pd.hDevNames = prtDlg.hDevNames; dc.Attach(dlg.CreatePrinterDC()); #endif dc.m_bPrinting = TRUE; //// Now use the DC. //Get the page size. CRect printArea; CRect printArea1; CRect printArea2; CRect printArea3; CRect printArea4; CRect printArea5; CRect printArea6; CRect printArea7; printArea.SetRect(500, 0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); //Start printing. printArea1.SetRect(700, 1500, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); //Start printing printArea2.SetRect(750, 1750, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); //Start printing printArea3.SetRect(1250, 1750, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); //Start printing printArea4.SetRect(750, 1825, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); //Start printing printArea5.SetRect(1250, 1825, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); //Start printing printArea6.SetRect(325, 250, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); //Start printing printArea7.SetRect(750, 500, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); //Start printing DOCINFO docinfo; memset(&docinfo, 0, sizeof(docinfo)); docinfo.cbSize = sizeof(docinfo); docinfo.lpszDocName = _T("Edit Control Print"); dc.StartDoc(&docinfo); //Should check for error. dc.StartPage(); //Should check for error. //Draw the edit control contents. /////////////////////////// CFont font; font.CreatePointFont(480, "Arial", &dc); CFont font1; font1.CreatePointFont(280, "Arial", &dc); CString str("Text Text Text"); CString str1; CString str2("Test"); CString str3("Test"); CString str4; CString str5; CString str6("Test"); CString str7("Test"); CSize size = dc.GetTextExt

    C / C++ / MFC help question

  • the Clear() function
    E Eversman

    Thanks guys that worked. How about an editbox, that is ready only, and it displays the text of a combo box, I tried the clear() function there too, but it doesn't work. Any ideas? Thanks

    C / C++ / MFC question help

  • the Clear() function
    E Eversman

    Hey, I have a couple of combo boxes, and When they hit new in the menu, I want it to clear, but when I use the m_varible.clear() command, it only clears the one I have highlighted or the last one I selected. How do I get it to clear all of them? Here is the code: void CDEPDlg::OnFileNew() { // TODO: Add your command handler code here m_type1.Clear(); m_type2.Clear(); m_type3.Clear(); m_type4.Clear(); m_type5.Clear(); } Thanks for any help

    C / C++ / MFC question help

  • Changing Size Font and Vertical Scroll Bar
    E Eversman

    Hey all, I got 2 questions. 1st one is how do you change the size of a CString? I have tired and I couldn't get it, here is what I have tried. CFont font; font.CreatePointFont(480, "Arial", &dc); CString str("DEP"); CSize size = dc.GetTextExtent(str); dc.DrawText(str, printArea, DT_NOPREFIX | DT_WORDBREAK); 2nd question is how do you get a Veritcal Scroll Bar to work? I know how to add it to a Dialog, but can't get it to scroll. Thanks for the help

    C / C++ / MFC question help tutorial

  • Getting Text from Seperate Dialog
    E Eversman

    Hey, I am trying to get text from a combo box in a different dialog, and how I did it I get an error. Here is how I did it. CDialog1::m_minCHO.GetWindowText(sText196); CDialog1 is the class, and the m_minCHO is the control combo box variable. Here is the error C:\DEP\DEPDlg.cpp(18122) : error C2228: left of '.GetWindowTextA' must have class/struct/union type Any help would be great thanks

    C / C++ / MFC help c++

  • Printing text from combo and edit box
    E Eversman

    Hey, I am using the "Printing without the Document/View Framework" tutorial, and I was wondering if anyone knows how to print text from edit and combo boxes in a nice grid type layout. Thanks for the help

    C / C++ / MFC tutorial css help

  • User created menu, using New Selection.
    E Eversman

    Hey, Got another question about Menus, I have the menu and it works fine, but I created a New function, and I know in Non Dialog based options it has it done for you already, in Dialog ones, how do you have it reload the program so it is new, after clicking on the new option ni the menu. Thanks

    C / C++ / MFC question

  • Menu Controls
    E Eversman

    Hey, I have this menu, and I have the options to subtract a certain number from a value selected from a combo box which is displayed in an edit box, and when you select the subtract function, depending on which one you use, it is to subtract that amount from the edit box variable. Here is the code for them. void CDEPDlg::OnOptionsAltertimeTotalcyclingSubtract10minutes() { // TODO: Add your command handler code here if(totalcycling<=0) { totalcycling-=10; } } that is jsut one of the options, I figure that if I can get one working I can get the others working too. The question is, It is not subtractiong the amount, how can I get it to subtract the amount? Any help would be great. Thanks

    C / C++ / MFC question help

  • MFC and Menus
    E Eversman

    ok, so i create a menu, go to the class wizard and it asks me to make a new class, so lets say i name it DEPMenu, I then go to the init function of the dialog and type SetMenu(?); the ? means what exactly goes inside of it?

    C / C++ / MFC c++ tutorial question

  • MFC and Menus
    E Eversman

    Could you perhaps eleborate on the SetMenu() function a bit?

    C / C++ / MFC c++ tutorial question

  • Combo Boxes and numbers
    E Eversman

    Hey, got another question. I hace a combo box and an edit box, and in the combo box, there is options for time, 10 mins, 20 mins etc etc. And when you click on them, it adds it to the edit box and keesp track of the total, remeber there are 7, so you choose 7 values and it adds it up, but if you hit the wrong value and change to the other one it adds both values to the edit box, and you can't change it back without restarting the program. int cur = m_type2.GetCurSel (); CString text; m_type2.GetLBText (cur, text); int cur1 = m_dur2.GetCurSel (); CString text1; m_dur2.GetLBText (cur1, text1); if (text1 == "10 Minutes") { if (text == "Swimming #1" ) { totalswim+=10; totalrun+=0; totalcycling+=0; totalstrength+=0; } else if (text == "Run #1" ) { totalrun+=10; totalswim+=0; totalcycling+=0; totalstrength+=0; } else if (text == "Cycling #1" ) { totalcycling+=10; totalrun+=0; totalswim+=0; totalstrength+=0; } else if (text == "Strength #1" ) { totalcycling+=0; totalrun+=0; totalswim+=0; totalstrength+=10; } else if (text == "Stretching #1" ) { totalswim+=0; totalrun+=0; totalcycling+=0; totalstrength+=0; } Hours(); } void CDEPDlg::Hours() { CString str; str.Format(TEXT("%i"),totalswim); m_swimtime.SetWindowText (str); CString str1; str1.Format(TEXT("%i"),totalrun); m_runtime.SetWindowText (str1); CString str2; str2.Format(TEXT("%i"),totalcycling); m_cyclingtime.SetWindowText (str2); CString str3; str3.Format(TEXT("%i"),totalstrength); m_strengthtime.SetWindowText (str3); } That is the code for it, if you have any ideas of how to have it to waht I need it to do, please post, becasue I am out of ideas and don't really know how else to do it. Thanks

    C / C++ / MFC tutorial question

  • MFC and Menus
    E Eversman

    Hey, I am trying to get my menu that I created to show up on a dialog box. I can do it on the document based ones, but that was a long time ago, and can't remember how to do it. Does anyone have any tutorials on how to create a basic menu? I have found some tuts with many advanced features and don't need all that stuff. Thanks

    C / C++ / MFC c++ tutorial question

  • Combo Boxes and Vars
    E Eversman

    heh no, i was wondering how do you get the value in the combo box to be displayed in the edi box? I know how to get strings in there, but doing it the same way using ints, it doesn't work

    C / C++ / MFC help question

  • Combo Boxes and Vars
    E Eversman

    Hey, Got a question for you guys. I have 7 combo boxes. All with time duration options in them, like 10 mins, 20 mins etc etc. Then I have an edit box that is to display the total of the values selected from the 7 combo boxes. Here is the code I have so far. void CDEPDlg::OnCloseupCombo15() { // TODO: Add your control notification handler code here int totalswim=0; int cur1 = m_dur1.GetCurSel (); CString text1; m_dur1.GetLBText (cur1, text1); if (text1 == "10 Minutes") { totalswim=+10; m_swimtime=totalswim; } } m_dur1 is the 1st combo box, m_dir2 is the second etc etc. m_swimtime is an int var of the edit box. Thanks for any help

    C / C++ / MFC help question

  • Combo Box and Edit Box
    E Eversman

    Good to go, thanks buddy

    C / C++ / MFC c++ help

  • Combo Box and Edit Box
    E Eversman

    Thanks for your help. I tried that and I still have to do it twice to get it to show up. Any more ideas?

    C / C++ / MFC c++ help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups