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
  1. Home
  2. General Programming
  3. C#
  4. I am working on software in that i need to print certain things....... which is the easy way........ kindly help

I am working on software in that i need to print certain things....... which is the easy way........ kindly help

Scheduled Pinned Locked Moved C#
help
12 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A amaankhan

    I am working on software in that i need to print certain things....... which is the easy way........ kindly help

    N Offline
    N Offline
    Not Active
    wrote on last edited by
    #2

    amaankhan wrote:

    which is the easy way

    The easiest way is give us more details. What exactly is "certain things"?


    only two letters away from being an asset

    A 1 Reply Last reply
    0
    • A amaankhan

      I am working on software in that i need to print certain things....... which is the easy way........ kindly help

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #3

      Print to where? To a screen or to a printer? Please read the forum guidelines and rephrase your question.

      Navaneeth How to use google | Ask smart questions

      A 1 Reply Last reply
      0
      • N N a v a n e e t h

        Print to where? To a screen or to a printer? Please read the forum guidelines and rephrase your question.

        Navaneeth How to use google | Ask smart questions

        A Offline
        A Offline
        amaankhan
        wrote on last edited by
        #4

        i have to print the Employee Details on the paper

        F P 2 Replies Last reply
        0
        • N Not Active

          amaankhan wrote:

          which is the easy way

          The easiest way is give us more details. What exactly is "certain things"?


          only two letters away from being an asset

          A Offline
          A Offline
          amaankhan
          wrote on last edited by
          #5

          i want to print Employee Details on the paper ok......my question might be stupid....... sorry i am new to programming field...... with no experience Thanks for reply

          D 1 Reply Last reply
          0
          • A amaankhan

            i want to print Employee Details on the paper ok......my question might be stupid....... sorry i am new to programming field...... with no experience Thanks for reply

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #6

            It's not your ability to program or the fact that the question may be stupid. The problem is your ability to communicate a complete idea so someone can figure out exactly what you're talking about.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008
            But no longer in 2009...

            1 Reply Last reply
            0
            • A amaankhan

              I am working on software in that i need to print certain things....... which is the easy way........ kindly help

              0 Offline
              0 Offline
              0x3c0
              wrote on last edited by
              #7

              Printing on-screen and sending to the printer are very similar. You need to use the System.Drawing namespace, in particular the Graphics class. Then hook a PrintDocument's main event (can't remember the name) and paint onto the page. Don't forget to take the page settings into account. :)

              OSDev

              1 Reply Last reply
              0
              • A amaankhan

                i have to print the Employee Details on the paper

                F Offline
                F Offline
                foxjazzdude
                wrote on last edited by
                #8

                Use a typewriter.

                A R 2 Replies Last reply
                0
                • A amaankhan

                  i have to print the Employee Details on the paper

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #9

                  It sounds like you need to write a report. I'd suggest that you read up on this using Google.

                  "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                  As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                  My blog | My articles | MoXAML PowerToys | Onyx

                  1 Reply Last reply
                  0
                  • F foxjazzdude

                    Use a typewriter.

                    A Offline
                    A Offline
                    Abhishek Sur
                    wrote on last edited by
                    #10

                    ha ha .. .best of all ... :laugh: :laugh:

                    Abhishek Sur


                    My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

                    **Don't forget to click "Good Answer" if you like to.

                    1 Reply Last reply
                    0
                    • F foxjazzdude

                      Use a typewriter.

                      R Offline
                      R Offline
                      rakesh_choudhury
                      wrote on last edited by
                      #11

                      The best answer.

                      1 Reply Last reply
                      0
                      • A amaankhan

                        I am working on software in that i need to print certain things....... which is the easy way........ kindly help

                        C Offline
                        C Offline
                        carlecomm
                        wrote on last edited by
                        #12

                        /****************************************** form web ******************************************/ 1using System; 2 3using System.Text; 4 5using System.Collections; 6 7using System.Collections.Generic; 8 9using System.Drawing; 10 11using System.Drawing.Printing; 12 13using System.Data; 14 15using System.Windows.Forms; 16 17namespace EtaocnCS 18{ 19 public class DataGridViewPrinter 20 { 21 private DataGridView TheDataGridView; // The DataGridView Control which will be printed 22 23 private PrintDocument ThePrintDocument; // The PrintDocument to be used for printing 24 25 private bool IsCenterOnPage; // Determine if the report will be printed in the Top-Center of the page 26 27 private bool IsWithTitle; // Determine if the page contain title text 28 29 private string TheTitleText; // The title text to be printed in each page (if IsWithTitle is set to true) 30 31 private Font TheTitleFont; // The font to be used with the title text (if IsWithTitle is set to true) 32 33 private Color TheTitleColor; // The color to be used with the title text (if IsWithTitle is set to true) 34 35 private bool IsWithPaging; // Determine if paging is used 36 37 static int CurrentRow; // A static parameter that keep track on which Row (in the DataGridView control) that should be printed 38 39 static int PageNumber; 40 41 private int PageWidth; 42 43 private int PageHeight; 44 45 private int LeftMargin; 46 47 private int TopMargin; 48 49 private int RightMargin; 50 51 private int BottomMargin; 52 53 private float CurrentY; // A parameter that keep track on the y coordinate of the page, so the next object to be printed will start from this y coordinate 54 55 private float RowHeaderHeight; 56 57 private List<float> RowsHeight; 58 59 private List<float> ColumnsWidth; 60 61 private float TheDataGridViewWidth; 62 63 64 65 // Maintain a generic list to hold start/stop points for the column printing 66 67 // This will be used for wrapping in situations where the DataGridView will not fit on a single page 68 69 private List<int[]> mColumnPoints; 70 71 private List<float> mColumnPointsWidth; 72 73 private int mColumnPoint; 74 75 76 77 // The class constructor 78 7

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

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