473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Resizing forms -question

Hello, can someone help in this?

I have Form1 (Main) and Form 2 (Options), and Form1 is main form, and I want
on Form2 with button (btn800) change size of form1, and always is same size.

Here is click event of my button and i don't know why it can't resize..

Thanks.....

private void btn800_Click(object sender, EventArgs e)

{

frmMain Main = new frmMain();

Main.Size = new Size(800, 600);

this.Close();

}
Jun 2 '07 #1
1 1230
On Sat, 02 Jun 2007 15:18:10 -0700, Zeljko Bilandzija
<za*****@email.t-com.hrwrote:
I have Form1 (Main) and Form 2 (Options), and Form1 is main form, and I
want
on Form2 with button (btn800) change size of form1, and always is same
size.

Here is click event of my button and i don't know why it can't resize...
Which "frmMain" instance do you want to resize? Because, the code you
posted does in fact change the size of *some* instance of "frmMain", but
probably not the one you intend. You're creating a new instance of
"frmMain" every time you execute that method. Those instances are never
shown, but they do in fact get resized.

If you want to resize a previously-existing instance of "frmMain" (for
example, the one that gets created when you start your application), you
need to pass that reference to the options form so that it can access it..
Something like:

class frmOption
{
private frmMain _Main;

public frmOption(frmMain Main)
{
_Main = Main;
}

private void btn800_Click(object sender, EventArgs e)
{
_Main.Size = new Size(800, 600);
Close();
}
}

Pete
Jun 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tony | last post by:
Derived Forms resizing in dotnet. (Fix) Problem: If you have a form base class: public frmBase : System.Windows.Forms { public frmBase { // DefaultFormFont is new Font("Tahoma", 10);
5
by: WJA | last post by:
I'm designing a database which will be the only application used on a touch screen. There are only 2 forms and they are both Modal, Popup and Thin border style. The forms cover the whole screen...
1
by: Terry | last post by:
I've seen several posts from people who have seen this flashing in TreeView's when resizing a form. I've noticed it in my app, but only in the child windows. For example, my main form has a...
8
by: Chris | last post by:
Hi, In design mode I built some windows with some controls (e.g. listboxes, labels, chgeck boxes etc.) in it, and I did set the property for the window size is set to normal. Now, when I run...
4
by: Thomas Richter | last post by:
Hi, I can't get of the black flicker when I resize my form. this = Mainform : System.Windows.Forms.Form If I set the size from 300 to 500 I see for ca 500ms some black areas. I try to solve it...
6
by: John Bowman | last post by:
Hi All, I must be missing something really obvious, so I'd appreciate someone helping me out. I have a simple Windows form that currently only has a title bar (aka the Text Property is set) and...
11
by: Sharon | last post by:
I'm writing a new control derived from UserControl. I need to get an event when the control is done resizing. I tried the Resize, SizeChanged, Move and the Layout events and I also tried to...
0
by: Sam Barham | last post by:
I have a ListView control, for which I have overwritten the WndProc method to gain access to the WM_PAINT message and generate my own OnPaint and OnPaintBackground messages, in order to colour the...
1
by: Benz. | last post by:
Hello all, I'm having a very strange problem. I've an MDI application with many child forms. In 1 of my Child forms (Say frmA), I've a few design time controls. The forms Autoscroll property is...
2
by: Nina | last post by:
Hi there, I've tried everything that I know to prevent usre resizing datagrid columns, but nothing works. Following are the code that I used. Please tell me what's wrong with them. Thank you....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.