TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
alex.varlamov
NA
1
0
Unbelievable! a Labels created dynamically invisible just because they overlapped, buttons - OK, why is that?
Oct 28 2006 12:58 PM
some controls have same behavior (like Label) some like button.
To test it: create WindowsApplication, put a button (name=button1) in the right lower corner
and replace your Form1.cs with:
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
/* What is amazing!!! among all created labels visible is first
* just because they overlap a little bit. Make it not a label but a button
* commenting line designated in oneLabel method as // 1 and uncomment // 2
* and you will be able to see all created buttons still overlapped
* why is that?
*/
namespace
WindowsApplication1
{
public
partial
class
Form1
:
Form
{
private
int
counter,locY = 0;
public
Form1()
{
InitializeComponent();
}
private
void
oneLabel()
{
Label
la =
new
Label
();
// 1
//Button la = new Button(); // 2
la.Text =
"la_"
+ counter;
la.Top = locY+10;
la.Left = 110;
this
.Controls.Add(la);
counter++;
}
private
void
button1_Click(
object
sender,
EventArgs
e)
{
oneLabel();
locY += 10; // if you specify 30 instead of 10 they will become visible!!!
}
}
}
Reply
Answers (
0
)
Add information in text box at runtime.
Authenticate through SMTP