Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties ImageListViewItem #31

Closed
GoogleCodeExporter opened this issue Jul 28, 2015 · 2 comments
Closed

Properties ImageListViewItem #31

GoogleCodeExporter opened this issue Jul 28, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Ozgur,

I am not sure why you have set the majority of the ImageListViewItem
properties to Browsable(false). Since the EXIF properties can be nicely
used in a PropertyGrid, I suggest to group them and reverse the Browsable()
settings. Enclosed my proposal:

Keep-on coding

Rob


#region Properties
        /// <summary>
        /// Gets or sets the background color of the item.
        /// </summary>
        [Category("Appearance"), Browsable(false), Description("Gets or
sets the background color of the item."), DefaultValue(typeof(Color),
"Transparent")]
        public Color BackColor
        {
            get
            {
                return mBackColor;
            }
            set
            {
                if (value != mBackColor)
                {
                    mBackColor = value;
                    if (mImageListView != null)
                        mImageListView.Refresh();
                }
            }
        }
        /// <summary>
        /// Gets the cache state of the item thumbnail.
        /// </summary>
        [Category("Behavior"), Browsable(false), Description("Gets the
cache state of the item thumbnail.")]
        public CacheState ThumbnailCacheState { get { return
mImageListView.cacheManager.GetCacheState(mGuid); } }
        /// <summary>
        /// Gets a value determining if the item is focused.
        /// </summary>
        [Category("Appearance"), Browsable(false), Description("Gets a
value determining if the item is focused.")]
        public bool Focused
        {
            get
            {
                if (owner == null || owner.FocusedItem == null) return false;
                return (this == owner.FocusedItem);
            }
            set
            {
                if (owner != null)
                    owner.FocusedItem = this;
            }
        }
        /// <summary>
        /// Gets or sets the foreground color of the item.
        /// </summary>
        [Category("Appearance"), Browsable(true), Description("Gets or sets
the foreground color of the item."), DefaultValue(typeof(Color), "WindowText")]
        public Color ForeColor
        {
            get
            {
                return mForeColor;
            }
            set
            {
                if (value != mForeColor)
                {
                    mForeColor = value;
                    if (mImageListView != null)
                        mImageListView.Refresh();
                }
            }
        }
        /// <summary>
        /// Gets the unique identifier for this item.
        /// </summary>
        [Category("Behavior"), Browsable(false), Description("Gets the
unique identifier for this item.")]
        internal Guid Guid { get { return mGuid; } private set { mGuid =
value; } }
        /// <summary>
        /// Gets the virtual item key associated with this item.
        /// Returns null if the item is not a virtual item.
        /// </summary>
        [Category("Behavior"), Browsable(false), Description("Gets the
virtual item key associated with this item.")]
        public object VirtualItemKey { get { return mVirtualItemKey; } }
        /// <summary>
        /// Gets the ImageListView owning this item.
        /// </summary>
        [Category("Behavior"), Browsable(false), Description("Gets the
ImageListView owning this item.")]
        public ImageListView ImageListView { get { return mImageListView; }
private set { mImageListView = value; } }
        /// <summary>
        /// Gets the index of the item.
        /// </summary>
        [Category("Behavior"), Browsable(false), Description("Gets the
index of the item."), EditorBrowsable(EditorBrowsableState.Advanced)]
        public int Index { get { return mIndex; } }
        /// <summary>
        /// Gets or sets a value determining if the item is selected.
        /// </summary>
        [Category("Appearance"), Browsable(false), Description("Gets or
sets a value determining if the item is selected."), DefaultValue(false)]
        public bool Selected
        {
            get
            {
                return mSelected;
            }
            set
            {
                if (value != mSelected)
                {
                    mSelected = value;
                    if (mImageListView != null)
                        mImageListView.OnSelectionChangedInternal();
                }
            }
        }
        /// <summary>
        /// Gets or sets the user-defined data associated with the item.
        /// </summary>
        [Category("Data"), Browsable(false), Description("Gets or sets the
user-defined data associated with the item.")]
        public object Tag { get; set; }
        /// <summary>
        /// Gets or sets the text associated with this item. If left blank,
item Text 
        /// reverts to the name of the image file.
        /// </summary>
        [Category("Appearance"), Browsable(true), Description("Gets or sets
the text associated with this item. If left blank, item Text reverts to the
name of the image file.")]
        public string Text
        {
            get
            {
                return mText;
            }
            set
            {
                mText = value;
                if (mImageListView != null)
                    mImageListView.Refresh();
            }
        }
        /// <summary>
        /// Gets the thumbnail image. If the thumbnail image is not cached,
it will be 
        /// added to the cache queue and DefaultImage of the owner image
list view will
        /// be returned. If the thumbnail could not be cached ErrorImage of
the owner
        /// image list view will be returned.
        /// </summary>
        [Category("Appearance"), Browsable(false), Description("Gets the
thumbnail image.")]
        public Image ThumbnailImage
        {
            get
            {
                if (mImageListView == null)
                    throw new InvalidOperationException("Owner control is
null.");

                CacheState state = ThumbnailCacheState;
                if (state == CacheState.Error)
                    return mImageListView.ErrorImage;

                Image img = mImageListView.cacheManager.GetImage(Guid);
                if (img != null)
                    return img;

                if (isVirtualItem)
                    mImageListView.cacheManager.Add(Guid, mVirtualItemKey,
mImageListView.ThumbnailSize, mImageListView.UseEmbeddedThumbnails);
                else
                    mImageListView.cacheManager.Add(Guid, FileName,
mImageListView.ThumbnailSize, mImageListView.UseEmbeddedThumbnails);
                return mImageListView.DefaultImage;
            }
        }
        /// <summary>
        /// Gets or sets the draw order of the item.
        /// </summary>
        [Category("Appearance"), Browsable(false), Description("Gets or
sets the draw order of the item."), DefaultValue(0)]
        public int ZOrder { get { return mZOrder; } set { mZOrder = value; } }
        /// <summary>
        /// Gets the last access date of the image file represented by this
item.
        /// </summary>
        [Category("Date Information"), Browsable(true), Description("Gets
the last access date of the image file represented by this item.")]
        public DateTime DateAccessed { get { UpdateFileInfo(); return
mDateAccessed; } }
        /// <summary>
        /// Gets the creation date of the image file represented by this item.
        /// </summary>
        [Category("Date Information"), Browsable(true), Description("Gets
the creation date of the image file represented by this item.")]
        public DateTime DateCreated { get { UpdateFileInfo(); return
mDateCreated; } }
        /// <summary>
        /// Gets the modification date of the image file represented by
this item.
        /// </summary>
        [Category("Date Information"), Browsable(true), Description("Gets
the modification date of the image file represented by this item.")]
        public DateTime DateModified { get { UpdateFileInfo(); return
mDateModified; } }
        /// <summary>
        /// Gets the shell type of the image file represented by this item.
        /// </summary>
        [Category("File Information"), Browsable(true), Description("Gets
the shell type of the image file represented by this item.")]
        public string FileType { get { UpdateFileInfo(); return mFileType; } }
        /// <summary>
        /// Gets or sets the name of the image fie represented by this item.
        /// </summary>        
        [Category("File Information"), Browsable(true), Description("Gets
or sets the name of the image fie represented by this item.")]
        public string FileName
        {
            get
            {
                return mFileName;
            }
            set
            {
                if (mFileName != value)
                {
                    mFileName = value;
                    if (!isVirtualItem)
                    {
                        isDirty = true;
                        if (mImageListView != null)
                        {
                            mImageListView.cacheManager.Remove(Guid);
                            mImageListView.itemCacheManager.Add(this);
                            mImageListView.Refresh();
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Gets the path of the image fie represented by this item.
        /// </summary>        
        [Category("File Information"), Browsable(true), Description("Gets
the path of the image fie represented by this item.")]
        public string FilePath { get { UpdateFileInfo(); return mFilePath; } }
        /// <summary>
        /// Gets file size in bytes.
        /// </summary>
        [Category("File Information"), Browsable(true), Description("Gets
file size in bytes.")]
        public long FileSize { get { UpdateFileInfo(); return mFileSize; } }
        /// <summary>
        /// Gets image dimensions.
        /// </summary>
        [Category("Image Information"), Browsable(true), Description("Gets
image dimensions.")]
        public Size Dimensions { get { UpdateFileInfo(); return
mDimensions; } }
        /// <summary>
        /// Gets image resolution in pixels per inch.
        /// </summary>
        [Category("Image Information"), Browsable(true), Description("Gets
image resolution in pixels per inch.")]
        public SizeF Resolution { get { UpdateFileInfo(); return
mResolution; } }
        /// <summary>
        /// Gets image deascription.
        /// </summary>
        [Category("Information"), Browsable(true), Description("Gets image
deascription.")]
        public string ImageDescription { get { UpdateFileInfo(); return
mImageDescription; } }
        /// <summary>
        /// Gets the camera model.
        /// </summary>
        [Category("Camera Information"), Browsable(true), Description("Gets
the camera model.")]
        public string EquipmentModel { get { UpdateFileInfo(); return
mEquipmentModel; } }
        /// <summary>
        /// Gets the date and time the image was taken.
        /// </summary>
        [Category("Date Information"), Browsable(true), Description("Gets
the date and time the image was taken.")]
        public DateTime DateTaken { get { UpdateFileInfo(); return
mDateTaken; } }
        /// <summary>
        /// Gets the name of the artist.
        /// </summary>
        [Category("Information"), Browsable(true), Description("Gets the
name of the artist.")]
        public string Artist { get { UpdateFileInfo(); return mArtist; } }
        /// <summary>
        /// Gets image copyright information.
        /// </summary>
        [Category("Information"), Browsable(true), Description("Gets image
copyright information.")]
        public string Copyright { get { UpdateFileInfo(); return
mCopyright; } }
        /// <summary>
        /// Gets the exposure time in seconds.
        /// </summary>
        [Category("Camera Information"), Browsable(true), Description("Gets
the exposure time in seconds.")]
        public string ExposureTime { get { UpdateFileInfo(); return
mExposureTime; } }
        /// <summary>
        /// Gets the F number.
        /// </summary>
        [Category("Camera Information"), Browsable(true), Description("Gets
the F number.")]
        public float FNumber { get { UpdateFileInfo(); return mFNumber; } }
        /// <summary>
        /// Gets the ISO speed.
        /// </summary>
        [Category("Camera Information"), Browsable(true), Description("Gets
the ISO speed.")]
        public ushort ISOSpeed { get { UpdateFileInfo(); return mISOSpeed; } }
        /// <summary>
        /// Gets the shutter speed.
        /// </summary>
        [Category("Camera Information"), Browsable(true), Description("Gets
the shutter speed.")]
        public string ShutterSpeed { get { UpdateFileInfo(); return
mShutterSpeed; } }
        /// <summary>
        /// Gets the lens aperture value.
        /// </summary>
        [Category("Camera Information"), Browsable(true), Description("Gets
the lens aperture value.")]
        public string Aperture { get { UpdateFileInfo(); return mAperture; } }
        /// <summary>
        /// Gets user comments.
        /// </summary>
        [Category("Information"), Browsable(true), Description("Gets user
comments.")]
        public string UserComment { get { UpdateFileInfo(); return
mUserComment; } }
        #endregion

Original issue reported on code.google.com by [email protected] on 28 Feb 2010 at 11:16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants