Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CommonUI / System / Drawing / Printing / InvalidPrinterException.cs / 1 / 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. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DeclaredTypeValidatorAttribute.cs
- LockRecoveryTask.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- TimeSpanStorage.cs
- GridItemPattern.cs
- PersonalizationStateQuery.cs
- PatternMatchRules.cs
- MethodBody.cs
- KeyPullup.cs
- controlskin.cs
- SQLChars.cs
- HierarchicalDataSourceControl.cs
- ValidationSummary.cs
- XmlHelper.cs
- StrongNamePublicKeyBlob.cs
- ExpressionPrinter.cs
- XmlSchemaException.cs
- RelationshipEndMember.cs
- Label.cs
- CodeIterationStatement.cs
- ObjectDisposedException.cs
- PatternMatcher.cs
- ListViewEditEventArgs.cs
- HeaderCollection.cs
- NativeMethods.cs
- HttpPostProtocolReflector.cs
- HierarchicalDataBoundControl.cs
- InheritedPropertyChangedEventArgs.cs
- ViewValidator.cs
- Padding.cs
- ListItemViewControl.cs
- Queue.cs
- XmlDataSourceNodeDescriptor.cs
- WebServiceEnumData.cs
- FontStretch.cs
- CSharpCodeProvider.cs
- CodeRemoveEventStatement.cs
- WebPartActionVerb.cs
- Zone.cs
- Win32NamedPipes.cs
- ProfilePropertySettingsCollection.cs
- Socket.cs
- EnglishPluralizationService.cs
- FixedDocumentSequencePaginator.cs
- PageHandlerFactory.cs
- BinaryEditor.cs
- DataGridViewRowConverter.cs
- filewebrequest.cs
- SuppressIldasmAttribute.cs
- WeakRefEnumerator.cs
- SocketPermission.cs
- AssertFilter.cs
- ForceCopyBuildProvider.cs
- DataKeyCollection.cs
- BamlRecordHelper.cs
- PropagatorResult.cs
- CallContext.cs
- DataContractSerializerFaultFormatter.cs
- SafeNativeMethods.cs
- ExtenderControl.cs
- ConfigXmlDocument.cs
- BitmapEffectrendercontext.cs
- DataGridTable.cs
- WindowsGraphicsWrapper.cs
- SystemInformation.cs
- ServiceHttpHandlerFactory.cs
- DataListItem.cs
- FrugalList.cs
- SID.cs
- RealizedColumnsBlock.cs
- IssuedTokenClientBehaviorsElement.cs
- DataObject.cs
- CodeConditionStatement.cs
- CodeArrayCreateExpression.cs
- ListSortDescriptionCollection.cs
- FileLogRecordEnumerator.cs
- ProvideValueServiceProvider.cs
- ExceptionWrapper.cs
- UriWriter.cs
- BooleanFacetDescriptionElement.cs
- PartialTrustVisibleAssemblyCollection.cs
- TextContainer.cs
- SmtpCommands.cs
- RuleSettings.cs
- GenericParameterDataContract.cs
- COM2ExtendedBrowsingHandler.cs
- ColorMap.cs
- SecurityPolicySection.cs
- DeferredReference.cs
- ActivityIdHeader.cs
- X509ImageLogo.cs
- ActivityExecutionContextCollection.cs
- KeyPressEvent.cs
- ToolStripGripRenderEventArgs.cs
- CodeLinePragma.cs
- Rect3D.cs
- SafeIUnknown.cs
- SystemNetworkInterface.cs
- Composition.cs
- XmlSchemaObject.cs