Exemple #1
0
        public CrossSplitter(ControlBase parent)
            : base(parent)
        {
            m_CurZoom = 0;

            m_Splitter      = new Control.CrossSplitter(this);
            m_Splitter.Dock = Dock.Fill;

            {
                VerticalSplitter splitter = new VerticalSplitter(m_Splitter);
                Control.Button   button1  = new Control.Button(splitter);
                button1.Text = "Vertical left";
                Control.Button button2 = new Control.Button(splitter);
                button2.Text = "Vertical right";
                splitter.SetPanel(0, button1);
                splitter.SetPanel(1, button2);
                m_Splitter.SetPanel(0, splitter);
            }

            {
                HorizontalSplitter splitter = new HorizontalSplitter(m_Splitter);
                Control.Button     button1  = new Control.Button(splitter);
                button1.Text = "Horizontal up";
                Control.Button button2 = new Control.Button(splitter);
                button2.Text = "Horizontal down";
                splitter.SetPanel(0, button1);
                splitter.SetPanel(1, button2);
                m_Splitter.SetPanel(1, splitter);
            }

            {
                HorizontalSplitter splitter = new HorizontalSplitter(m_Splitter);
                Control.Button     button1  = new Control.Button(splitter);
                button1.Text = "Horizontal up";
                Control.Button button2 = new Control.Button(splitter);
                button2.Text = "Horizontal down";
                splitter.SetPanel(0, button1);
                splitter.SetPanel(1, button2);
                m_Splitter.SetPanel(2, splitter);
            }

            {
                VerticalSplitter splitter = new VerticalSplitter(m_Splitter);
                Control.Button   button1  = new Control.Button(splitter);
                button1.Text = "Vertical left";
                Control.Button button2 = new Control.Button(splitter);
                button2.Text = "Vertical right";
                splitter.SetPanel(0, button1);
                splitter.SetPanel(1, button2);
                m_Splitter.SetPanel(3, splitter);
            }

            //Status bar to hold unit testing buttons
            Control.StatusBar pStatus = new Control.StatusBar(this);
            pStatus.Dock = Dock.Bottom;

            {
                Control.Button pButton = new Control.Button(pStatus);
                pButton.Text     = "Zoom";
                pButton.Clicked += ZoomTest;
                pStatus.AddControl(pButton, false);
            }

            {
                Control.Button pButton = new Control.Button(pStatus);
                pButton.Text     = "UnZoom";
                pButton.Clicked += UnZoomTest;
                pStatus.AddControl(pButton, false);
            }

            {
                Control.Button pButton = new Control.Button(pStatus);
                pButton.Text     = "CenterPanels";
                pButton.Clicked += CenterPanels;
                pStatus.AddControl(pButton, true);
            }

            {
                Control.Button pButton = new Control.Button(pStatus);
                pButton.Text     = "Splitters";
                pButton.Clicked += ToggleSplitters;
                pStatus.AddControl(pButton, true);
            }
        }
Exemple #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);


            //
            HorizontalSplitter splitter = new HorizontalSplitter(this);

            splitter.Dock = Pos.Fill;

            Base topContainer = new Base(splitter);

            topContainer.Dock = Pos.Fill;

            Base bottomContainer = new Base(splitter);

            bottomContainer.Dock = Pos.Fill;

            splitter.SetPanel(0, topContainer);
            splitter.SetPanel(1, bottomContainer);
            splitter.SetVValue(0.35f);
            splitter.Margin = new Margin(5);


            //  Top
            Alt.GUI.Temporary.Gwen.Control.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(topContainer);
            label.Text               = "HtmlLabel:";
            label.Dock               = Pos.Top;
            label.Alignment          = Pos.Center;
            label.AutoSizeToContents = true;
            label.TextColor          = Color.Green;
            label.Margin             = new Margin(2, 2, 2, 5);

            _htmlLabelHostingPanel        = new DoubleBufferedControl(topContainer);
            _htmlLabelHostingPanel.Dock   = Pos.Fill;
            _htmlLabelHostingPanel.Paint += new GUI.PaintEventHandler(OnHtmlLabelHostingPanelPaint);

            _htmlLabel                    = new Alt.GUI.HtmlRenderer.Temporary.Gwen.HtmlLabel(_htmlLabelHostingPanel);
            _htmlLabel.Dock               = Pos.Fill;
            _htmlLabel.AutoSize           = false;
            _htmlLabel.AutoSizeHeightOnly = true;
            _htmlLabel.BackColor          = Color.Empty;// Transparent;
            _htmlLabel.BaseStylesheet     = null;
            _htmlLabel.Text               = "This is an <b>HtmlLabel</b> on transparent background with <span style=\"color: re" +
                                            "d\">colors</span> and links: <a href=\"http://htmlrenderer.codeplex.com/\">HTML Renderer</a>";


            //  Bottom
            label                    = new Alt.GUI.Temporary.Gwen.Control.Label(bottomContainer);
            label.Text               = "HtmlPanel:";
            label.Dock               = Pos.Top;
            label.Alignment          = Pos.Center;
            label.AutoSizeToContents = true;
            label.TextColor          = Color.Green;
            label.Margin             = new Margin(2, 2, 2, 5);

            _changeTooltipButton        = new Alt.GUI.Temporary.Gwen.Control.Button(bottomContainer);
            _changeTooltipButton.Dock   = Pos.Bottom;
            _changeTooltipButton.Text   = "Click me to change tooltip";
            _changeTooltipButton.Click += new System.EventHandler(OnButtonClick);

            _htmlToolTip = new Alt.GUI.HtmlRenderer.Temporary.Gwen.HtmlToolTip(_changeTooltipButton);
            _htmlToolTip.SetToolTip(_changeTooltipButton, "When you click this button, this tooltip will be replaced for the text of the <b>HtmlLabel</b>");

            _htmlPanel                = new Alt.GUI.HtmlRenderer.Temporary.Gwen.HtmlPanel(bottomContainer);
            _htmlPanel.Dock           = Pos.Fill;
            _htmlPanel.AutoScroll     = true;
            _htmlPanel.BackColor      = Color.White;
            _htmlPanel.BaseStylesheet = null;
            _htmlPanel.Text           = HtmlRenderer.Resources.SampleForm_HtmlPanel;


            //
            Center();


            //
            Bitmap bmp = new Bitmap(10, 10);

            using (Graphics g = Graphics.FromImage(bmp))
            {
                g.Clear(Color.White);
                g.FillRectangle(Brushes.LightGray, new RectI(0, 0, 5, 5));
                g.FillRectangle(Brushes.LightGray, new RectI(5, 5, 5, 5));
            }

            m_TransparentBGBrush = new TextureBrush(bmp, WrapMode.Tile);
        }