Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 7 of 7

Print Dialog

This is a discussion on Print Dialog within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, the mappoint control got this nice print-dialog if i right-click in the itinerary. How can i call this dialog ...

  1. #1
    jasanite is offline Member Yellow Belt
    Join Date
    Jul 2007
    Posts
    45

    Print Dialog

    Hi,
    the mappoint control got this nice print-dialog if i right-click in the itinerary.

    How can i call this dialog or is there any other way to use it?

  2. #2
    Mattys Consulting's Avatar
    Mattys Consulting is offline Senior Member Black Belt
    Join Date
    Dec 2002
    Posts
    1,040

    Re: Print Dialog

    Have you tried the PrintOut method with geoPrintDirections?

  3. #3
    jasanite is offline Member Yellow Belt
    Join Date
    Jul 2007
    Posts
    45

    Re: Print Dialog

    Yes, but it's just 1 option. In the dialog you can
    customize everything.
    If i use the method i got to write those dialogs
    by myself ... it would be much easier to just use
    the existing dialog in the control.

    Found something with the hidden features but can't
    quite understand it because it is ... confussing,
    no simple code that works, just a few lines.

    If someone wrote it already it would be great to
    post it. thanks

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Print Dialog

    Hi,

    Wy don't you build your own dialog ? It is only a form with a few checkboxes and a few buttons. Adavantage is that it has your personal design !

    Here is some code:

    Code:
    public partial class Print : Form
    {
    private AxMapPoint.AxMappointControl mp;
    public GeoPrintArea area;
    public int quality = 1;
    public int orientation = 1;
    
    public Print(AxMapPoint.AxMappointControl MP)
    {
        InitializeComponent();
        mp = MP;
        ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_Printer");
        foreach (ManagementObject printer in searcher.Get()) {
    	string name = printer["Name"].ToString();
    	selectedPrinter.Items.Add(name);
        }
        if (selectedPrinter.Items.Count > 0)
    	selectedPrinter.SelectedIndex = 0;
        DateTime Now = System.DateTime.Now;
        title.Text = Now.ToLongDateString() + ", " + Now.ToShortTimeString();
        zone_route.Enabled = mp.ActiveMap.ActiveRoute.IsCalculated;
        zone_turn.Enabled = mp.ActiveMap.ActiveRoute.IsCalculated;
        zone_strip.Enabled = mp.ActiveMap.ActiveRoute.IsCalculated;
    }
    
    private void zone_map_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	area = GeoPrintArea.geoPrintMap;
    }
    
    private void zone_route_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	area = GeoPrintArea.geoPrintDirections;
    }
    
    private void zone_turn_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	area = GeoPrintArea.geoPrintTurnByTurn;
    }
    
    private void zone_strip_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	area = GeoPrintArea.geoPrintStripMaps;
    }
    
    private void zone_zone_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	area = GeoPrintArea.geoPrintSelectedArea;
    }
    
    private void zone_selected_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	area = GeoPrintArea.geoPrintHighlightedPlaces;
    }
    
    private void draft_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	quality = 0;
    }
    
    private void normal_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	quality = 1;
    }
    
    private void presentation_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	quality = 2;
    }
    
    private void direction_auto_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	orientation = 0;
    }
    
    private void direction_landscape_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	orientation = 1;
    }
    
    private void direction_portret_CheckedChanged(object sender, EventArgs e)
    {
        RadioButton rb = (RadioButton)sender;
        if (rb.Checked)
    	orientation = 2;
    }
    
    private void OkBtn_Click(object sender, EventArgs e)
    {
        mp.ActivePrinter = selectedPrinter.Items[selectedPrinter.SelectedIndex].ToString();
        mp.ActiveMap.PrintOut("",
    			  title.Text,
    			  (int)copies.Value,
    			  area,
    			  (GeoPrintQuality)quality,
    			  (GeoPrintOrientation)orientation,
    			  collate.Checked,
    			  legend.Checked,
    			  overview.Checked,
    			  faxable.Checked);
    }

  5. #5
    jasanite is offline Member Yellow Belt
    Join Date
    Jul 2007
    Posts
    45

    Re: Print Dialog

    Hi,
    the thing is, when i make my own dialog, the dialog
    in the itinerary is still existing, to me 2 different
    styles are more bad than an old fashioned print
    dialog. Finally understood and could use the
    hidden feature thing in the forum, just one comment
    was useful, here the adjusted code: (c# .net)

    Imports:
    Code:
    [DllImport("user32.dll")]private static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, IntPtr windowTitle);
    [DllImport("user32.dll")]private static extern Boolean PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
    Code:
    Code:
    IntPtr hwnd;
    IntPtr mapPointHwnd;
    hwnd = FindWindowEx(mapPointControl.Handle, IntPtr.Zero, "ATL:100240A0", IntPtr.Zero);
    mapPointHwnd = FindWindowEx(hwnd, IntPtr.Zero, "AfxFrameOrView70", IntPtr.Zero);
    
    //55955 Message for the Print dialog
    //0x0111 = WM_COMMAND
    PostMessage(mapPointHwnd, ((int)0x0111), 55955, 0);
    bear with me

  6. #6
    zzzsethu is offline Junior Member White Belt
    Join Date
    Jun 2008
    Posts
    1

    Re: Print Dialog

    Hi,
    This purticular code works with Mappoint 2009, but when I switched my application to Mappoint 2011, the mappoint printer dialog is not showing up.
    It seems the post message number wParam value 55955 is changed. Any idea how to get the mappoint printer dialog to work with mappoint 2011.
    PostMessage(mapPointHwnd, ((int)0x0111), 55955, 0);
    If anybody got this working it will be really helpful.
    Thanks

  7. #7
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: Print Dialog

    If someone knows how to do this (e.g. find what wParam or message values to pass to various MapPoint functions), perhaps they could also help with the Programming Challenge here?

    What's New at MP2K Magazine
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Re: toolbars in mfc dialog
    By djcapslock in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 06-04-2005, 06:39 AM
  2. Print Dialog!!!!
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-18-2004, 12:18 PM
  3. avoid MP std save dialog??
    By Nostradamus in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 09-08-2004, 10:13 AM
  4. mapbasic dialog
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 06-28-2004, 08:50 AM
  5. Anyone who build a Print-Dialog for Mappoint-Control?
    By Syd in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-18-2003, 08:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96