GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 15-Nov-2004, 02:15
Frandy Frandy is offline
New Member
 
Join Date: Sep 2004
Location: Italy
Posts: 19
Frandy is on a distinguished road
Unhappy

How to modify permanently size and position of CForm dialogs ?


Hi!

My project consist of a CForm main window and other CForm dialog I've inserted. Their size and position are not what I need. I can obviously change the sizes and positions on the screen but I want the dialogs to keep their respective size and position each time I run the project.
What code should I modify or implement ?

I 'll appreciate very much detailed replies.

Thanks a lot.

Best regards.

Frandy
  #2  
Old 21-Nov-2004, 18:02
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 961
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
First of all, let me bring to your attention that although your application may be written in Visual C, it makes use of the .NET Frameworks' WinForms and has nothing to do with MFC. I will move this thread to the .NET Forum (where it should have been from the start) as soon as you confirm reading my post.

A solution to your problem is to write the code in the header, in the InitializeComponent section - some kind of an "OnInitDialog" if you will...

Form1.h
CPP / C++ / C Code:
#pragma once


namespace gidForums1
{
	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary> 
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the 
	///          'Resource File Name' property for the managed resource compiler tool 
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public __gc class Form1 : public System::Windows::Forms::Form
	{	
	public:
		Form1(void)
		{
			InitializeComponent();
		}
  
	protected:
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container * components;

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->components = new System::ComponentModel::Container();

			/*!
				Very important:
				Set the start position to "Manual",
				in order to be able to modify it's position
			 */
			this->StartPosition = FormStartPosition::Manual;			
			/*!
				Set the size to whatever you want 
			 */
			this->Width = 800;
			this->Height = 500;
			/*!
				Do the same for the on-screen position 
			 */
			this->Top = 0;
			this->Left = 300;
			
			this->Text = S"GID Forums rock!";
		}	
	};
}

I hope this is detailed enough.

Kind regards,
Luci
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #3  
Old 22-Nov-2004, 11:39
Frandy Frandy is offline
New Member
 
Join Date: Sep 2004
Location: Italy
Posts: 19
Frandy is on a distinguished road
Thanks Luci for your help but I don't see what I should do with this code. You know, my level is too low for now.
As I don't know anything about .NET Frameworks' Winforms, I'm not surprised that my application could make use of Winforms.
Anyway, disregard the question.

Thanks again Luci, also for your patience.

Kind regards.

Frandy
 
 

Recent GIDBlogPython ebook by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 08:07.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.