상속: WindowlessPaintControl
예제 #1
0
        public DropdownControl(WindowlessControlHost dropdownSource, IWindowlessControl dropdownContent)
        {
            AutoScroll = true;
            Orientation = Orientation.Vertical;
            myDropdownSource = dropdownSource;

            OverlayPanel overlay = new OverlayPanel();
            WindowlessRectangle rectangle = new WindowlessRectangle();
            rectangle.Color = SystemColors.ControlDarkDark;
            rectangle.Filled = false;
            overlay.Controls.Add(rectangle);

            OverlayPanel inner = new OverlayPanel();
            inner.Margin = new Thickness(1, 1, 1, 1);
            inner.Controls.Add(dropdownContent);
            overlay.Controls.Add(inner);
            overlay.FitHeightControl = overlay.FitWidthControl = inner;
            Control = overlay;
        }
        public StationPresenter()
        {
            OverlayPanel overlay = new OverlayPanel();

            // stretch to fit
            overlay.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Stretch;
            overlay.VerticalAlignment = VerticalAlignment.Stretch;

            // dock the picture to the right and the info to the left
            DockPanel dock = new DockPanel();
            StackPanel left = new StackPanel();
            left.Layout = new DockLayout(new LayoutMeasurement(0, LayoutUnit.Star), DockStyle.Left);
            //m_Image.Layout = new DockLayout(new LayoutMeasurement(0, LayoutUnit.Star), DockStyle.Right);
            //m_Image.MaxHeight = 100;
            //m_Image.MaxWidth = 100;

            //dock.Controls.Add(m_Image);

            m_Distance.Layout = new DockLayout(new LayoutMeasurement(0, LayoutUnit.Star), DockStyle.Right);
            m_Distance.MaxHeight = 100;
            m_Distance.MaxWidth = 100;

            dock.Controls.Add(m_Distance);

            dock.Controls.Add(left);
            // 5 pixel border around the item contents
            dock.Margin = new Thickness(5, 5, 5, 5);

            // make the overlay fit the dock, so as to limit the size of the selection rectangle
            overlay.FitWidthControl = overlay.FitHeightControl = dock;

            // set up the rectangle color and make it fill the region
            m_Rectangle.Color = SystemColors.Highlight;
            m_Rectangle.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Stretch;
            m_Rectangle.VerticalAlignment = VerticalAlignment.Stretch;
            // the rectangle does not paint by default
            m_Rectangle.PaintSelf = false;

            // add the extended info that is only visible when focused
            StackPanel nameAndNumber = new StackPanel();
            nameAndNumber.Controls.Add(m_StationName);
            nameAndNumber.Controls.Add(m_StationNumber);
            m_ExtendedInfo.Visible = false;
            m_ExtendedInfo.Controls.Add(m_StationAddress);

            // set up the left side
            left.Controls.Add(nameAndNumber);
            left.Controls.Add(m_ExtendedInfo);

            // add the foreground and the background selection
            overlay.Controls.Add(m_Rectangle);
            overlay.Controls.Add(dock);

            // add the item
            Controls.Add(overlay);

            // this is the bottom border
            WindowlessRectangle bottomBorder = new WindowlessRectangle(Int32.MaxValue, 1, Color.Gray);
            Controls.Add(bottomBorder);
        }