コード例 #1
0
        protected void AddElement(Location location, IElement element)
        {
            var placement = new ElementPlacement(location, element);

            _elements.Add(placement);

            if (_inLayout)
            {
                ConnectToElement(placement, _previousLayout);
            }
        }
コード例 #2
0
        private void DisconnectFromElement(ElementPlacement placement)
        {
            placement.Element.LeaveLayout();
            placement.Element.DrawElement -= ElementOnDrawElement;

            LayoutDrawElement[] layoutDrawElements = new LayoutDrawElement[placement.Element.ButtonCount.Height * placement.Element.ButtonCount.Width];
            int index = 0;

            for (byte x = 0; x < placement.Element.ButtonCount.Width; x++)
            {
                for (byte y = 0; y < placement.Element.ButtonCount.Height; y++)
                {
                    layoutDrawElements[index] = new LayoutDrawElement(new Location((byte)(placement.Location.X + x), (byte)(placement.Location.Y + y)), LayoutContext.CreateBitmap());
                    index++;
                }
            }

            DrawLayout?.Invoke(this, new DrawEventArgs(layoutDrawElements));
        }
コード例 #3
0
 public void Add(ElementPlacement placement)
 {
     _elementPlacements[placement.Location] = placement.Element;
     _elements[placement.Element]           = placement.Location;
 }