Example #1
0
        private PaperSource PaperSourceFromMode(SafeNativeMethods.DEVMODE mode)
        {
            PaperSource[] sources = printerSettings.Get_PaperSources();
            for (int i = 0; i < sources.Length; i++)
            {
                // the dmDefaultSource == to the RawKind in the Papersource.. and Not the Kind...
                // if the PaperSource is populated with CUSTOM values...

                if ((short)sources[i].RawKind == mode.dmDefaultSource)
                {
                    return(sources[i]);
                }
            }
            return(new PaperSource((PaperSourceKind)mode.dmDefaultSource, "unknown"));
        }
 private PaperSource PaperSourceFromMode(Interop.Gdi32.DEVMODE mode)
 {
     PaperSource[] sources = printerSettings.Get_PaperSources();
     if ((mode.dmFields & SafeNativeMethods.DM_DEFAULTSOURCE) == SafeNativeMethods.DM_DEFAULTSOURCE)
     {
         for (int i = 0; i < sources.Length; i++)
         {
             // the dmDefaultSource == to the RawKind in the Papersource.. and Not the Kind...
             // if the PaperSource is populated with CUSTOM values...
             if (unchecked ((short)sources[i].RawKind) == mode.dmDefaultSource)
             {
                 return(sources[i]);
             }
         }
     }
     return(new PaperSource((PaperSourceKind)mode.dmDefaultSource, "unknown"));
 }