Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have text boxes that are small, but when clicked they will resize to large. The button is created and then I need the button to resize them back to where they were but I cannot reference the button anywhere except where I declared it.

 

ooo.Dispose() does not compile because of that, Help.

 

 

private void richTextBox1_Enter(object sender, System.EventArgs e)
	{
		this.richTextBox1.BringToFront();
		this.richTextBox1.Size = new System.Drawing.Size(496, 300);
		Control r=new Button();
		r.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
		r.Location = new System.Drawing.Point(richTextBox1.Location.X-35, richTextBox1.Location.Y);
		r.Name = "ooo";
		r.Size = new System.Drawing.Size(35, 20);
		r.TabIndex = 1;
		r.Text = "Exit";
		Controls.Add(r);
		r.BringToFront();
		r.Show();
	}
	private void ooo_Click(object sender, System.EventArgs e)
	{
		this.richTextBox1.Size = new System.Drawing.Size(496, 48);
		ooo.Dispose();
	}

C#
Posted

I'd rather program an extendedRichBox Control, which inherits rich text box and has

(a) the richttextbox

(b) a resizeButton

© a boolean property "shrinked"

 

or so.

.nerd
Posted

if you insist on creating a new contol i suggest the following:

 

private BigBox_Clicked(object sender, System.EventArgs e)
{

perform the shrinking here		}

}

 

and

 

private void richTextBox1_Enter(object sender, System.EventArgs e)
	{
		this.richTextBox1.BringToFront();
		this.richTextBox1.Size = new System.Drawing.Size(496, 300);
		Control r=new Button();
		r.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
		r.Location = new System.Drawing.Point(richTextBox1.Location.X-35, richTextBox1.Location.Y);
		r.Name = "ooo";
		r.Size = new System.Drawing.Size(35, 20);
		r.TabIndex = 1;
		r.Text = "Exit";
		Controls.Add(r);
		r.BringToFront();
		r.Show();
              AddHandler r.Click, AddressOf Me.BigBox_Clicked
	}
	

.nerd

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...