Exemple #1
0
        private void InitializeComponent()
        {
            this.pictureTracker            = new PictureTracker();
            this.scalablePictureBoxImpNew1 = new scalablePictureBoxImpNew();
            this.SuspendLayout();
            //
            // pictureTracker
            //
            this.pictureTracker.BackColor = System.Drawing.Color.Lavender;
            this.pictureTracker.Location  = new System.Drawing.Point(550, 10);
            this.pictureTracker.Name      = "pictureTracker";
            this.pictureTracker.Size      = new System.Drawing.Size(137, 102);

            this.pictureTracker.TabIndex   = 0;
            this.pictureTracker.ZoomRate   = 0D;
            this.pictureTracker.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureTracker_MouseDown);
            this.pictureTracker.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureTracker_MouseMove);
            this.pictureTracker.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.pictureTracker_MouseUp);
            //
            // scalablePictureBoxImpNew1
            //
            this.scalablePictureBoxImpNew1.AutoScroll        = true;
            this.scalablePictureBoxImpNew1.AutoScrollMinSize = new System.Drawing.Size(0, 8);
            this.scalablePictureBoxImpNew1.CurrentImage      = null;
            this.scalablePictureBoxImpNew1.Dock             = System.Windows.Forms.DockStyle.Fill;
            this.scalablePictureBoxImpNew1.Document         = null;
            this.scalablePictureBoxImpNew1.ImagePreviewMode = PreviewMode.PAN;
            this.scalablePictureBoxImpNew1.Location         = new System.Drawing.Point(0, 0);
            this.scalablePictureBoxImpNew1.Name             = "scalablePictureBoxImpNew1";
            this.scalablePictureBoxImpNew1.Size             = new System.Drawing.Size(586, 417);
            this.scalablePictureBoxImpNew1.TabIndex         = 1;

            //
            // HTFImageViewerNew
            //
            this.Controls.Add(this.pictureTracker);
            this.Controls.Add(this.scalablePictureBoxImpNew1);
            this.Name = "HTFImageViewerNew";
            this.Size = new System.Drawing.Size(586, 417);
            this.ResumeLayout(false);
        }
Exemple #2
0
 //Inertia is completed, we can reuse the object
 public void Completed(PictureTracker pictureTracker)
 {
     pictureTracker.Picture = null;
     _pictureTrackers.Push(pictureTracker);
 }
Exemple #3
0
 //We remove the touchID from the tracking map since the fingers are no longer touch
 //the picture
 public void InInertia(PictureTracker pictureTracker)
 {
     //remove all touch id from the map
     foreach (uint id in
         (from KeyValuePair<uint, PictureTracker> entry in _pictureTrackerMap
          where entry.Value == pictureTracker
          select entry.Key).ToList())
     {
         _pictureTrackerMap.Remove(id);
     }
 }
Exemple #4
0
            private PictureTracker GetPictureTracker(uint touchId, System.Drawing.Point location)
            {
                PictureTracker pictureTracker;

                //See if we already track the picture with the touchId
                if (_pictureTrackerMap.TryGetValue(touchId, out pictureTracker))
                    return pictureTracker;

                //Get the picture under the touch location
                Picture picture = FindPicture(location);

                if (picture == null)
                    return null;

                //See if we track the picture with other ID
                pictureTracker = (from KeyValuePair<uint, PictureTracker> entry in _pictureTrackerMap
                                  where entry.Value.Picture == picture
                                  select entry.Value).FirstOrDefault();
                
                //First time
                if (pictureTracker == null)
                {
                    //take from stack
                    if (_pictureTrackers.Count > 0)
                        pictureTracker = _pictureTrackers.Pop();
                    else //create new
                        pictureTracker = new PictureTracker(this, _form);

                    pictureTracker.Picture = picture;
                    BringPictureToFront(picture);
                }
                
                //remember the corelation between the touch id and the picture
                _pictureTrackerMap[touchId] = pictureTracker;

                return pictureTracker;
            }