示例#1
0
        public CategoryControl()
        {
            InitializeComponent();

            LinkTitle.MaximumSize = new Size
                                    (
                this.ClientRectangle.Width - TitlePadding.Horizontal,
                TitleMaxHeight
                                    );

            LinkTitle.SetBounds
            (
                TitlePadding.Left,
                TitlePadding.Top,
                0,
                0,
                BoundsSpecified.Location
            );

            LinkTitle.Cursor = SystemCursorsFix.GetHandCursor();

            LinkTitle.LinkColor       = this.Title_TextColor_Normal;
            LinkTitle.ActiveLinkColor = this.Title_TextColor_Active;

            RecreateObjects(true);
        }
示例#2
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     OverrideCursor = SystemCursorsFix.GetHandCursor();
 }
示例#3
0
        private void RecreateObjects(bool ModLayout = false)
        {
            foreach (LinkLabelEx LObj in LinksObjs)
            {
                this.Controls.Remove(LObj);
            }

            LinksObjs.Clear();

            if (ModLayout)
            {
                this.SuspendLayout();
            }

            int LIndex = 0;
            int LPos   = LinksPadding.Top;

            if (LinkTitle.Visible)
            {
                LPos += LinkTitle.ClientRectangle.Height + TitlePadding.Bottom + TitleMargin.Bottom;
            }

            //LinkLabelEx LPrevObj = null;
            foreach (var L in LinksList)
            {
                LinkLabelEx LObj = new LinkLabelEx
                {
                    AutoSize     = true,
                    BackColor    = Color.Transparent,
                    Font         = this.Font,
                    LinkBehavior = LinkBehavior.AlwaysUnderline,
                    Margin       = new Padding(0),
                    Name         = "LObj_" + (++LIndex),
                    Location     = new Point(this.LinksPadding.Left, LPos),
                    Size         = new Size(this.ClientRectangle.Width - this.LinksPadding.Horizontal - this.LinksMargin.Horizontal, 5),
                    MaximumSize  = new Size(this.ClientRectangle.Width - this.LinksPadding.Horizontal - this.LinksMargin.Horizontal, 100),
                    TabIndex     = LIndex,
                    TabStop      = true,
                    Text         = L.Caption,
                    TextAlign    = ContentAlignment.TopLeft,
                    Tag          = L,
                    Cursor       = SystemCursorsFix.GetHandCursor(),

                    LinkColor       = this.Links_TextColor_Normal,
                    ActiveLinkColor = this.Links_TextColor_Active,
                };

                this.Controls.Add(LObj);
                LinksObjs.Add(LObj);

                if (ModLayout)
                {
                    LObj.PerformLayout();
                }

                LPos += LObj.ClientRectangle.Height + LinksMargin.Bottom;
            }

            if (ModLayout)
            {
                this.ResumeLayout(false);
            }
            if (ModLayout)
            {
                this.PerformLayout();
            }
        }