Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Printing / InvalidPrinterException.cs / 1305376 / InvalidPrinterException.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Drawing.Printing { using System.Diagnostics; using System; using System.Security; using System.Security.Permissions; using System.Runtime.Serialization; using System.ComponentModel; using System.Runtime.InteropServices; using Microsoft.Win32; ////// /// [Serializable()] public class InvalidPrinterException : SystemException { private PrinterSettings settings; ////// Represents /// the /// exception that is thrown when trying to access a printer using invalid printer settings. /// ////// /// public InvalidPrinterException(PrinterSettings settings) : base(GenerateMessage(settings)) { this.settings = settings; } ////// Initializes a new instance of the ///class. /// protected InvalidPrinterException(SerializationInfo info, StreamingContext context) : base (info, context) { settings = (PrinterSettings)info.GetValue("settings", typeof(PrinterSettings)); } /// [SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } IntSecurity.AllPrinting.Demand(); info.AddValue("settings", settings); base.GetObjectData(info, context); } static string GenerateMessage(PrinterSettings settings) { if (settings.IsDefaultPrinter) { return SR.GetString(SR.InvalidPrinterException_NoDefaultPrinter); } else { try { return SR.GetString(SR.InvalidPrinterException_InvalidPrinter, settings.PrinterName); } catch (SecurityException) { return SR.GetString(SR.InvalidPrinterException_InvalidPrinter, SR.GetString(SR.CantTellPrinterName)); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataGridViewCellLinkedList.cs
- Rectangle.cs
- XPathSelfQuery.cs
- loginstatus.cs
- ComboBox.cs
- DisableDpiAwarenessAttribute.cs
- WebPartEditorOkVerb.cs
- ExtensionWindowResizeGrip.cs
- BaseAsyncResult.cs
- CodeValidator.cs
- SpeakInfo.cs
- DataGridViewMethods.cs
- ParallelEnumerable.cs
- HybridCollection.cs
- ASCIIEncoding.cs
- SqlMetaData.cs
- Rotation3DAnimationBase.cs
- FontFamilyIdentifier.cs
- EventSinkActivityDesigner.cs
- NgenServicingAttributes.cs
- RawStylusInputCustomData.cs
- CodeVariableReferenceExpression.cs
- SourceInterpreter.cs
- ObjectQueryExecutionPlan.cs
- TraceListeners.cs
- PtsCache.cs
- RowUpdatedEventArgs.cs
- Win32Exception.cs
- DescendentsWalkerBase.cs
- QilReference.cs
- MasterPageBuildProvider.cs
- BinaryQueryOperator.cs
- CheckBox.cs
- ACE.cs
- nulltextcontainer.cs
- CriticalFinalizerObject.cs
- RecordManager.cs
- GenericAuthenticationEventArgs.cs
- WebBrowserPermission.cs
- StringUtil.cs
- TextPointer.cs
- CustomPopupPlacement.cs
- ListViewItemMouseHoverEvent.cs
- ConfigurationSectionCollection.cs
- _NegoStream.cs
- TrackingProfile.cs
- mediaeventshelper.cs
- TreeNodeBindingCollection.cs
- Guid.cs
- TextTrailingWordEllipsis.cs
- unitconverter.cs
- TagPrefixCollection.cs
- OutputScopeManager.cs
- ScrollContentPresenter.cs
- SizeChangedEventArgs.cs
- NestPullup.cs
- StaticTextPointer.cs
- ToolStripContainer.cs
- RuleCache.cs
- XmlILTrace.cs
- SHA384.cs
- GridItemPattern.cs
- MulticastNotSupportedException.cs
- SpeakProgressEventArgs.cs
- SecUtil.cs
- ListControlBoundActionList.cs
- TextStore.cs
- SqlAggregateChecker.cs
- _HelperAsyncResults.cs
- WmpBitmapEncoder.cs
- FixedNode.cs
- AuthorizationRuleCollection.cs
- FilteredDataSetHelper.cs
- WebServiceFaultDesigner.cs
- ADRole.cs
- CheckableControlBaseAdapter.cs
- Bits.cs
- ItemDragEvent.cs
- WindowsGraphicsCacheManager.cs
- CalendarDateRangeChangingEventArgs.cs
- RowUpdatingEventArgs.cs
- BookmarkScopeHandle.cs
- PageAction.cs
- Grant.cs
- MonitoringDescriptionAttribute.cs
- LocalServiceSecuritySettings.cs
- LightweightEntityWrapper.cs
- Adorner.cs
- UpdateTracker.cs
- BinaryFormatter.cs
- ReaderWriterLockWrapper.cs
- OutputCacheModule.cs
- PathSegmentCollection.cs
- AssemblyHelper.cs
- SuppressIldasmAttribute.cs
- BufferModesCollection.cs
- CapabilitiesUse.cs
- LogAppendAsyncResult.cs
- HttpWriter.cs
- ProviderUtil.cs