예제 #1
0
파일: Element.cs 프로젝트: ikvm/webmatrix
 internal void SetLogicalElement(VisualElement element)
 {
     this._logicalElement = element;
 }
예제 #2
0
 public void Add(VisualElement element)
 {
     this._elements.Add(element);
 }
예제 #3
0
 private bool UpdateTrackingElement(VisualElement element)
 {
     if (element == this._hotElement)
     {
         return false;
     }
     if (this._hotElement != null)
     {
         this._hotElement.EndTracking();
         this._hotElement = null;
     }
     Cursor hand = Cursors.Default;
     this._hotElement = element;
     if (this._hotElement != null)
     {
         this._hotElement.BeginTracking();
         if (this._hotElement.Clickable)
         {
             hand = Cursors.Hand;
         }
     }
     this.Cursor = hand;
     base.Invalidate();
     return true;
 }
예제 #4
0
 private void UpdateRendering(bool maintainLocality)
 {
     Point autoScrollPosition = base.AutoScrollPosition;
     int num = this._focusIndex;
     if (num != -1)
     {
         ((VisualElement) this._focusableElements[num]).SetFocus(false);
     }
     if (this._hotElement != null)
     {
         this._hotElement.EndTracking();
         this._hotElement = null;
     }
     this._trackedElements = null;
     this._focusIndex = -1;
     this._focusableElements = null;
     if (base.IsHandleCreated)
     {
         Size empty = Size.Empty;
         if (this._page != null)
         {
             using (Graphics graphics = base.CreateGraphics())
             {
                 empty = this.CalculateRendering(graphics);
             }
         }
         base.AutoScrollMinSize = empty;
         if (maintainLocality)
         {
             if (((num != -1) && (this._focusableElements != null)) && (this._focusableElements.Count > num))
             {
                 this._focusIndex = num;
                 ((VisualElement) this._focusableElements[this._focusIndex]).SetFocus(true);
             }
             base.AutoScrollPosition = new Point(-autoScrollPosition.X, -autoScrollPosition.Y);
         }
         this.UpdateToolTip();
         base.Invalidate();
     }
 }
예제 #5
0
 void IContentElementHost.AddTrackedElement(VisualElement element)
 {
     if (element.RequiresTracking)
     {
         if (this._trackedElements == null)
         {
             this._trackedElements = new ArrayList();
         }
         this._trackedElements.Add(element);
     }
     if (element.Clickable)
     {
         if (this._focusableElements == null)
         {
             this._focusableElements = new ArrayList();
         }
         this._focusableElements.Add(element);
     }
 }
예제 #6
0
 public void EnsureVisible(VisualElement element)
 {
     Point autoScrollPosition = base.AutoScrollPosition;
     Rectangle contentBounds = element.ContentBounds;
     Rectangle clientRectangle = base.ClientRectangle;
     contentBounds.Inflate(2, 2);
     clientRectangle.Offset(-autoScrollPosition.X, -autoScrollPosition.Y);
     if (!clientRectangle.Contains(contentBounds))
     {
         Point location = contentBounds.Location;
         clientRectangle = base.ClientRectangle;
         clientRectangle.Offset(location.X, -autoScrollPosition.Y);
         if (clientRectangle.Contains(contentBounds))
         {
             location = new Point(location.X, -autoScrollPosition.Y);
         }
         base.AutoScrollPosition = location;
     }
 }