Click here to Skip to main content
15,867,308 members
Home / Discussions / C#
   

C#

 
GeneralRe: rounded form Pin
Jacky S1-Jan-04 4:47
Jacky S1-Jan-04 4:47 
Generallike this for the form.... Pin
eggie51-Jan-04 6:26
eggie51-Jan-04 6:26 
QuestionHow to handle storage in C#/.NET Pin
Mohsen Sajjadi1-Jan-04 3:18
Mohsen Sajjadi1-Jan-04 3:18 
AnswerRe: How to handle storage in C#/.NET Pin
Mazdak1-Jan-04 5:31
Mazdak1-Jan-04 5:31 
GeneralRe: How to handle storage in C#/.NET Pin
Mohsen Sajjadi1-Jan-04 20:56
Mohsen Sajjadi1-Jan-04 20:56 
AnswerRe: How to handle storage in C#/.NET Pin
Heath Stewart2-Jan-04 4:41
protectorHeath Stewart2-Jan-04 4:41 
GeneralChanging paper size at run time Pin
Yaron K.31-Dec-03 23:06
Yaron K.31-Dec-03 23:06 
GeneralRe: Changing paper size at run time Pin
Heath Stewart2-Jan-04 4:33
protectorHeath Stewart2-Jan-04 4: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 19:40
Yaron K.3-Jan-04 19:40 
GeneralCreate a form from a XML Pin
Member 49620031-Dec-03 15:46
Member 49620031-Dec-03 15:46 
GeneralRe: Create a form from a XML Pin
Mazdak31-Dec-03 19:00
Mazdak31-Dec-03 19:00 
GeneralRe: Create a form from a XML Pin
Stephane Rodriguez.31-Dec-03 21:50
Stephane Rodriguez.31-Dec-03 21:50 
Generalcreate a form dynamically from XML Pin
Member 49620031-Dec-03 15:44
Member 49620031-Dec-03 15:44 
GeneralRounding Pin
Anonymous31-Dec-03 7:09
Anonymous31-Dec-03 7:09 
GeneralRe: Rounding Pin
Mazdak31-Dec-03 7:20
Mazdak31-Dec-03 7:20 
GeneralRe: Rounding Pin
Nick Parker31-Dec-03 7:45
protectorNick Parker31-Dec-03 7:45 
GeneralReadline() ignores some characters Pin
Rostrox31-Dec-03 6:47
Rostrox31-Dec-03 6:47 
GeneralRe: Readline() ignores some characters Pin
Mazdak31-Dec-03 7:06
Mazdak31-Dec-03 7:06 
GeneralRe: Readline() ignores some characters Pin
Rostrox31-Dec-03 8:24
Rostrox31-Dec-03 8:24 
GeneralRe: Readline() ignores some characters Pin
Mazdak31-Dec-03 9:59
Mazdak31-Dec-03 9:59 
GeneralBinaryFormatter.Deserialize() Pin
Guinness4Strength31-Dec-03 6:04
Guinness4Strength31-Dec-03 6:04 
GeneralRe: BinaryFormatter.Deserialize() Pin
Tristan Rhodes31-Dec-03 6:29
Tristan Rhodes31-Dec-03 6:29 
GeneralRe: BinaryFormatter.Deserialize() Pin
Guinness4Strength31-Dec-03 6:41
Guinness4Strength31-Dec-03 6:41 
GeneralRe: BinaryFormatter.Deserialize() Pin
Tristan Rhodes31-Dec-03 6:46
Tristan Rhodes31-Dec-03 6:46 
GeneralRe: BinaryFormatter.Deserialize() Pin
Kentamanos31-Dec-03 8:57
Kentamanos31-Dec-03 8: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.