Re: Problem positioning controls within a panel with autoscroll=true
From: Robin Sanner (robin.h.sanner_at_verizon.net)
Date: 03/04/05
- Next message: wjousts: "Datagrids on tab pages resizing bug"
- Previous message: Dan: "numericUpDown Databinding problem"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 4 Mar 2005 10:23:17 -0800
I have the same problem but have found a solution yet.
"strcmp" <strcmp@discussions.microsoft.com> wrote in message
news:5F2FF682-66FB-4EA7-9309-A3F98B1265CB@microsoft.com...
>I don't know if this is a bug or if I am doing something wrong, but
>hopefully
> somebody could help me.
> I have a panel with autoscroll=true, and I am trying to position controls
> within it, however they don't position correctly.
> According to MS's documentation Panel.Left "Gets or sets the distance, in
> pixels, between the left edge of the control and the left edge of its
> container's client area."
>
> Here's the sample code for you to reconstruct it real quick.
> Essentially its a form with a panel with autoscroll=true,
> a textbox of any size outside of the panel,
> and a button with the following click event handler.
>
> int x = 0;
> int y = 0;
>
> private void button1_Click(object sender, System.EventArgs e)
> {
> TextBox f = new TextBox();
> f.Size = textBox1.Size;
> f.Multiline = true;
> panel1.Controls.Add(f);
> f.Left = x1;
> f.Top = y1;
> //f.Location = new Point(x1, y1);
>
> x1 += 100;
> y1 += 100;
> panel1.Refresh();
> }
>
> It should draw textboxes diagonally toward the right, with a scrollbar
> eventually appearing. However, if you move the horiz/vert. scrollbars any
> bit after creating a few of these diagonal boxes, it jumps a huge gap,
> then
> creates the textbox. What I think should be happening is that it should
> create a lot of textboxes diagonally with no gaps between them regardless
> of
> whether or not the scrollbars have been moved at all. I have tried using
> the
> commented out location line above and I have tried setting the positions
> before adding it into the panel. Nothing has worked for me so far.
>
> Thanks
- Next message: wjousts: "Datagrids on tab pages resizing bug"
- Previous message: Dan: "numericUpDown Databinding problem"
- Messages sorted by: [ date ] [ thread ]