C# Print.zip

How To Print Text In C#

453

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: .

Adding Custom Paper Sizes To Named Printers

643

My company needed me to programmatically add a custom paper size (a printer form) to the default printer and set the printer to use the custom paper size. After looking around,the best alternative we could find was to make use of the printing and print spo...

Simplified .NET Printing In C#

686

The RichTextBox control in C# is a versatile element that allows users to display and edit formatted text,including different fonts,colors,sizes,and styles.It provides features like text highlighting,bullet points,indentation,and hyperlinks,making it suita...

A Customizable Printing Text Class

426

At least once,in the life of a programmer,it succeeds that the moment arrives to print a text document.The task is quite simple for a .NET programmer,but even more with PrintTextDocument class.This class was written to help in printing text documents,addin...

How To Check If Your Printer Is Connected Using C#

1,024

This code will test whether a printer is connected to your system or not. It works with USB and network printers (haven't tested LPT printers yet). Some printers (like my HP DeskJet 930c) is detected online even though I press the OFF b...

Changing the Title of a Print Dialog in Delphi

1,091

The TPrintDialog component displays a standard Windows dialog box for sending jobs to a printer.Unfortunately,the TPrintDialog does not expose the Title property.By handing the OnShow event of a print dialog you can specify the text for the dialog’s title...

How to get process id in C# like windows task manager ?

865

Following is simple example to get process name and add process name to listbox control.As you can see below, you can get working process by Process control. But most of the properties are supported on windows platform. If you want to access the similar pr...

How to convert integer to text string ?

695

C# provides an excellerent static instance can convert various types. You can easily get the wanted reult by Convert Class. Because It's a static instance, you don't need to declare instance.Following is the example to example to convert from integer to te...

How to convert text string to integer ?

608

C# provides an excellerent static instance can convert various types. You can easily get the wanted reult by Convert Class. Because It's a static instance, you don't need to declare instance.Following is the example to example to convert from text string t...

How to resize and save PNG or Jpeg Image file ?

629

The PictureBox control in C# is a visual element that allows you to display images within your application's user interface.It's a versatile tool for displaying images,icons,graphics,and other visual content,and it can be easily manipulated using propertie...

How to convert bitmap image to jpeg image ?

352

C# provides easy interface to convert image.Following is the simple example.using System.Drawing.Imaging;...Image image = Image.FromFile("test.bmp");image.Save("test.jpg", ImageFormat.Jpeg);Above is PNG to jpeg. You can convert Jpeg to PNG as following.usi...

To load image from file

445

The `Image.FromFile` method in C# is used to load an image from a specified file path into an `Image` object.It takes a string argument representing the full path to the image file and returns a new `Image` object containing the loaded image data.This meth...

Two useful string functions - substr & substring

402

Now a days, javascript is widely used for web 2.0 programming.In this case both function is very useful for string related algorithm.You can simple get the required part of the string with high performance provided by client PC's performance.1) substr() me...

How to speed up access to the RichTextBox Lines property

825

Using a foreach loop will be substantially faster than a for loop when accessing the items in a RichTextBox's Lines property. For example, the following code loads a RichTextBox with 1000 lines of text and accesses each line from the Lines property. On a 3...

How to restrict a program to a single instance

726

In the program's Main method,call ProcessUtils.ThisProcessIsAlreadyRunning() to determine if another instance of the program is already running.ThisProcessIsAlreadyRunning attempts to create a Mutex object with the same name as the program (Application.Pro...

Graphics in C# - Irregular Forms

904

Quite frankly, I think this topic is a lot of fun...the thought of making an app look completely different from the usual rectangular-formed layout really appeals to me.Drawing an irregular form, like drawing anything, requires four things : a surface, a s...

Extracting the Country from IP Address

463

Notes: If you want to run this sample,you should copy the Ip address to driver c:. Using the codePart 1.using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows....

How to send binary data through C# CGI app?

992

Following example implemented binary data downloading. If you are using Apache and wanna test it just put the EXE in the cgi-bin folder under Apache's directory.Also note that the parameters are static just for this example.

Calling Your Main Thread From A Worker Thread In C#

544

There are many cases where it is necessary to let your main application know that a thread has completed. Your main application could spawn some threads to do background work and then when the threads have completed their work they could return the results...

How To Read And Write A Cookie

358

A post on aspngbeta about readingwriting a cookie in C# / / To setHttpCookie cookie;String UserID = "foo";cookie = new HttpCookie("UserID");cookie.Values.Add("UserID",UserID);Response.Cookies.Add(cookie); / / To readHttpCookie cookie;cookie = Request.Coo...

Using C# With Cookies

618

A code snippet posted on aspcs about accessing and writing cookies using C#. / * Read shopper id from client cookie * / public static bool GetCurrentShopperId(ref string id,System.Web.HttpRequest request){try{HttpCookie cookie = request.Cookies["iparts_pa"...

Printing A Page

376

how to print the current page