protected override Skybound.VisualTips.Rendering.VisualTipLayout OnCreateLayout(Skybound.VisualTips.VisualTip tip)
 {
     Skybound.VisualTips.Rendering.VisualTipLayout visualTipLayout = base.OnCreateLayout(tip);
     visualTipLayout.OffsetWindow(4, 18);
     visualTipLayout.WindowBounds = System.Drawing.Rectangle.Inflate(visualTipLayout.WindowBounds, 4, 2);
     System.Drawing.Rectangle rectangle1 = visualTipLayout.ShadowBounds;
     System.Drawing.Rectangle rectangle2 = visualTipLayout.ShadowBounds;
     visualTipLayout.ShadowBounds = new System.Drawing.Rectangle(rectangle1.Location, rectangle2.Size + (new System.Drawing.Size(8, 32)));
     return(visualTipLayout);
 }
        protected virtual Skybound.VisualTips.Rendering.VisualTipLayout OnCreateLayout(Skybound.VisualTips.VisualTip tip)
        {
            Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout imageAndTextLayout2;

            Skybound.VisualTips.Rendering.VisualTipLayout visualTipLayout = new Skybound.VisualTips.Rendering.VisualTipLayout();
            string s1 = GetTitleText(tip);
            string s2 = GetBodyText(tip);
            bool flag1 = s1.Length > 0;
            bool flag2 = (s2.Length > 0) || (tip.Image != null);
            System.Drawing.Font font1 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Title);
            System.Drawing.Font font2 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Text);
            System.Drawing.Font font3 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText);
            System.Drawing.Font font4 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage);
            System.Drawing.Size size1 = MeasureText(s1, font1, 0);
            int i1 = flag1 ? size1.Width : 0;
            System.Drawing.Size size2 = MeasureText(s2, font2, 0);
            int i2 = flag2 ? size2.Width : 0;
            System.Drawing.Size size3 = MeasureText(tip.FooterText, font3, 0);
            int i3 = HasFooter(tip) ? size3.Width : 0;
            if (!tip.Enabled && (tip.DisabledMessage.Length > 0))
            {
                System.Drawing.Size size4 = MeasureText(tip.DisabledMessage, font4, 0);
                i2 = System.Math.Max(size4.Width, i2);
            }
            if (tip.TitleImage != null)
                i1 += tip.TitleImage.Width + 6;
            if (tip.Image != null)
                i2 += tip.Image.Width + 6;
            if (HasFooter(tip) && (tip.FooterImage != null))
                i3 += tip.FooterImage.Width + 6;
            int i4 = System.Math.Max(System.Math.Max(i1, i2), i3);
            int i5 = System.Math.Min(tip.MaximumWidth - 6 - 6, i4);
            int i6 = 6;
            Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout imageAndTextLayout1 = new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.TitleImage, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Title), s1, null, "", i5, 6);
            imageAndTextLayout1.Offset(6, 6);
            if (imageAndTextLayout1.Bounds.Height > 0)
                i6 += imageAndTextLayout1.Bounds.Height + 6;
            if (tip.Enabled)
                imageAndTextLayout2 = new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.Image, null, "", GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Text), s2, i5, 6);
            else
                imageAndTextLayout2 = new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.Image, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage), tip.DisabledMessage, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Text), s2, i5, 6);
            imageAndTextLayout2.Offset(6, i6);
            if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
                imageAndTextLayout2.SwapRtl();
            if (imageAndTextLayout2.Bounds.Height > 0)
                i6 += imageAndTextLayout2.Bounds.Height + 6;
            Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout imageAndTextLayout3 = HasFooter(tip) ? new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.FooterImage, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText), tip.FooterText, null, "", i5, 6) : new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, null, null, "", null, "", i5, 6);
            imageAndTextLayout3.Offset(6, i6);
            if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
                imageAndTextLayout3.SwapRtl();
            if (imageAndTextLayout3.Bounds.Height > 0)
                imageAndTextLayout3.Offset(0, 6);
            visualTipLayout.WindowBounds = new System.Drawing.Rectangle(0, 0, 6 + i5 + 6, imageAndTextLayout3.Bounds.Bottom + (HasFooter(tip) ? 6 : 0));
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.TitleImage, imageAndTextLayout1.ImageBounds);
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Title, imageAndTextLayout1.TextBounds);
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Image, imageAndTextLayout2.ImageBounds);
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterImage, imageAndTextLayout3.ImageBounds);
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText, imageAndTextLayout3.TextBounds);
            if (imageAndTextLayout2.TitleTextHeight > 0)
            {
                System.Drawing.Rectangle rectangle1 = imageAndTextLayout2.TextBounds;
                rectangle1.Height = imageAndTextLayout2.TitleTextHeight;
                visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage, rectangle1);
                rectangle1.Y = rectangle1.Bottom;
                rectangle1.Height = imageAndTextLayout2.TextBounds.Height - imageAndTextLayout2.TitleTextHeight;
                visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Text, rectangle1);
            }
            else
            {
                visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage, System.Drawing.Rectangle.Empty);
                visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Text, imageAndTextLayout2.TextBounds);
            }
            if (HasShadow(tip))
            {
                System.Drawing.Rectangle rectangle2 = visualTipLayout.WindowBounds;
                System.Drawing.Rectangle rectangle3 = visualTipLayout.WindowBounds;
                visualTipLayout.ShadowBounds = new System.Drawing.Rectangle(rectangle2.Location, rectangle3.Size + (new System.Drawing.Size(5, 5)));
                if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
                    visualTipLayout.OffsetWindow(5, 0);
            }
            else
            {
                visualTipLayout.ShadowBounds = visualTipLayout.WindowBounds;
            }
            return visualTipLayout;
        }
Example #3
0
        protected virtual Skybound.VisualTips.Rendering.VisualTipLayout OnCreateLayout(Skybound.VisualTips.VisualTip tip)
        {
            Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout imageAndTextLayout2;

            Skybound.VisualTips.Rendering.VisualTipLayout visualTipLayout = new Skybound.VisualTips.Rendering.VisualTipLayout();
            string s1    = GetTitleText(tip);
            string s2    = GetBodyText(tip);
            bool   flag1 = s1.Length > 0;
            bool   flag2 = (s2.Length > 0) || (tip.Image != null);

            System.Drawing.Font font1 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Title);
            System.Drawing.Font font2 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Text);
            System.Drawing.Font font3 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText);
            System.Drawing.Font font4 = GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage);
            System.Drawing.Size size1 = MeasureText(s1, font1, 0);
            int i1 = flag1 ? size1.Width : 0;

            System.Drawing.Size size2 = MeasureText(s2, font2, 0);
            int i2 = flag2 ? size2.Width : 0;

            System.Drawing.Size size3 = MeasureText(tip.FooterText, font3, 0);
            int i3 = HasFooter(tip) ? size3.Width : 0;

            if (!tip.Enabled && (tip.DisabledMessage.Length > 0))
            {
                System.Drawing.Size size4 = MeasureText(tip.DisabledMessage, font4, 0);
                i2 = System.Math.Max(size4.Width, i2);
            }
            if (tip.TitleImage != null)
            {
                i1 += tip.TitleImage.Width + 6;
            }
            if (tip.Image != null)
            {
                i2 += tip.Image.Width + 6;
            }
            if (HasFooter(tip) && (tip.FooterImage != null))
            {
                i3 += tip.FooterImage.Width + 6;
            }
            int i4 = System.Math.Max(System.Math.Max(i1, i2), i3);
            int i5 = System.Math.Min(tip.MaximumWidth - 6 - 6, i4);
            int i6 = 6;

            Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout imageAndTextLayout1 = new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.TitleImage, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Title), s1, null, "", i5, 6);
            imageAndTextLayout1.Offset(6, 6);
            if (imageAndTextLayout1.Bounds.Height > 0)
            {
                i6 += imageAndTextLayout1.Bounds.Height + 6;
            }
            if (tip.Enabled)
            {
                imageAndTextLayout2 = new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.Image, null, "", GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Text), s2, i5, 6);
            }
            else
            {
                imageAndTextLayout2 = new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.Image, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage), tip.DisabledMessage, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.Text), s2, i5, 6);
            }
            imageAndTextLayout2.Offset(6, i6);
            if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
            {
                imageAndTextLayout2.SwapRtl();
            }
            if (imageAndTextLayout2.Bounds.Height > 0)
            {
                i6 += imageAndTextLayout2.Bounds.Height + 6;
            }
            Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout imageAndTextLayout3 = HasFooter(tip) ? new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, tip.FooterImage, GetElementFont(tip, Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText), tip.FooterText, null, "", i5, 6) : new Skybound.VisualTips.Rendering.VisualTipRenderer.ImageAndTextLayout(this, null, null, "", null, "", i5, 6);
            imageAndTextLayout3.Offset(6, i6);
            if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
            {
                imageAndTextLayout3.SwapRtl();
            }
            if (imageAndTextLayout3.Bounds.Height > 0)
            {
                imageAndTextLayout3.Offset(0, 6);
            }
            visualTipLayout.WindowBounds = new System.Drawing.Rectangle(0, 0, 6 + i5 + 6, imageAndTextLayout3.Bounds.Bottom + (HasFooter(tip) ? 6 : 0));
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.TitleImage, imageAndTextLayout1.ImageBounds);
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Title, imageAndTextLayout1.TextBounds);
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Image, imageAndTextLayout2.ImageBounds);
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterImage, imageAndTextLayout3.ImageBounds);
            visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.FooterText, imageAndTextLayout3.TextBounds);
            if (imageAndTextLayout2.TitleTextHeight > 0)
            {
                System.Drawing.Rectangle rectangle1 = imageAndTextLayout2.TextBounds;
                rectangle1.Height = imageAndTextLayout2.TitleTextHeight;
                visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage, rectangle1);
                rectangle1.Y      = rectangle1.Bottom;
                rectangle1.Height = imageAndTextLayout2.TextBounds.Height - imageAndTextLayout2.TitleTextHeight;
                visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Text, rectangle1);
            }
            else
            {
                visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.DisabledMessage, System.Drawing.Rectangle.Empty);
                visualTipLayout.SetElementBounds(Skybound.VisualTips.Rendering.VisualTipRenderElement.Text, imageAndTextLayout2.TextBounds);
            }
            if (HasShadow(tip))
            {
                System.Drawing.Rectangle rectangle2 = visualTipLayout.WindowBounds;
                System.Drawing.Rectangle rectangle3 = visualTipLayout.WindowBounds;
                visualTipLayout.ShadowBounds = new System.Drawing.Rectangle(rectangle2.Location, rectangle3.Size + (new System.Drawing.Size(5, 5)));
                if (tip.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
                {
                    visualTipLayout.OffsetWindow(5, 0);
                }
            }
            else
            {
                visualTipLayout.ShadowBounds = visualTipLayout.WindowBounds;
            }
            return(visualTipLayout);
        }