Strange/Bad Layout when printing from TrueDBGrid

Posted by: max.bucht on 25 October 2019, 12:18 am EST

  • Posted 25 October 2019, 12:18 am EST - Updated 3 October 2022, 3:34 pm EST

    Hi!

    I am using C1.Win.C1TrueDBGrid.2.dll, C1.Win.C1Report.2.dll and C1.C1Report.2.dll (all in version 2.0.20173.286) in a VB.NET Winforms project for .NET framework version 4.0.30319.42

    All the grids in my application display nicely and the Print Preview of the grids also comes up when I use the following code:

    Me.Grd_Show.PrintInfo.PrintPreview()

    However, the layout of column headers and data is completely messed up. The texts do not appear within the grid boxes as they should - see attached screenshot!

    I have tried many things in terms of code and also I have tried different default printers (including generic ones like “Microsoft XPS Document Writer”) on my Windows 10 system - no change :frowning:.

    Interestingly, the preview function looks great when I install my app on all the different pc’s of my customer!? It would be great if this looked good on my development machine as well though. Any idea what else I could do?

    Thanks in advance for your possible help!

    Max.

  • Posted 29 October 2019, 7:35 pm EST

    Hi Max,

    Can you please tell us the configuration on your development machine? Particularly, how it differs from other machines.

    At my end, there were no issues so I would like to try it in an environment similar to yours.

    Thanks,

    Jitender

  • Posted 31 October 2019, 9:53 pm EST

    Hi Jitender,

    Thanks a lot for trying to help me!

    Here is a list of loaded assemblies at the runtime of my application:

    mscorlib 4.0.0.0

    flatWare 0.8.0.0 (my app)

    System.Windows.Forms 4.0.0.0

    System 4.0.0.0

    System.Drawing 4.0.0.0

    Microsoft.VisualBasic 10.0.0.0

    System.Core 4.0.0.0

    System.Configuration 4.0.0.0

    System.Xml 4.0.0.0

    flatWare.resources 0.8.0.0 (my app)

    System.Data 4.0.0.0

    System.Data.resources 4.0.0.0

    isText 2.0.2.14 (my own collection of input controls, not related to Truegrid)

    mscorlib.resources 4.0.0.0

    System.Transactions 4.0.0.0

    System.EnterpriseServices 4.0.0.0

    System.Runtime.Caching 4.0.0.0

    System.Numerics 4.0.0.0

    System.Drawing.resources 4.0.0.0

    System.Windows.Forms.resources 4.0.0.0

    I am using Windows 10 Pro with all the latest Service Packs, and here is some info that I get via the About box - Info button of my Visual Studio environment (don’t know if that is of any help):

    Microsoft Visual Studio Professional 2017

    Version 15.9.15

    VisualStudio.15.Release/15.9.15+28307.812

    Microsoft .NET Framework

    Version 4.8.03752

    Installierte Version: Professional

    Visual C++ 2017 00369-60000-00001-AA231

    Microsoft Visual C++ 2017

    Allgemeine Azure-Tools 1.10

    Bietet allgemeine Dienste für die Verwendung durch Azure Mobile Services und Microsoft Azure-Tools.

    Application Insights-Tools für Visual Studio-Paket 8.14.20131.1

    Application Insights-Tools für Visual Studio

    ASP.NET and Web Tools 2017 15.9.04012.0

    ASP.NET and Web Tools 2017

    ASP.NET Core Razor Language Services 15.8.31590

    Provides languages services for ASP.NET Core Razor.

    ASP.NET Web Frameworks and Tools 2017 5.2.61435.0

    For additional information, visit https://www.asp.net/

    Azure App Service Tools v3.0.0 15.9.03024.0

    Azure App Service Tools v3.0.0

    C#-Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a

    C#-Komponenten, die in der IDE verwendet werden. Je nach Projekttyp und Einstellungen kann eine andere Compilerversion verwendet werden.

    Extensibility Message Bus 1.1.49 (remotes/origin/d15-8@ee674f3)

    Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

    Fabric.DiagnosticEvents 1.0

    Fabric-Diagnoseereignisse

    JavaScript-Sprachdienst 2.0

    JavaScript-Sprachdienst

    JavaScript Project System 2.0

    JavaScript Project System

    JavaScript UWP Project System 2.0

    JavaScript UWP Project System

    Microsoft Azure-Tools 2.9

    Microsoft Azure-Tools für Microsoft Visual Studio 2017 – v2.9.20417.1

    Microsoft Azure Service Fabric-Tools für Visual Studio 2.5

    Microsoft Azure Service Fabric-Tools für Visual Studio

    Microsoft Continuous Delivery Tools für Visual Studio 0.4

    Die Konfiguration von Azure DevOps-Pipelines von der Visual Studio-IDE aus wird vereinfacht.

    Microsoft JVM Debugger 1.0

    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

    Microsoft MI-Based Debugger 1.0

    Provides support for connecting Visual Studio to MI compatible debuggers

    Microsoft Visual C+±Assistenten 1.0

    Microsoft Visual C+±Assistenten

    Microsoft Visual Studio-Tools für Container 1.1

    Jetzt können Sie Ihre ASP.NET Core-Anwendung in der Zielumgebung entwickeln, ausführen und überprüfen. Drücken Sie F5, um die Anwendung direkt in einem Container mit Debugfunktionen auszuführen, oder STRG+F5 zum Bearbeiten und Aktualisieren Ihrer Anwendung, ohne den Container erneut erstellen zu müssen.

    NuGet-Paket-Manager 4.6.0

    NuGet-Paket-Manager in Visual Studio. Weitere Informationen zu NuGet finden Sie unter “http://docs.nuget.org/”.

    ProjectServicesPackage Extension 1.0

    ProjectServicesPackage Visual Studio Extension Detailed Info

    ResourcePackage-Erweiterung 1.0

    Detaillierte Informationen zur ResourcePackage-Erweiterung von Visual Studio

    ResourcePackage-Erweiterung 1.0

    Detaillierte Informationen zur ResourcePackage-Erweiterung von Visual Studio

    SQL Server Data Tools 15.1.61906.03120

    Microsoft SQL Server Data Tools

    SQL Server Reporting Services 15.0.1528.0

    Designer für Microsoft SQL Server Reporting Services

    Version 15.0.1528.0

    TypeScript-Tools 15.9.30718.2001

    TypeScript-Tools für Microsoft Visual Studio

    VC-Paket für Microsoft Visual Studio 1.0

    VC-Paket für Microsoft Visual Studio

    Visual Basic-Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a

    Visual Basic-Komponenten, die in der IDE verwendet werden. Je nach Projekttyp und Einstellungen kann eine andere Version des Compilers verwendet werden.

    Visual C++ für plattformübergreifende Mobile-Entwicklung 15.0.28107.00

    Visual C++ für plattformübergreifende Mobile-Entwicklung

    Visual F# Tools 10.2 für F# 4.5 15.8.0.0. Commit Hash: 6e26c5bacc8c4201e962f5bdde0a177f82f88691.

    Microsoft Visual F# Tools 10.2 für F# 4.5

    Visual Studio-Tools für Container 1.0

    Visual Studio-Tools für Container

    Visual Studio Code-Debugadapter-Hostpaket 1.0

    Interopebene zum Hosten der Visual Studio Code-Adapter in Visual Studio

    Visual Studio Tools für universelle Windows-Apps 15.0.28307.718

    Mit den Visual Studio Tools für universelle Windows-Apps können Sie eine universelle App-Erfahrung erstellen, die auf jedem Gerät genutzt werden kann, das Windows 10 ausführt: Smartphone, Tablet, PC und viele weitere Geräte. Das Microsoft Windows 10 SDK ist in den Tools enthalten.

    I could probably dig out some version info of my printer drivers but the problem occurs with each one of them :frowning:.

  • Posted 31 October 2019, 9:56 pm EST

    Sorry, when I took the snapshot of the loaded assemblies above, I had not opened up the grid in my app yet. Here is a new DLL list (which now includes the TrueDBGrid DLLs as well):

    mscorlib 4.0.0.0

    flatWare 0.8.0.0

    System.Windows.Forms 4.0.0.0

    System 4.0.0.0

    System.Drawing 4.0.0.0

    Microsoft.VisualBasic 10.0.0.0

    System.Core 4.0.0.0

    System.Configuration 4.0.0.0

    System.Xml 4.0.0.0

    flatWare.resources 0.8.0.0

    System.Data 4.0.0.0

    System.Data.resources 4.0.0.0

    isText 2.0.2.14

    mscorlib.resources 4.0.0.0

    System.Transactions 4.0.0.0

    System.EnterpriseServices 4.0.0.0

    System.Runtime.Caching 4.0.0.0

    System.Numerics 4.0.0.0

    System.Drawing.resources 4.0.0.0

    System.Windows.Forms.resources 4.0.0.0

    Vintasoft.Twain 10.3.7.3

    CButtonLib 2.0.2.0

    isContainer 2.0.0.3

    C1.Win.C1TrueDBGrid.2 2.0.20173.286

    Accessibility 4.0.0.0

    C1.C1Report.2 2.0.20173.286

    C1.Win.C1Report.2 2.0.20173.286

    System.Design 4.0.0.0

    System.Windows.Forms.DataVisualization 4.0.0.0

  • Posted 31 October 2019, 10:14 pm EST

    Hi Max,

    This info would be the same for all the PCs so I don’t think the issue lies here.

    Is there any difference in DPI?

  • Posted 31 October 2019, 11:54 pm EST

    The printers I am working with (2 different HP Laserjet models and the FinePrint printer driver) do not allow to show/set the DPI resolution - hmmmh.

    I have now tried my app on two different PCs which use the same printers as I - one with Windows Server 2016 and one with Windows Server 2008 R2 - and on both the grid printing/print preview looks great.

  • Posted 31 October 2019, 11:57 pm EST

    Can you think of any debug commands I could enter into my app just before I do the Me.Grd_Show.PrintInfo.PrintPreview() which could help to debug the problem?

  • Posted 31 October 2019, 11:58 pm EST

    Hi Jitender,

    Unfortunately I have a meeting in 5 minutes and I will not return to my office after that anymore, it’s Friday afternoon here in Germany ;-). Looking forward to hopefully reading more from you when I am back on Monday,

    Best regards,

    Max

  • Posted 3 November 2019, 4:30 pm EST

    Hi Max,

    I was asking for the DPI display settings of your system (not the printer). There was a similar issue where this is observed when higher DPI settings are used.

    To fix these issues, new properties (‘MeasurementDevice’ and ‘MeasurementPrinterName’) were added in the build 4.0.20181.299.

    Since there is no workaround for this, you would need to update your controls to avoid the issue.

    Regards,

    Jitender

  • Posted 3 November 2019, 7:12 pm EST

    Hi Jitender,

    Thanks for DPI explanation - this really seems to be the issue!! I do not see any direct DPI number in my Windows 10 display settings but a combobox with a scaling option which was set to 125% on my PC. If I change that to 100% the grid printing problem goes away! However, with 100% the fonts in many applications are too small so I have changed it back to 125% again. I will try to upgrade my controls to version 4 and possibly to 4.0.20181.299 or higher now and will come back to you later today…

  • Posted 3 November 2019, 9:47 pm EST - Updated 3 October 2022, 3:35 pm EST

    Hi Jitender,

    I converted the C1Report- and C1TrueDBGrid references of my project from 2 to 4 (version 4.0.20162.188), and the app had no issues with that :-). The grid printing problems from continued though. Before paying for an update to version 4.0.20192.375 I thought that I could try to update for free to version 4.0.20173.291 according to the attached screenshot of the Component One Studio Live tool. However, that update failed - see error message at the bottom of the screenshot. Can you help me with that before I contact sales regarding any further payable updates?

  • Posted 3 November 2019, 10:32 pm EST

    Hi Max,

    Please try updating using ComponentOne ControlPanel (https://cdn.grapecity.com/ComponentOne/2019v2/ComponentOneControlPanel20192.1.16.exe).

    For the preview issue, you would need to set MeasurementDevice property before using PrintPreview:

    C1TrueDBGrid1.PrintInfo.MeasurementDevice = C1.Win.C1TrueDBGrid.PrintInfo.MeasurementDeviceEnum.Printer
    C1TrueDBGrid1.PrintInfo.PrintPreview()
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels