예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);


#if !SILVERLIGHT
            m_OpenExternalViewButton        = new Alt.GUI.Temporary.Gwen.Control.Button(m_LeftPanel);
            m_OpenExternalViewButton.Text   = "Open External View";
            m_OpenExternalViewButton.Dock   = Pos.Bottom;
            m_OpenExternalViewButton.Margin = new Margin(2, 5, 2, 0);
            m_OpenExternalViewButton.Click += new EventHandler(OnOpenExternalViewButtonClick);

            m_ShowGeneratedHtmlCB           = new LabeledCheckBox(m_LeftPanel);
            m_ShowGeneratedHtmlCB.Text      = "Show generated HTML";
            m_ShowGeneratedHtmlCB.Dock      = Pos.Bottom;
            m_ShowGeneratedHtmlCB.Margin    = new Margin(2, 10, 2, 2);
            m_ShowGeneratedHtmlCB.IsChecked = true;
#endif

            m_ShowTooltip        = new LabeledCheckBox(m_LeftPanel);
            m_ShowTooltip.Text   = "Show Tooltip";
            m_ShowTooltip.Dock   = Pos.Bottom;
            m_ShowTooltip.Margin = new Margin(2, 10, 2, 2);
            //m_ShowTooltip.IsChecked = true;
            m_ShowTooltip.CheckChanged += new GwenEventHandler(ShowTooltip_CheckChanged);

#if !SILVERLIGHT
            m_AntiAliasText        = new LabeledCheckBox(m_LeftPanel);
            m_AntiAliasText.Text   = "AntiAlias Text";
            m_AntiAliasText.Dock   = Pos.Bottom;
            m_AntiAliasText.Margin = new Margin(2, 10, 2, 2);
            //m_AntiAliasText.IsChecked = true;
            m_AntiAliasText.CheckChanged += new GwenEventHandler(AntiAliasText_CheckChanged);
#endif



            //  HtmlPanel
            m_HtmlPanel      = new Alt.GUI.HtmlRenderer.Temporary.Gwen.HtmlPanel(m_RightPanel);
            m_HtmlPanel.Dock = Pos.Fill;
            m_HtmlPanel.ShouldDrawBackground = false;
            m_HtmlPanel.TextRenderingHint    = TextRenderingHint.Default;

            m_HtmlPanel.AutoScroll     = true;
            m_HtmlPanel.BackColor      = Color.White;
            m_HtmlPanel.BaseStylesheet = null;

            m_HtmlPanel.RenderError    += OnRenderError;
            m_HtmlPanel.LinkClicked    += OnLinkClicked;
            m_HtmlPanel.StylesheetLoad += OnStylesheetLoad;
            m_HtmlPanel.ImageLoad      += OnImageLoad;



            //  HtmlToolTip
            m_HtmlToolTip            = new Alt.GUI.HtmlRenderer.Temporary.Gwen.HtmlToolTip(m_HtmlPanel);
            m_HtmlToolTip.ImageLoad += OnImageLoad;
            //m_HtmlToolTip.SetToolTip(m_HtmlPanel, HtmlRenderer.Resources.Tooltip);


            SelectFirstExample();
        }
예제 #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);
        }