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. .NET (Core and Framework)
  4. Datagridview not changing size when changed from landscape to porttrait?

Datagridview not changing size when changed from landscape to porttrait?

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpdebuggingquestionworkspace
7 Posts 3 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.
  • C Offline
    C Offline
    Curtis Underwood
    wrote on last edited by
    #1

    I have a application setup as Spreadsheet to display and print a datagridview. My problem is if I start the application, load a file, change the pagesetup to landscape, then print either to printer or preview it will print correctly. Now if I change back to portrait the preview or print out does change to the new setting. The displayed or printed data does not resize. The data is printed of the page. This works both ways if I start with portrait the same thing happens except the data in landscape is small on the page. Below is the code I use for printing and datagridview. I have tried several things including refresh and invalidate but nothing has had an affect. The only way I have found to change is to stop and restart the application in debug. <pre> Private Sub PrintDocument_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintDocument.Click PrintDialog1.AllowSomePages = True ' Show the help button. PrintDialog1.ShowHelp = True PrintDialog1.Document = PrintDocument1 Dim result As DialogResult = PrintDialog1.ShowDialog() ' If the result is OK then print the document. If (result = DialogResult.OK) Then PrintDocument1.Print() End If End Sub Private Sub PrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreview.Click Me.Refresh() DataGridView1.RefreshEdit() Dim dlg As New PrintPreviewDialog() Dim d dlg.Document = PrintDocument1 d = PrintDocument1.DefaultPageSettings PrintDocument.Invalidate() dlg.ShowDialog() End Sub Private Sub PageSetup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PageSetup.Click PageSetupDialog1.Document = PrintDocument1 PageSetupDialog1.AllowOrientation = True ' Sets the print document's color setting to false, ' so that the page will not be printed in color. 'PageSetupDialog1.Document.DefaultPageSettings.Color = False PageSetupDialog1.ShowDialog() If PageSetupDialog1.Document.DefaultPageSettings.Landscape = False Then PrintDocument1.DefaultPageSettings.Landscape = False End If If PageSetupDialog1.Document.DefaultPageSettings.Landscape = True Then PrintDocument1.DefaultPageSettings.Landscape = True End If PageSetupDialog1.PrinterSettings = End Sub Private Sub

    N 1 Reply Last reply
    0
    • C Curtis Underwood

      I have a application setup as Spreadsheet to display and print a datagridview. My problem is if I start the application, load a file, change the pagesetup to landscape, then print either to printer or preview it will print correctly. Now if I change back to portrait the preview or print out does change to the new setting. The displayed or printed data does not resize. The data is printed of the page. This works both ways if I start with portrait the same thing happens except the data in landscape is small on the page. Below is the code I use for printing and datagridview. I have tried several things including refresh and invalidate but nothing has had an affect. The only way I have found to change is to stop and restart the application in debug. <pre> Private Sub PrintDocument_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintDocument.Click PrintDialog1.AllowSomePages = True ' Show the help button. PrintDialog1.ShowHelp = True PrintDialog1.Document = PrintDocument1 Dim result As DialogResult = PrintDialog1.ShowDialog() ' If the result is OK then print the document. If (result = DialogResult.OK) Then PrintDocument1.Print() End If End Sub Private Sub PrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreview.Click Me.Refresh() DataGridView1.RefreshEdit() Dim dlg As New PrintPreviewDialog() Dim d dlg.Document = PrintDocument1 d = PrintDocument1.DefaultPageSettings PrintDocument.Invalidate() dlg.ShowDialog() End Sub Private Sub PageSetup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PageSetup.Click PageSetupDialog1.Document = PrintDocument1 PageSetupDialog1.AllowOrientation = True ' Sets the print document's color setting to false, ' so that the page will not be printed in color. 'PageSetupDialog1.Document.DefaultPageSettings.Color = False PageSetupDialog1.ShowDialog() If PageSetupDialog1.Document.DefaultPageSettings.Landscape = False Then PrintDocument1.DefaultPageSettings.Landscape = False End If If PageSetupDialog1.Document.DefaultPageSettings.Landscape = True Then PrintDocument1.DefaultPageSettings.Landscape = True End If PageSetupDialog1.PrinterSettings = End Sub Private Sub

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

      No one is going to read this unformatted garbage. Fix the formatting and only post what is necessary, not all of the code in your app.


      I know the language. I've read a book. - _Madmatt

      C 1 Reply Last reply
      0
      • N Not Active

        No one is going to read this unformatted garbage. Fix the formatting and only post what is necessary, not all of the code in your app.


        I know the language. I've read a book. - _Madmatt

        C Offline
        C Offline
        Curtis Underwood
        wrote on last edited by
        #3

        Since you don't like the way it's posted fix your dam editor I used the code block to insert. bye will not re post will ask on MSBN

        P N 2 Replies Last reply
        0
        • C Curtis Underwood

          Since you don't like the way it's posted fix your dam editor I used the code block to insert. bye will not re post will ask on MSBN

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

          You do know that it's not his editor don't you?

          "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

          C 1 Reply Last reply
          0
          • C Curtis Underwood

            Since you don't like the way it's posted fix your dam editor I used the code block to insert. bye will not re post will ask on MSBN

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

            Curtis Underwood wrote:

            will ask on MSBN

            I don't think the Minnesota Sports Broadcasting Network[^] will be of much use either.


            I know the language. I've read a book. - _Madmatt

            C 1 Reply Last reply
            0
            • N Not Active

              Curtis Underwood wrote:

              will ask on MSBN

              I don't think the Minnesota Sports Broadcasting Network[^] will be of much use either.


              I know the language. I've read a book. - _Madmatt

              C Offline
              C Offline
              Curtis Underwood
              wrote on last edited by
              #6

              MSDN Hit wrong key. But the editor still caused the problem. Since it did not display the code the way it is in Visual Studio. I will not spend two or three days trying to get it to display the code to your liking. I wrapped the code in the pre tags. I don't have the time to try to figure out whats wrong with this editor. This

              1 Reply Last reply
              0
              • P Pete OHanlon

                You do know that it's not his editor don't you?

                "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

                C Offline
                C Offline
                Curtis Underwood
                wrote on last edited by
                #7

                Yes I know its not his editor but he told me several thing such as to not post as much code well ok I won't post any Because without the code that I am using how can he tell where the problem is. I did not post anymore code than I thought was necessary all it contained was the datagridview and the print set up routine. If he did not need that then he should be able to answer the question without the code at all. But I was not thinking of him when I posted it. I was thinking of the beginners that try to follow what is going on, with out the code their lost. Besides what portion am I supposed to post. The whole thing is interlaced with setup calls. This is a problem that is caused by logic not caused by something that is just not getting the data. To troubleshoot logic you have to have the code.

                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