private void InitAnchor() { string anchorTypeStr = GetAttributeValue(_skin, "anchor", "top,left"); float anchorDx = GetNumberFromAttribute(_skin, "anchor_dx", 0); float anchorDy = GetNumberFromAttribute(_skin, "anchor_dy", 0); DockAnchor.Type anchorType = DockAnchor.Type.None; foreach (string i in anchorTypeStr.ToLower().Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)) { switch (i) { case "top": anchorType |= DockAnchor.Type.Top; break; case "bottom": anchorType |= DockAnchor.Type.Bottom; break; case "right": anchorType |= DockAnchor.Type.Right; break; case "left": anchorType |= DockAnchor.Type.Left; break; case "center": anchorType |= DockAnchor.Type.Center; break; } } Display.InitializeAnchor(anchorType, anchorDx, anchorDy); }
internal void Initialize(DockAnchor.Type type, double dx, double dy) { _anchorType = type; _anchorDx = 0.5 /*dx*/; _anchorDy = 0.5 /*dy*/; if ((_anchorType & DockAnchor.Type.Left) != 0) { _anchorDx = 0; } else if ((_anchorType & DockAnchor.Type.Right) != 0) { _anchorDx = 1; } else { _anchorDx = 0.5; } if ((_anchorType & DockAnchor.Type.Top) != 0) { _anchorDy = 0; } else if ((_anchorType & DockAnchor.Type.Bottom) != 0) { _anchorDy = 1; } else { _anchorDy = 0.5; } Win32.Point anchorPos = CalculatePositionFromWindow(); _anchorX = anchorPos.x; _anchorY = anchorPos.y; }
internal void InitializeAnchor(DockAnchor.Type anchorType, float anchorDx, float anchorDy) { _dockAnchor.Initialize(anchorType, anchorDx, anchorDy); }