Re: adding controls programmatically on winfform by timtos
timtos
Tue Sep 09 15:10:55 CDT 2003
Have you tried smaller values between 2 and 25?
Take 10 or 15 for example. Your controls are overlapping and due to that only the top-most is visible.
The control´s height is not only the height of the text! You have to include the margin in your calculations.
That´s the reason I was talking about resizing your controls! You can reduce the height of the linklabels
to the height of the text. This way you can put them closer together...
Greetings,
timtos.
"jj" <jjcpa@rocketmail.com> wrote in message news:eIMefVwdDHA.1448@TK2MSFTNGP12.phx.gbl...
> it works. thank you very much.
>
> could you also tell me why? what's the difference between (100, 80 + i*25)
> and (100, 80 + i * 2)? one works while the other does not.
>
>
> "timtos" <tirobu@gmx.de> wrote in news:bjl7n1$jhs$1@news.uni-koblenz.de:
>
> > Replace the corresponding line with
> > lnkCase[i].Location = new System.Drawing.Point(100, i*25);
> >
> > Beside:
> > Do you really want to change the x-coordinate?
> > If the space between the linklabels is too big you also have to reduce
> > the size with the Size property...
> >
> > Hope this helps,
> > timtos.
> >
> > "jj" <jjcpa@rocketmail.com> wrote in message
> > news:eOpySLwdDHA.2368@TK2MSFTNGP09.phx.gbl...
> >> i try to add a group of linklabel to winform as following, but when
> >> running it, i can only see one linklabel added (the first one). Could
> >> anyone help me to solve it and tell me why?
> >>
> >> thanks
> >> jj
> >> ---------------------------------------------------
> >> LinkLabel[] lnkCase = new LinkLabel[caseCount];
> >>
> >> for (int i = 0; i < caseCount; i++)
> >> {
> >> lnkCase[i] = new LinkLabel();
> >> lnkCase[i].Text = dirs[i].Name;
> >> lnkCase[i].Name = dirs[i].Name;
> >> lnkCase[i].Location = new System.Drawing.Point(100 + i * 2, 80 + i *
> >> 2);
> >> lnkCase[i].Size = new System.Drawing.Size(272, 23);
> >> lnkCase[i].LinkClicked += new
> >> System.Windows.Forms.LinkLabelLinkClickedEventHandler
> >> (lnkCase_LinkClicked);
> >> this.Controls.Add(lnkCase[i]);
> >> }
> >>
> >> -----------------------------------------
> >>
> >>
> >
> >
> >
>