Наследование: WindowlessPanel
        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);
        }
        public ButtonDemo()
        {
            InitializeComponent();

            // we need to layer two controls on top of another: a background, with another panel containing more controls
            StackPanel stack = myHost.Control;
            OverlayPanel overlay = new OverlayPanel();
            stack.Controls.Add(overlay);

            // set up the background bitmap and control
            PlatformBitmap backgroundBitmap = PlatformBitmap.FromResource("Wallpaper.jpg");
            WindowlessImage background = new WindowlessImage(backgroundBitmap);
            background.Stretch = Stretch.Uniform;
            overlay.Controls.Add(background);

            // set up the foreground
            StackPanel foreground = new StackPanel();
            overlay.Controls.Add(foreground);

            // load the transparent images
            PlatformBitmap users = PlatformBitmap.FromResource("users.png");
            PlatformBitmap tip = PlatformBitmap.FromResource("tip.png");

            // the two buttons will be placed in a WrapPanel
            // a wrap panel will horizontally or vertically lay out elements in a given direction until it runs out of room in that direction.
            // when it runs out of room, it will "wrap" to the next line.
            // since this wrap panel is contained in a vertical stack panel, it will lay out elements horizontally, and wrap vertically to the next line.
            WrapPanel wrap = new WrapPanel();
            foreground.Controls.Add(wrap);

            // focus state bitmap
            PlatformBitmap focused = PlatformBitmap.FromResource("Btn1.png");
            // normal unselected state bitmap
            PlatformBitmap unfocused = PlatformBitmap.FromResource("Btn1_Disabled.png");
            // clicked state bitmap
            PlatformBitmap clicked = PlatformBitmap.FromResource("Btn1_Pushed.png");

            // set up the image button by setting the properties manually
            ImageButton button1 = new ImageButton(unfocused, Stretch.None);
            button1.Control.FocusedBitmap = focused;
            button1.Control.ClickedBitmap = clicked;
            button1.BackColor = Color.Transparent;

            // OR set the button up by setting everything in the constructor
            ImageButton button2 = new ImageButton(unfocused, Stretch.None, focused, clicked);
            button2.BackColor = Color.Transparent;

            // add the buttons
            wrap.Controls.Add(button1);
            wrap.Controls.Add(button2);
        }
        public HelloWorld()
        {
            InitializeComponent();

            // myHost is a Control that provides a transition from System.Windows.Forms to WindowlessControls.
            // myHost.Control is the WindowlessControls.WindowlessControl that is "hosted" in the Windows.Windows.Forms.Control.
            // put all the forms contents into a scrollHost, which will resize arbitrarily to fit its contents
            VerticalStackPanelHost scrollHost = new VerticalStackPanelHost();
            StackPanel stack = scrollHost.Control;
            stack.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Stretch;
            myHost.Control.Controls.Add(scrollHost);

            // enable auto scrolling on myHost so if the contents (scrollHost) are too big, scroll bars appear
            myHost.AutoScroll = true;

            // hello world!
            WindowlessLabel hello1 = new WindowlessLabel("Hello World!");
            stack.Controls.Add(hello1);

            // center this label and use a different font
            Font center = new Font(FontFamily.GenericSerif, 20, FontStyle.Regular);
            WindowlessLabel hello2 = new WindowlessLabel("Centered!", center);
            hello2.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Center;
            stack.Controls.Add(hello2);

            // right align this control
            WindowlessLabel right = new WindowlessLabel("Right Aligned!");
            right.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Right;
            stack.Controls.Add(right);

            // show that controls support margins
            WindowlessLabel margin = new WindowlessLabel("Margin!");
            margin.Margin = new Thickness(20, 20, 20, 20); // margins for the left, top, right, and bottom
            stack.Controls.Add(margin);

            // nest controls within another control and center the parent
            StackPanel child = new StackPanel();
            child.Controls.Add(new WindowlessLabel("Nested"));
            child.Controls.Add(new WindowlessLabel("Controls"));
            child.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Center;
            stack.Controls.Add(child);
            // create a clickable hyperlink
            HyperlinkButton button = new HyperlinkButton("Click Me!");
            child.Controls.Add(button);
            button.WindowlessClick += (s, e) =>
                {
                    MessageBox.Show("Hello!");
                };
            // when the hyperlink is clicked, the event will bubble up to every host in the hierarchy
            // watch for the event and handle it
            myHost.WindowlessClick += (s, e) =>
                {
                    if (s != myHost)
                    {
                        MessageBox.Show("A click event just bubbled up to me from " + s.GetType().ToString() + "!");
                    }
                };

            // draw a centered image
            PlatformBitmap bitmap = PlatformBitmap.FromResource("mybrainhurts.jpg");
            WindowlessImage image = new WindowlessImage(bitmap);
            image.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Center;
            stack.Controls.Add(image);
        }
        public ImageGallery()
        {
            InitializeComponent();

            VerticalStackPanelHost scrollHost = new VerticalStackPanelHost();
            StackPanel stack = scrollHost.Control;
            stack.HorizontalAlignment = WindowlessControls.HorizontalAlignment.Stretch;
            myHost.Control.Controls.Add(scrollHost);

            myHost.AutoScroll = true;

            // we need to layer two controls on top of another: a background, with another panel containing more controls
            OverlayPanel overlay = new OverlayPanel();
            stack.Controls.Add(overlay);

            // set up the background bitmap and control
            PlatformBitmap backgroundBitmap = PlatformBitmap.FromResource("Wallpaper.jpg");
            WindowlessImage background = new WindowlessImage(backgroundBitmap);
            background.Stretch = Stretch.Uniform;
            overlay.Controls.Add(background);

            // set up the foreground
            StackPanel foreground = new StackPanel();
            overlay.Controls.Add(foreground);

            // set up the ItemsControl which will hold the images
            myItemsControl.BackColor = Color.Transparent;
            // the images will be contained in a wrap panel
            myItemsControl.Control = new WrapPanel();
            // this tells the ItemsControl what is used to represent the content items
            myItemsControl.ContentPresenter = typeof(ImageResourcePresenter);
            foreground.Controls.Add(myItemsControl);

            // let's get a list of image resources
            Assembly ass = Assembly.GetCallingAssembly();
            string[] names = ass.GetManifestResourceNames();
            foreach (string name in names)
            {
                foreach (string extension in imageExtensions)
                {
                    if (name.EndsWith(extension, StringComparison.CurrentCultureIgnoreCase))
                    {
                        myItemsControl.Items.Add(name);
                        break;
                    }
                }
            }

            // now let's search the file system for images
            foreach (string name in Directory.GetFiles("\\My Documents\\My Pictures"))
            {
                foreach (string extension in imageExtensions)
                {
                    if (name.EndsWith(extension, StringComparison.CurrentCultureIgnoreCase))
                    {
                        myItemsControl.Items.Add(name);
                        break;
                    }
                }
            }
        }