Example #1
0
        /* ----------------------------------------------------------------- */
        /// Create (private)
        /* ----------------------------------------------------------------- */
        private void Create(Control parent, Control src)
        {
            if (src == null)
            {
                return;
            }
            var src_engine = src.Tag as CanvasEngine;

            if (src_engine == null)
            {
                return;
            }

            this.Name        = "Thumbnail";
            this.BackColor   = Color.DimGray;
            this.Alignment   = ListViewAlignment.Default;
            this.MultiSelect = false;
            this.Dock        = DockStyle.Fill;
            this.OwnerDraw   = true;

            lock (lock_) {
                engine_ = new ThumbEngine(src_engine.Core, 256);
                engine_.ImageGenerated -= new ThumbEventHandler(ImageGeneratedHandler);
                engine_.ImageGenerated += new ThumbEventHandler(ImageGeneratedHandler);
            }

            parent.Controls.Add(this);
            this.Restruct(this);

            this.DrawItem   -= new DrawListViewItemEventHandler(DrawItemHandler);
            this.DrawItem   += new DrawListViewItemEventHandler(DrawItemHandler);
            this.Resize     -= new EventHandler(ResizeHandler);
            this.Resize     += new EventHandler(ResizeHandler);
            this.MouseEnter -= new EventHandler(MouseEnterHandler);
            this.MouseEnter += new EventHandler(MouseEnterHandler);
        }
Example #2
0
        /* ----------------------------------------------------------------- */
        /// Create (private)
        /* ----------------------------------------------------------------- */
        private void Create(Control parent, Control src)
        {
            if (src == null) return;
            var src_engine = src.Tag as CanvasEngine;
            if (src_engine == null) return;

            this.Name = "Thumbnail";
            this.BackColor = Color.DimGray;
            this.Alignment = ListViewAlignment.Default;
            this.MultiSelect = false;
            this.Dock = DockStyle.Fill;
            this.OwnerDraw = true;

            lock (lock_) {
                engine_ = new ThumbEngine(src_engine.Core, 256);
                engine_.ImageGenerated -= new ThumbEventHandler(ImageGeneratedHandler);
                engine_.ImageGenerated += new ThumbEventHandler(ImageGeneratedHandler);
            }

            parent.Controls.Add(this);
            this.Restruct(this);

            this.DrawItem -= new DrawListViewItemEventHandler(DrawItemHandler);
            this.DrawItem += new DrawListViewItemEventHandler(DrawItemHandler);
            this.Resize -= new EventHandler(ResizeHandler);
            this.Resize += new EventHandler(ResizeHandler);
            this.MouseEnter -= new EventHandler(MouseEnterHandler);
            this.MouseEnter += new EventHandler(MouseEnterHandler);
        }
Example #3
0
 /* ----------------------------------------------------------------- */
 /// Dispose
 /* ----------------------------------------------------------------- */
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     try {
         if (disposing) {
             lock (lock_) {
                 if (engine_ != null) {
                     engine_.ImageGenerated -= new ThumbEventHandler(ImageGeneratedHandler);
                     engine_.Dispose();
                     engine_ = null;
                 }
             }
         }
     }
     catch (Exception err) {
         Utility.ErrorLog(err);
     }
 }