How To Print Text In C#

CK CK 3788 
Created at  
455 0 0

If you want to use MultipadPrintDocument in your own code,it's best to rename 
the class and its constructor to something more appropriate. Then add a variable 
of type XXXPrintDocument to your form and implement the menu items as follows:
 

void OnFilePrint(Object sender,EventArgs e)
{
    PrintDialog pd = new PrintDialog();
    _printdocument.Text = _multipadbox.Text;
    _printdocument.Font = _multipadbox.Font;
    pd.Document = _printdocument;
    pd.ShowDialog();
}

void OnFilePrintPreview(Object sender,EventArgs e)
{
    PrintPreviewDialog ppd = new PrintPreviewDialog();
    _printdocument.Text = _multipadbox.Text;
    _printdocument.Font = _multipadbox.Font;
    ppd.Document = _printdocument;
    ppd.ShowDialog();
}

void OnFilePageSetup(Object sender,EventArgs e)
{
    PageSetupDialog psd = new PageSetupDialog();
    psd.Document = _printdocument;
    psd.ShowDialog();
}

 

Tags C# C# Print OnFilePrint PageSetupDialog Print PrintPreviewDialog ShowDialog Facebook X
Comments 0
Similar posts
  1. Simplified .NET Printing In C#
    692
  2. A Customizable Printing Text Class
    431
  3. Print HTML In C# With Or Without The Web Browser Control And The Print Dialog
    972
  4. Adding Custom Paper Sizes To Named Printers
    646
  5. How to send binary data through C# CGI app?
    994
  6. Calling Your Main Thread From A Worker Thread In C#
    546
  7. How to print character in C# by ASCII code
    476
  8. How To Read And Write A Cookie
    363
  9. Using C# With Cookies
    625
  10. Printing A Page
    378
  11. Get A Print Dialog Box By Clicking A Button
    818
  12. How To Show The Print Dialog And Print Text Files
    1,295
  13. Extracting the Country from IP Address
    467
  14. Graphics in C# - Irregular Forms
    908
  15. How to restrict a program to a single instance
    729
  16. The best way to enable and disable buttons, menu items and toolbar buttons
    667
  17. How to speed up access to the RichTextBox Lines property
    830
  18. To load image from file
    450
  19. How to convert bitmap image to jpeg image ?
    356
  20. How to resize and save PNG or Jpeg Image file ?
    631
  21. How to convert text string to integer ?
    610
  22. How to convert integer to text string ?
    697
  23. How to print external document ?
    414
  24. How to get process id in C# like windows task manager ?
    870
  25. Changing the Title of a Print Dialog in Delphi
    1,093
  26. How To Check If Your Printer Is Connected Using C#
    1,026
  27. How to download/grap web pages or XML document at internet website in Delphi XE?
    870
  1. Graphics in C# - Irregular Forms
    908
  2. Extracting the Country from IP Address
    467
  3. How to run shell command by MFC ?
    435
  4. Binary Search Sample Code
    404
  5. Double Linked List based in C++
    796
  6. String Replace Function For C#
    1,547
  7. How to print character in C# by ASCII code
    476
  8. MFC based World Wide Web HTTP Server Source Code
    459
  9. Creating and Using a CAsyncSocket Object to use CAsyncSocket
    472
  10. UDP Send and Receive Using CAsyncSocket
    1,204
  11. Using the shell to receive notification of removable media being inserted or removed
    680
  12. Adding Custom Paper Sizes To Named Printers
    646
  13. Print HTML In C# With Or Without The Web Browser Control And The Print Dialog
    972
  14. A Customizable Printing Text Class
    431
  15. Simplified .NET Printing In C#
    692
  16. C# Lists
    1,151
  17. Simple Example of IF/THEN using C#
    1,265
  18. Fast and Good Keyboard/Mouse Test without the message handler
    982
  19. Simple CGI Programming in C
    544
  20. C++ CGI Example working on Apache
    483
  21. Simple C# CGI working on Apache
    480
  22. How to send binary data through C# CGI app?
    994
  23. Interacting With TinyPic From C#
    1,303
  24. Creating A Watched Folder With Assigned Events
    1,658
  25. Calling Your Main Thread From A Worker Thread In C#
    546
  26. HashTable Tutorial In C#
    1,787
  27. Stack Tutorial In C#
    668
  28. Queue Tutorial In C#
    1,737
  29. Create PDF Files On the Fly in C#
    1,002
  30. How to call Visual C/C++ implemented DLL functions in C# - Simple DLLImport
    1,160
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    39
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    34
  3. How do I create animated background for Google Meet?
    20,611
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    244
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    94
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    156
  7. Array of arguments passed to script in PHP
    90
  8. Invalid Auction Storms in Ad Tech
    98
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    202
  10. The Two Clocks of Ad Server Architecture
    69
  11. Frequency Cap Architecture Overview
    514
  12. Collecting Proof-of-Play from 100,000 Screens
    146
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    287
  14. What is RedisVL?
    108
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    230
  16. TPU & GPU Cluster Management Tools
    243
  17. The Concept of Scaffolding in AI Agents
    232
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    582
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    258
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    338
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    202
  22. Machine Learning: Training vs. Ranking
    221
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    222
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    195
  25. Designing a Data Curation System Around a Vector Database
    220
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    256
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    655
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    195
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    216
  30. Understanding Data Lineage
    259