Had a question about the menustrip

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kool-Aide

    Had a question about the menustrip

    Alright, here goes...When I put a menu strip on the windows form I can
    double click the exit button to go to the source page and it takes me to the
    on click exit blah blah blah and you would put Application.Exi t(); Alright
    well what would I put for the print preview and the print and Save and
    saveas and open and new? I can't find anything for these. I am new at this
    and I am sure I am not going in the correct order to learn this stuff but I
    like jumping around and learning things before I should. Anyways can anybody
    help me out? I hope everybody could understand that correctly.



  • Michael C

    #2
    [Multipost]



    Comment

    • Peter Duniho

      #3
      Re: Had a question about the menustrip

      On Tue, 22 May 2007 21:18:38 -0700, Kool-Aide <koolaide187@gm ail.com>
      wrote:
      Alright, here goes...When I put a menu strip on the windows form I can
      double click the exit button to go to the source page and it takes me to
      the on click exit blah blah blah and you would put Application.Exi t();
      Alright well what would I put for the print preview and the print and
      Save
      and saveas and open and new? I can't find anything for these.
      Exiting an application is easy, as you've found. With a single call to a
      single method, you can convey to .NET what it is you want to do.

      But all that other stuff? You can't save unless .NET knows what to save.
      Likewise print and print preview.

      The short answer for saving is that you need to figure out what data you
      need to save in your application, and how you want to store it on the
      disk. You also need to decide whether you want to use the built-in
      serialization mechanisms or implement the whole thing yourself.
      Fortunately, both are relatively simple in most cases. But you do need to
      learn about things like serialization and file i/o.

      The short answer for printing and print preview is that first you need an
      idea of what you want your data to look like when printed. If all you
      want is to print a copy of your form, it could be as simple as just using
      the Control.DrawToB itmap() method to create an in-memory copy of the form,
      and then using the Graphics.DrawIm age() method to actually draw that to
      the Graphics instance you get from the printing API. If you want the
      print-out of your data to look different than that, then you need to learn
      more about the Graphics class. At a minimum it's likely you'll want to
      look at DrawString(), and you may find the other "Draw..." and "Fill..."
      methods useful as well.

      Once you know how you're going to draw things for your printing, you need
      to learn about the System.Drawing. Printing namespace, which includes
      things like the PrintDialog class (for displaying a print dialog), the
      PrintDocument class (for defining how a document will be printed...it's
      important to note that this class is not a document itself, it's just the
      class used to print documents), and the various properties, methods, and
      events associated with those classes (most importantly, the
      PrintDocument.P rint() method and the PrintDocument.P rintPage event).

      I recommend that when you start trying to learn about printing, you make
      sure you have some sort of virtual print driver installed. You can get
      printer drivers that create PDF files, or if you have Microsoft Office it
      comes with a printer driver that will create TIFF files. Doing your
      printing to some kind of electronic image format will save you a lot of
      paper as you figure things out. :)

      Once you've got printing working, you can look at the PrintPreviewDia log
      and PrintPreviewCon trol classes, which will allow you to reuse your
      existing print functionality in a way that displays it on-screen instead
      of sending the output to a printer.

      Note that the printing functionality is probably one of the most
      complicated things you'll run into at the moment. .NET makes it quite a
      bit simpler than trying to do it under the native Windows API (mainly
      because .NET has a well-defined callback mechanism via events that all
      ..NET programmers are already familiar with, whereas the similar mechanism
      in Windows is not something even all Windows programmers run into), but
      there are still lots of little things unique to printing that come up.
      But the basic concepts aren't too hard.
      I am new at this
      and I am sure I am not going in the correct order to learn this stuff
      but I like jumping around and learning things before I should. Anyways
      can anybody help me out? I hope everybody could understand that
      correctly.
      Jump around if you like. Just recognize that it may take longer that
      way. :)

      For what it's worth, I'd recommend learning how to implement your document
      type in your application, whatever that may be, before you move on to the
      other stuff. Once you know how your internal document data structures are
      going to look, you can do a better job thinking about how the data will
      look when it's on some streaming storage (for example, written to a file
      on a disk).

      You may be able to implement a full-functional document using only the
      built-in .NET controls. And if you do so, you can even limit yourself to
      just printing the form as it appears on the screen. However, eventually
      you're going to want to go beyond that, and for that you need to know how
      the Graphics class works. I'd recommend that you learn how to use the
      Paint event in a custom control to draw your own graphics to the screen
      before getting into the printing stuff. For one, the PrintPage event
      works in a manner very similar to the Paint event for forms. So if you've
      already figured out how to deal with the Paint event, it's an easy
      transition to write a handler for the PrintPage event. And of course,
      learning the various Graphics class members required to draw custom
      graphics to the screen will prepare you well for drawing to the Graphics
      instance that the PrintPage event gives you.

      So there's your syllabus. Go for it. :)

      Pete

      >
      >
      >

      Comment

      Working...