Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / ImageListImage.cs / 1 / ImageListImage.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms.Design {
using System.ComponentModel;
using System.Drawing.Design;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
[Editor(typeof(System.Windows.Forms.Design.ImageListImageEditor), typeof(UITypeEditor))]
internal class ImageListImage {
public ImageListImage(Bitmap image) {
Image = image;
}
public ImageListImage (Bitmap image, string name) {
Image = image;
Name = name;
}
private string _name = null;
private Bitmap _image = null;
public string Name {
get { return (_name == null) ? "" : _name; }
set {
_name = value;
}
}
[Browsable(false)]
public Bitmap Image {
get { return _image; }
set { _image = value; }
}
// Add properties to make this object "look" like Image in the Collection editor
public float HorizontalResolution {
get { return _image.HorizontalResolution; }
}
public float VerticalResolution {
get { return _image.VerticalResolution; }
}
public PixelFormat PixelFormat {
get { return _image.PixelFormat; }
}
public ImageFormat RawFormat {
get { return _image.RawFormat; }
}
public Size Size {
get { return _image.Size; }
}
public SizeF PhysicalDimension {
get { return _image.Size; }
}
public static ImageListImage ImageListImageFromStream(Stream stream, bool imageIsIcon) {
if(imageIsIcon) {
return new ImageListImage((new Icon(stream)).ToBitmap());
} else {
return new ImageListImage((Bitmap)Bitmap.FromStream(stream));
}
}
}
}
// 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
- ConfigXmlReader.cs
- RegistrationServices.cs
- MessageEncoderFactory.cs
- ImpersonateTokenRef.cs
- SafeNativeMethods.cs
- InvokeWebServiceDesigner.cs
- Evaluator.cs
- dataobject.cs
- x509utils.cs
- NamespaceInfo.cs
- BrushMappingModeValidation.cs
- ToolStripDropDownMenu.cs
- XmlSchemaAppInfo.cs
- RadioButton.cs
- SqlCommandBuilder.cs
- HandlerWithFactory.cs
- CompiledRegexRunner.cs
- DataGridCaption.cs
- CopyCodeAction.cs
- TypeUtils.cs
- Quaternion.cs
- ClientSideQueueItem.cs
- SingleResultAttribute.cs
- StringBuilder.cs
- QueryStringParameter.cs
- TypeConverter.cs
- HtmlObjectListAdapter.cs
- RouteCollection.cs
- PageCatalogPart.cs
- TextTreeUndo.cs
- Signature.cs
- WizardPanelChangingEventArgs.cs
- StorageInfo.cs
- QuaternionAnimation.cs
- ToolStripItemClickedEventArgs.cs
- SafeProcessHandle.cs
- SessionPageStateSection.cs
- StringConverter.cs
- InstanceHandleReference.cs
- IisTraceListener.cs
- ReadOnlyNameValueCollection.cs
- ServiceModelTimeSpanValidator.cs
- Logging.cs
- UserPreferenceChangingEventArgs.cs
- BindingNavigator.cs
- CellTreeSimplifier.cs
- TcpChannelFactory.cs
- ApplicationBuildProvider.cs
- OneWayElement.cs
- ClrProviderManifest.cs
- DataExpression.cs
- VectorCollection.cs
- InternalConfigSettingsFactory.cs
- FixedPageStructure.cs
- Action.cs
- BinaryNode.cs
- NativeActivityContext.cs
- NativeMethods.cs
- InProcStateClientManager.cs
- ItemsControl.cs
- HMACSHA512.cs
- PopupControlService.cs
- path.cs
- KeySpline.cs
- ProcessHostConfigUtils.cs
- WsdlInspector.cs
- XmlUnspecifiedAttribute.cs
- ObjectAssociationEndMapping.cs
- DashStyle.cs
- DropDownButton.cs
- VectorAnimationBase.cs
- SqlTypeConverter.cs
- Int64Animation.cs
- PersistenceTypeAttribute.cs
- SQLBoolean.cs
- LinqDataSourceContextEventArgs.cs
- CellConstantDomain.cs
- IpcChannel.cs
- DataBinder.cs
- DataGridViewCellFormattingEventArgs.cs
- DaylightTime.cs
- IPAddress.cs
- XmlCharCheckingReader.cs
- ThrowHelper.cs
- StylusPlugInCollection.cs
- SourceFilter.cs
- ExceptionUtil.cs
- GridViewColumnHeader.cs
- HMACSHA384.cs
- DerivedKeySecurityTokenStub.cs
- PaperSize.cs
- EventDrivenDesigner.cs
- TextRangeAdaptor.cs
- SecurityDescriptor.cs
- PageWrapper.cs
- HttpCapabilitiesBase.cs
- ReadOnlyDataSource.cs
- Color.cs
- WindowsRegion.cs
- DataBoundControlHelper.cs