Click here to Skip to main content
15,563,248 members
Home / Discussions / C#
   

C#

 
GeneralRe: rounded form Pin
Jacky S1-Jan-04 5:47
Jacky S1-Jan-04 5:47 
Generallike this for the form.... Pin
eggie51-Jan-04 7:26
eggie51-Jan-04 7:26 
QuestionHow to handle storage in C#/.NET Pin
Mohsen Sajjadi1-Jan-04 4:18
Mohsen Sajjadi1-Jan-04 4:18 
AnswerRe: How to handle storage in C#/.NET Pin
Mazdak1-Jan-04 6:31
Mazdak1-Jan-04 6:31 
GeneralRe: How to handle storage in C#/.NET Pin
Mohsen Sajjadi1-Jan-04 21:56
Mohsen Sajjadi1-Jan-04 21:56 
AnswerRe: How to handle storage in C#/.NET Pin
Heath Stewart2-Jan-04 5:41
protectorHeath Stewart2-Jan-04 5:41 
GeneralChanging paper size at run time Pin
Yaron K.1-Jan-04 0:06
Yaron K.1-Jan-04 0:06 
GeneralRe: Changing paper size at run time Pin
Heath Stewart2-Jan-04 5:33
protectorHeath Stewart2-Jan-04 5:33 
Again, as I recommended before - and as MSDN recommends - enumerate the PrintDocument.PrinterSettings.PaperSizes (one the PrintDocument.PrinterSettings.PrinterName is set to the desired printer). If you look at the documentation for PrintDocument, the best place to set the PaperSize is in the handler for the PrintDocument.QueryPageSettings event, which occurs before each PrintDocument.PrintPage event:
// Declared in class to cache PaperSize;
private PaperSize paperSize;
 
// Method to enumerate PaperSizes from selected Printer.
private PaperSize GetPaperSize(PrinterSettings printer, PaperKind kind)
{
  if (printer == null) throw new ArgumentNullException("printer");
  if (this.paperSize == null)
  {
    foreach (PaperSize size in printer.PaperSizes
    {
      if (size.Kind == kind)
      {
        this.paperSize = size;
        return this.paperSize;
      }
    }
  }
  else return this.paperSize;

  // Only occurs if requested PaperSize with PaperKind doesn't exist.
  throw new ArgumentException("The requested paper size is not supported " +
    "by this printer.", "kind");
}
 
// Handler for PrintDocument.QueryPageSettings event.
private void printDocument_QueryPageSettings(object sender,
  QueryPageSettingsEventHandler e)
{
  try
  {
    e.PageSettings.PaperSize =
      this.GetPaperSize(e.PageSettings.PrinterSettings, PaperKind.A3);
  }
  catch (Exception ex)
  {
    MessageBox.Show(string.Format("Could not print the document: {0}",
      ex.Message), "Print Error", MessageBoxButtons.OK,
      MessageBoxIcon.Error);
    e.Cancel = true;
  }
}
This should work; if not, read the documentation for PrintDocument, PageSettings, and PrinterSettings.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: Changing paper size at run time Pin
Yaron K.3-Jan-04 20:40
Yaron K.3-Jan-04 20:40 
GeneralCreate a form from a XML Pin
Member 49620031-Dec-03 16:46
Member 49620031-Dec-03 16:46 
GeneralRe: Create a form from a XML Pin
Mazdak31-Dec-03 20:00
Mazdak31-Dec-03 20:00 
GeneralRe: Create a form from a XML Pin
Stephane Rodriguez.31-Dec-03 22:50
Stephane Rodriguez.31-Dec-03 22:50 
Generalcreate a form dynamically from XML Pin
Member 49620031-Dec-03 16:44
Member 49620031-Dec-03 16:44 
GeneralRounding Pin
Anonymous31-Dec-03 8:09
Anonymous31-Dec-03 8:09 
GeneralRe: Rounding Pin
Mazdak31-Dec-03 8:20
Mazdak31-Dec-03 8:20 
GeneralRe: Rounding Pin
Nick Parker31-Dec-03 8:45
protectorNick Parker31-Dec-03 8:45 
GeneralReadline() ignores some characters Pin
Rostrox31-Dec-03 7:47
Rostrox31-Dec-03 7:47 
GeneralRe: Readline() ignores some characters Pin
Mazdak31-Dec-03 8:06
Mazdak31-Dec-03 8:06 
GeneralRe: Readline() ignores some characters Pin
Rostrox31-Dec-03 9:24
Rostrox31-Dec-03 9:24 
GeneralRe: Readline() ignores some characters Pin
Mazdak31-Dec-03 10:59
Mazdak31-Dec-03 10:59 
GeneralBinaryFormatter.Deserialize() Pin
Guinness4Strength31-Dec-03 7:04
Guinness4Strength31-Dec-03 7:04 
GeneralRe: BinaryFormatter.Deserialize() Pin
Tristan Rhodes31-Dec-03 7:29
Tristan Rhodes31-Dec-03 7:29 
GeneralRe: BinaryFormatter.Deserialize() Pin
Guinness4Strength31-Dec-03 7:41
Guinness4Strength31-Dec-03 7:41 
GeneralRe: BinaryFormatter.Deserialize() Pin
Tristan Rhodes31-Dec-03 7:46
Tristan Rhodes31-Dec-03 7:46 
GeneralRe: BinaryFormatter.Deserialize() Pin
Kentamanos31-Dec-03 9:57
Kentamanos31-Dec-03 9:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.