| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
|
This is VB.NET but I coded for 2 years in C++ and know this should make more
than enough sense to help you. 1. The first thing I always do is put a panel on my form. You will stick all your controls on that panel, lets call it pnlMain. Now create an object of your control. Lets say I want to put a checkbox on there. Dim oObjCheckBox As CheckBox = New CheckBox() Give it all the attributes you want to give it oObjCheckBox.ID = "chkIDOne" oObjCheckBox.Text = "vbIsForGirlsandCPPRule" Now stick it on your panel pnlMenus.Controls.Add(oObjCheckBox) You can put this in your onload, but just check for postback, otherwise you will lose youre changes on your controls. If you can do this (which should be very easy) the rest will be easy as well. Put controls on your panels and managed it from there Hope it helps a bit, an if anything is not clear or if I misunderstood you...just reply regards "Bil Muh" wrote: > Esteemede Developers, > > I would like to Thank All of You in advance for your sincere guidances. > > I am developing a software using Visual C++ .NET Standard Edition with > Windows Form (.NET) template. > > Briefly : > -------------------------------------------------------------------------------------------- > I need to create dynamically some controls on the forms, and display these > controls page by page on the form by using "Previous Page" and "Next Page" > buttons. > > In detailed : > -------------------------------------------------------------------------------------------- > I will read some information from a file. The contents of this file include > Parameter information line by line. Each line is formatted. We may think > that, this file is a Table with some columns of a database. > > Format of each line is similar to following: > Param_Number;Param_Name;Default_Value;Unit;Info1; > > Firstly, I will read this file and determine how many rows exist. Then, I > will create dynamically some controls for each line. Dynamically created > controls are as below: > 1. Param_Number : Label > 2. Param_Name : Label > 3. Default_Value : Label (contents of this field will change during the > running of application) > 4. Unit : Label > > This group of controls will be created on the form dynamically. > > The number of rows ( number of parameters) may change file to file, but > row data format will be same. > > My form's size will be maximized. I want to create control groups as much > as on the form one under the other. Let's say the number of parameter is > 1000, and It is possible to dynamically create 50 control groups on the form. > This means than it is required to create 20 different pages on the form. > > These are my questions...!! > > **** How can I create dynamically controls on the form? , > **** How can I show them page by page on the form.? and > **** How can I go through on the pages with "Previous Page" and "Next > Page" buttons? > > I will receive some parameter values from TCP/IP socket periodically. > Therefore I have to change the received parameter values at the related > Labels in each page on the form. > > I am requesting you to guide me ... > > With this, I extend you and all yours with my bests. > > Respectfully, yours > > Bil Muh > |
|
||
|
||||
|
=?Utf-8?B?QmlsIE11aA==?=
Guest
Posts: n/a
|
I thank You so much, Joe.
Your guidance will help me during my solution. Please do allow me to ask my questions. Can you explain a bit more about "postback" ? I could not understand what does it mean. "Joe" wrote: > This is VB.NET but I coded for 2 years in C++ and know this should make more > than enough sense to help you. > > 1. The first thing I always do is put a panel on my form. > You will stick all your controls on that panel, lets call it pnlMain. > > Now create an object of your control. Lets say I want to put a checkbox on > there. > Dim oObjCheckBox As CheckBox = New CheckBox() > Give it all the attributes you want to give it > oObjCheckBox.ID = "chkIDOne" > oObjCheckBox.Text = "vbIsForGirlsandCPPRule" > Now stick it on your panel > pnlMenus.Controls.Add(oObjCheckBox) > You can put this in your onload, but just check for postback, otherwise you > will lose youre changes on your controls. If you can do this (which should > be very easy) the rest will be easy as well. Put controls on your panels and > managed it from there > > Hope it helps a bit, an if anything is not clear or if I misunderstood > you...just reply > regards > > "Bil Muh" wrote: > > > Esteemede Developers, > > > > I would like to Thank All of You in advance for your sincere guidances. > > > > I am developing a software using Visual C++ .NET Standard Edition with > > Windows Form (.NET) template. > > > > Briefly : > > -------------------------------------------------------------------------------------------- > > I need to create dynamically some controls on the forms, and display these > > controls page by page on the form by using "Previous Page" and "Next Page" > > buttons. > > > > In detailed : > > -------------------------------------------------------------------------------------------- > > I will read some information from a file. The contents of this file include > > Parameter information line by line. Each line is formatted. We may think > > that, this file is a Table with some columns of a database. > > > > Format of each line is similar to following: > > Param_Number;Param_Name;Default_Value;Unit;Info1; > > > > Firstly, I will read this file and determine how many rows exist. Then, I > > will create dynamically some controls for each line. Dynamically created > > controls are as below: > > 1. Param_Number : Label > > 2. Param_Name : Label > > 3. Default_Value : Label (contents of this field will change during the > > running of application) > > 4. Unit : Label > > > > This group of controls will be created on the form dynamically. > > > > The number of rows ( number of parameters) may change file to file, but > > row data format will be same. > > > > My form's size will be maximized. I want to create control groups as much > > as on the form one under the other. Let's say the number of parameter is > > 1000, and It is possible to dynamically create 50 control groups on the form. > > This means than it is required to create 20 different pages on the form. > > > > These are my questions...!! > > > > **** How can I create dynamically controls on the form? , > > **** How can I show them page by page on the form.? and > > **** How can I go through on the pages with "Previous Page" and "Next > > Page" buttons? > > > > I will receive some parameter values from TCP/IP socket periodically. > > Therefore I have to change the received parameter values at the related > > Labels in each page on the form. > > > > I am requesting you to guide me ... > > > > With this, I extend you and all yours with my bests. > > > > Respectfully, yours > > > > Bil Muh > > |
|
||
|
||||
|
Angelos Karantzalis
Guest
Posts: n/a
|
Is there some specific reason why you don't want to use a DataGrid control ?
I'm saying this because dynamically creating a few thousand controls might turn out to be a real performance killer for your application, no ? If you construct a DataSet from your file ( or stream or whatever ) and fiddle a bit with a DataGrid you could possibly do paging very easily. Angel O:] "Bil Muh" <(E-Mail Removed)_REMOVE_THIS_PART> wrote in message news:9B621763-FFAB-4F47-A92A-(E-Mail Removed)... > Esteemede Developers, > > I would like to Thank All of You in advance for your sincere guidances. > > I am developing a software using Visual C++ .NET Standard Edition with > Windows Form (.NET) template. > > Briefly : > -------------------------------------------------------------------------- ------------------ > I need to create dynamically some controls on the forms, and display these > controls page by page on the form by using "Previous Page" and "Next Page" > buttons. > > In detailed : > -------------------------------------------------------------------------- ------------------ > I will read some information from a file. The contents of this file include > Parameter information line by line. Each line is formatted. We may think > that, this file is a Table with some columns of a database. > > Format of each line is similar to following: > Param_Number;Param_Name;Default_Value;Unit;Info1; > > Firstly, I will read this file and determine how many rows exist. Then, I > will create dynamically some controls for each line. Dynamically created > controls are as below: > 1. Param_Number : Label > 2. Param_Name : Label > 3. Default_Value : Label (contents of this field will change during the > running of application) > 4. Unit : Label > > This group of controls will be created on the form dynamically. > > The number of rows ( number of parameters) may change file to file, but > row data format will be same. > > My form's size will be maximized. I want to create control groups as much > as on the form one under the other. Let's say the number of parameter is > 1000, and It is possible to dynamically create 50 control groups on the form. > This means than it is required to create 20 different pages on the form. > > These are my questions...!! > > **** How can I create dynamically controls on the form? , > **** How can I show them page by page on the form.? and > **** How can I go through on the pages with "Previous Page" and "Next > Page" buttons? > > I will receive some parameter values from TCP/IP socket periodically. > Therefore I have to change the received parameter values at the related > Labels in each page on the form. > > I am requesting you to guide me ... > > With this, I extend you and all yours with my bests. > > Respectfully, yours > > Bil Muh > |
|
||
|
||||
|
=?Utf-8?B?QmlsIE11aA==?=
Guest
Posts: n/a
|
Actually, there is not any specific limitation in my application. Please let
me explaing my intention. There is a one file that contains formated rows of data pertaining parameters. The number of rows will not be fixed. Let's assume there are 1000 parameters in that file. I am communicating with another computer via TCP/IP. Both computers have the same file. My computer is client and other is server. Server generate values for 1000 parameters and sends them to the client periodically. At the client side, I want to display all recevied values for parameters as quick as possible. I thought that having a Paging style display would be user-friendly to observe the data. Due to having hundreds of parameters, I want to display them page by page. But other solutions are acceptable. My constraints are simple: 1) Be Fast, 2) Show All, 3) Enable dummies to understand immediately, how to observe other parameters, that are not on that page... For every parameters, I have to show the followings on the form: Parameter_Name Parameter_Current_Value Parameter_Unit That's all... Can you explain me how to use DataGrid to display values Almost-Real-Time in the cells and How to show them similar to Page by Page type, please? My Best Regards... "Angelos Karantzalis" wrote: > Is there some specific reason why you don't want to use a DataGrid control ? > > I'm saying this because dynamically creating a few thousand controls might > turn out to be a real performance killer for your application, no ? > > If you construct a DataSet from your file ( or stream or whatever ) and > fiddle a bit with a DataGrid you could possibly do paging very easily. > > Angel > O:] > > > "Bil Muh" <(E-Mail Removed)_REMOVE_THIS_PART> wrote in message > news:9B621763-FFAB-4F47-A92A-(E-Mail Removed)... > > Esteemede Developers, > > > > I would like to Thank All of You in advance for your sincere guidances. > > > > I am developing a software using Visual C++ .NET Standard Edition with > > Windows Form (.NET) template. > > > > Briefly : > > -------------------------------------------------------------------------- > ------------------ > > I need to create dynamically some controls on the forms, and display > these > > controls page by page on the form by using "Previous Page" and "Next Page" > > buttons. > > > > In detailed : > > -------------------------------------------------------------------------- > ------------------ > > I will read some information from a file. The contents of this file > include > > Parameter information line by line. Each line is formatted. We may think > > that, this file is a Table with some columns of a database. > > > > Format of each line is similar to following: > > Param_Number;Param_Name;Default_Value;Unit;Info1; > > > > Firstly, I will read this file and determine how many rows exist. Then, I > > will create dynamically some controls for each line. Dynamically created > > controls are as below: > > 1. Param_Number : Label > > 2. Param_Name : Label > > 3. Default_Value : Label (contents of this field will change during the > > running of application) > > 4. Unit : Label > > > > This group of controls will be created on the form dynamically. > > > > The number of rows ( number of parameters) may change file to file, but > > row data format will be same. > > > > My form's size will be maximized. I want to create control groups as > much > > as on the form one under the other. Let's say the number of parameter is > > 1000, and It is possible to dynamically create 50 control groups on the > form. > > This means than it is required to create 20 different pages on the form. > > > > These are my questions...!! > > > > **** How can I create dynamically controls on the form? , > > **** How can I show them page by page on the form.? and > > **** How can I go through on the pages with "Previous Page" and "Next > > Page" buttons? > > > > I will receive some parameter values from TCP/IP socket periodically. > > Therefore I have to change the received parameter values at the related > > Labels in each page on the form. > > > > I am requesting you to guide me ... > > > > With this, I extend you and all yours with my bests. > > > > Respectfully, yours > > > > Bil Muh > > > > > |
|
||
|
||||
|
Angelos Karantzalis
Guest
Posts: n/a
|
First, you can create a DataSet instance.
Add a DataTable, with Columns: Parameter_Name Parameter_Current_Value Parameter_Unit ... and then add a row for each line from your feed. Conceptually, it's more or less the same as creating 3 Labels at the time, the only real difference is that you can bind the DataSet to a DataGrid control, and have the grid display the data page-by-page. I'm no expert on Windows Forms Controls like the DataGrid, but I do believe strongly that with a little work you can get much more done with the DataSet - DataGrid combination than by adding labels arbitrarily on your form. Sorry I couldn't be of more assistance, Angel O:] > > For every parameters, I have to show the followings on the form: > > Parameter_Name Parameter_Current_Value Parameter_Unit > > That's all... > > Can you explain me how to use DataGrid to display values Almost-Real-Time > in the cells and How to show them similar to Page by Page type, please? > > My Best Regards... > > > > > > > > "Angelos Karantzalis" wrote: > > > Is there some specific reason why you don't want to use a DataGrid control ? > > > > I'm saying this because dynamically creating a few thousand controls might > > turn out to be a real performance killer for your application, no ? > > > > If you construct a DataSet from your file ( or stream or whatever ) and > > fiddle a bit with a DataGrid you could possibly do paging very easily. > > > > Angel > > O:] > > > > > > "Bil Muh" <(E-Mail Removed)_REMOVE_THIS_PART> wrote in message > > news:9B621763-FFAB-4F47-A92A-(E-Mail Removed)... > > > Esteemede Developers, > > > > > > I would like to Thank All of You in advance for your sincere guidances. > > > > > > I am developing a software using Visual C++ .NET Standard Edition with > > > Windows Form (.NET) template. > > > > > > Briefly : > > > -------------------------------------------------------------------------- > > ------------------ > > > I need to create dynamically some controls on the forms, and display > > these > > > controls page by page on the form by using "Previous Page" and "Next Page" > > > buttons. > > > > > > In detailed : > > > -------------------------------------------------------------------------- > > ------------------ > > > I will read some information from a file. The contents of this file > > include > > > Parameter information line by line. Each line is formatted. We may think > > > that, this file is a Table with some columns of a database. > > > > > > Format of each line is similar to following: > > > Param_Number;Param_Name;Default_Value;Unit;Info1; > > > > > > Firstly, I will read this file and determine how many rows exist. Then, I > > > will create dynamically some controls for each line. Dynamically created > > > controls are as below: > > > 1. Param_Number : Label > > > 2. Param_Name : Label > > > 3. Default_Value : Label (contents of this field will change during the > > > running of application) > > > 4. Unit : Label > > > > > > This group of controls will be created on the form dynamically. > > > > > > The number of rows ( number of parameters) may change file to file, but > > > row data format will be same. > > > > > > My form's size will be maximized. I want to create control groups as > > much > > > as on the form one under the other. Let's say the number of parameter is > > > 1000, and It is possible to dynamically create 50 control groups on the > > form. > > > This means than it is required to create 20 different pages on the form. > > > > > > These are my questions...!! > > > > > > **** How can I create dynamically controls on the form? , > > > **** How can I show them page by page on the form.? and > > > **** How can I go through on the pages with "Previous Page" and "Next > > > Page" buttons? > > > > > > I will receive some parameter values from TCP/IP socket periodically. > > > Therefore I have to change the received parameter values at the related > > > Labels in each page on the form. > > > > > > I am requesting you to guide me ... > > > > > > With this, I extend you and all yours with my bests. > > > > > > Respectfully, yours > > > > > > Bil Muh > > > > > > > > > |
|
||
|
||||
|
=?Utf-8?B?QmlsIE11aA==?=
Guest
Posts: n/a
|
Thank you very much Karantzalis for your kind interest and guidance.
I will try your suggestion as well. Have a good day... "Angelos Karantzalis" wrote: > First, you can create a DataSet instance. > > Add a DataTable, with Columns: Parameter_Name Parameter_Current_Value > Parameter_Unit > ... and then add a row for each line from your feed. > > Conceptually, it's more or less the same as creating 3 Labels at the time, > the only real difference is that you can bind > the DataSet to a DataGrid control, and have the grid display the data > page-by-page. > > I'm no expert on Windows Forms Controls like the DataGrid, but I do believe > strongly that with a little work you can get much more done with the > DataSet - DataGrid combination than by adding labels arbitrarily on your > form. > > Sorry I couldn't be of more assistance, > > Angel > O:] > > > > > For every parameters, I have to show the followings on the form: > > > > Parameter_Name Parameter_Current_Value Parameter_Unit > > > > That's all... > > > > Can you explain me how to use DataGrid to display values Almost-Real-Time > > in the cells and How to show them similar to Page by Page type, please? > > > > My Best Regards... > > > > > > > > > > > > > > > > "Angelos Karantzalis" wrote: > > > > > Is there some specific reason why you don't want to use a DataGrid > control ? > > > > > > I'm saying this because dynamically creating a few thousand controls > might > > > turn out to be a real performance killer for your application, no ? > > > > > > If you construct a DataSet from your file ( or stream or whatever ) and > > > fiddle a bit with a DataGrid you could possibly do paging very easily. > > > > > > Angel > > > O:] > > > > > > > > > "Bil Muh" <(E-Mail Removed)_REMOVE_THIS_PART> wrote in message > > > news:9B621763-FFAB-4F47-A92A-(E-Mail Removed)... > > > > Esteemede Developers, > > > > > > > > I would like to Thank All of You in advance for your sincere > guidances. > > > > > > > > I am developing a software using Visual C++ .NET Standard Edition with > > > > Windows Form (.NET) template. > > > > > > > > Briefly : > > > > > -------------------------------------------------------------------------- > > > ------------------ > > > > I need to create dynamically some controls on the forms, and display > > > these > > > > controls page by page on the form by using "Previous Page" and "Next > Page" > > > > buttons. > > > > > > > > In detailed : > > > > > -------------------------------------------------------------------------- > > > ------------------ > > > > I will read some information from a file. The contents of this file > > > include > > > > Parameter information line by line. Each line is formatted. We may > think > > > > that, this file is a Table with some columns of a database. > > > > > > > > Format of each line is similar to following: > > > > Param_Number;Param_Name;Default_Value;Unit;Info1; > > > > > > > > Firstly, I will read this file and determine how many rows exist. > Then, I > > > > will create dynamically some controls for each line. Dynamically > created > > > > controls are as below: > > > > 1. Param_Number : Label > > > > 2. Param_Name : Label > > > > 3. Default_Value : Label (contents of this field will change during > the > > > > running of application) > > > > 4. Unit : Label > > > > > > > > This group of controls will be created on the form dynamically. > > > > > > > > The number of rows ( number of parameters) may change file to file, > but > > > > row data format will be same. > > > > > > > > My form's size will be maximized. I want to create control groups as > > > much > > > > as on the form one under the other. Let's say the number of parameter > is > > > > 1000, and It is possible to dynamically create 50 control groups on > the > > > form. > > > > This means than it is required to create 20 different pages on the > form. > > > > > > > > These are my questions...!! > > > > > > > > **** How can I create dynamically controls on the form? , > > > > **** How can I show them page by page on the form.? and > > > > **** How can I go through on the pages with "Previous Page" and > "Next > > > > Page" buttons? > > > > > > > > I will receive some parameter values from TCP/IP socket > periodically. > > > > Therefore I have to change the received parameter values at the > related > > > > Labels in each page on the form. > > > > > > > > I am requesting you to guide me ... > > > > > > > > With this, I extend you and all yours with my bests. > > > > > > > > Respectfully, yours > > > > > > > > Bil Muh > > > > > > > > > > > > > > > > |
|
||
|
||||
|
=?Utf-8?B?QmlsIE11aA==?=
Guest
Posts: n/a
|
I coded an example for dynamic control creation. You may find the source
codes below: 1) This source codes are for Visual C++ .NET v.2003 2) Open a project by using "Windows Forms (.NET)." 3) Name the project as : "Panel_Denemeleri" 4) Paste the below source codes to "Form1.h" code view. 5) Compile, Debug and Build the program ![]() Source Codes: Kodlar : // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* /********************************************************** Coded by Alper AKCAYOZ September 27th, 2004 (E-Mail Removed) **********************************************************/ #pragma once #include <windows.h> #ifdef MessageBox #undef MessageBox #endif namespace Panel_Denemeleri { using namespace System; using namespace System::Threading; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System: ata;using namespace System: rawing;/// <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(); } //////////////////////////////////////////////////////////////////////////////////////////// //Panel Panel __gc *panel1; Thread* myThread; //////////////////////////////////////////////////////////////////////////////////////////// static Int32 i32Panel_Number = 0; static Int32 i32Label_Number = 0; static Int32 i32SpaceBetweenControls = 5; static Int32 i32LabelHeight = 20; static Int32 i32LabelWidth = 130; static Int32 i32Current_Pos_X = 8; static Int32 i32Current_Pos_Y = 8; private: System::Windows::Forms::Label * lblControlCount; private: System::Windows::Forms::Timer * timer1; private: System::Windows::Forms::Button * btnPreviousPage; private: System::Windows::Forms::Button * btnNextPage; static Int32 i32Current_Column_Pos_X = 8 ; //////////////////////////////////////////////////////////////////////////////////////////// protected: void Dispose(Boolean disposing) { if (disposing && components) { components->Dispose(); } __super: ispose(disposing);} private: System::Windows::Forms::Button * bntCreatePanel; private: System::Windows::Forms::TextBox * txtSiraSayisi; private: System::Windows::Forms::Button * btnKadarSiraYarat; private: System::Windows::Forms::Button * btnClearPanel; private: System::Windows::Forms::Label * lblSure; private: System::ComponentModel::IContainer * components; private: /// <summary> /// Required designer variable. /// </summary> /// <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(); this->bntCreatePanel = new System::Windows::Forms::Button(); this->txtSiraSayisi = new System::Windows::Forms::TextBox(); this->btnKadarSiraYarat = new System::Windows::Forms::Button(); this->btnClearPanel = new System::Windows::Forms::Button(); this->lblSure = new System::Windows::Forms::Label(); this->lblControlCount = new System::Windows::Forms::Label(); this->timer1 = new System::Windows::Forms::Timer(this->components); this->btnPreviousPage = new System::Windows::Forms::Button(); this->btnNextPage = new System::Windows::Forms::Button(); this->SuspendLayout(); // // bntCreatePanel // this->bntCreatePanel->BackColor = System: rawing::Color::FromArgb((System::Byte)255, (System::Byte)255,(System::Byte)192); this->bntCreatePanel->Font = new System: rawing::Font(S"Microsoft SansSerif", 9, System: rawing::FontStyle::Bold,System: rawing::GraphicsUnit::Point, (System::Byte)162);this->bntCreatePanel->ForeColor = System: rawing::Color::FromArgb((System::Byte)0, (System::Byte)0,(System::Byte)192); this->bntCreatePanel->Location = System: rawing::Point(8, 8);this->bntCreatePanel->Name = S"bntCreatePanel"; this->bntCreatePanel->Size = System: rawing::Size(104, 32);this->bntCreatePanel->TabIndex = 0; this->bntCreatePanel->Text = S"Create Panel"; this->bntCreatePanel->Click += new System::EventHandler(this, bntCreatePanel_Click); // // txtSiraSayisi // this->txtSiraSayisi->BorderStyle = System::Windows::Forms::BorderStyle::None; this->txtSiraSayisi->CharacterCasing = System::Windows::Forms::CharacterCasing::Upper; this->txtSiraSayisi->Enabled = false; this->txtSiraSayisi->Font = new System: rawing::Font(S"Microsoft SansSerif", 20.25F, System: rawing::FontStyle::Regular,System: rawing::GraphicsUnit::Point, (System::Byte)162);this->txtSiraSayisi->ImeMode = System::Windows::Forms::ImeMode::NoControl; this->txtSiraSayisi->Location = System: rawing::Point(128, 8);this->txtSiraSayisi->MaxLength = 3; this->txtSiraSayisi->Name = S"txtSiraSayisi"; this->txtSiraSayisi->Size = System: rawing::Size(64, 31);this->txtSiraSayisi->TabIndex = 1; this->txtSiraSayisi->Text = S""; this->txtSiraSayisi->TextAlign = System::Windows::Forms::HorizontalAlignment::Center; // // btnKadarSiraYarat // this->btnKadarSiraYarat->BackColor = System: rawing::Color::FromArgb((System::Byte)255, (System::Byte)255,(System::Byte)192); this->btnKadarSiraYarat->Enabled = false; this->btnKadarSiraYarat->Font = new System: rawing::Font(S"MicrosoftSans Serif", 9, System: rawing::FontStyle::Bold,System: rawing::GraphicsUnit::Point, (System::Byte)162);this->btnKadarSiraYarat->ForeColor = System: rawing::Color::FromArgb((System::Byte)0, (System::Byte)0,(System::Byte)192); this->btnKadarSiraYarat->Location = System: rawing::Point(200, 8);this->btnKadarSiraYarat->Name = S"btnKadarSiraYarat"; this->btnKadarSiraYarat->Size = System: rawing::Size(72, 32);this->btnKadarSiraYarat->TabIndex = 2; this->btnKadarSiraYarat->Text = S"pcs. Row"; this->btnKadarSiraYarat->Click += new System::EventHandler(this, bntKadarSiraYarat_Click); // // btnClearPanel // this->btnClearPanel->BackColor = System: rawing::Color::FromArgb((System::Byte)255, (System::Byte)255,(System::Byte)192); this->btnClearPanel->Enabled = false; this->btnClearPanel->Font = new System: rawing::Font(S"Microsoft SansSerif", 9, System: rawing::FontStyle::Bold,System: rawing::GraphicsUnit::Point, (System::Byte)162);this->btnClearPanel->ForeColor = System: rawing::Color::FromArgb((System::Byte)0, (System::Byte)0,(System::Byte)192); this->btnClearPanel->Location = System: rawing::Point(280, 8);this->btnClearPanel->Name = S"btnClearPanel"; this->btnClearPanel->Size = System: rawing::Size(80, 32);this->btnClearPanel->TabIndex = 3; this->btnClearPanel->Text = S"Clear Panel"; this->btnClearPanel->Click += new System::EventHandler(this, btnClearPanel_Click); // // lblSure // this->lblSure->BackColor = System: rawing::Color::Silver;this->lblSure->Font = new System: rawing::Font(S"Microsoft Sans Serif",12, System: rawing::FontStyle::Bold, System: rawing::GraphicsUnit::Point,(System::Byte)162); this->lblSure->ForeColor = System: rawing::Color::Red;this->lblSure->Location = System: rawing::Point(384, 8);this->lblSure->Name = S"lblSure"; this->lblSure->Size = System: rawing::Size(624, 16);this->lblSure->TabIndex = 4; this->lblSure->TextAlign = System: rawing::ContentAlignment::MiddleCenter;// // lblControlCount // this->lblControlCount->BackColor = System: rawing::Color::Silver;this->lblControlCount->Font = new System: rawing::Font(S"Microsoft SansSerif", 12, System: rawing::FontStyle::Bold,System: rawing::GraphicsUnit::Point, (System::Byte)162);this->lblControlCount->ForeColor = System: rawing::Color::Red;this->lblControlCount->Location = System: rawing::Point(384, 32);this->lblControlCount->Name = S"lblControlCount"; this->lblControlCount->Size = System: rawing::Size(624, 16);this->lblControlCount->TabIndex = 5; this->lblControlCount->TextAlign = System: rawing::ContentAlignment::MiddleCenter;// // timer1 // this->timer1->Enabled = true; this->timer1->Interval = 800; this->timer1->Tick += new System::EventHandler(this, timer1_Tick); // // btnPreviousPage // this->btnPreviousPage->BackColor = System: rawing::Color::FromArgb((System::Byte)255, (System::Byte)255,(System::Byte)192); this->btnPreviousPage->Enabled = false; this->btnPreviousPage->Font = new System: rawing::Font(S"Microsoft SansSerif", 9, System: rawing::FontStyle::Bold,System: rawing::GraphicsUnit::Point, (System::Byte)162);this->btnPreviousPage->ForeColor = System: rawing::Color::FromArgb((System::Byte)0, (System::Byte)0,(System::Byte)192); this->btnPreviousPage->Location = System: rawing::Point(1024, 8);this->btnPreviousPage->Name = S"btnPreviousPage"; this->btnPreviousPage->Size = System: rawing::Size(96, 40);this->btnPreviousPage->TabIndex = 6; this->btnPreviousPage->Text = S"<<< Previous"; // // btnNextPage // this->btnNextPage->BackColor = System: rawing::Color::FromArgb((System::Byte)255, (System::Byte)255,(System::Byte)192); this->btnNextPage->Enabled = false; this->btnNextPage->Font = new System: rawing::Font(S"Microsoft SansSerif", 9, System: rawing::FontStyle::Bold,System: rawing::GraphicsUnit::Point, (System::Byte)162);this->btnNextPage->ForeColor = System: rawing::Color::FromArgb((System::Byte)0, (System::Byte)0,(System::Byte)192); this->btnNextPage->Location = System: rawing::Point(1128, 8);this->btnNextPage->Name = S"btnNextPage"; this->btnNextPage->Size = System: rawing::Size(80, 40);this->btnNextPage->TabIndex = 7; this->btnNextPage->Text = S"Next >>>"; // // Form1 // this->AutoScaleBaseSize = System: rawing::Size(5, 13);this->BackColor = System: rawing::Color::Black;this->ClientSize = System: rawing::Size(1262, 725);this->Controls->Add(this->btnNextPage); this->Controls->Add(this->btnPreviousPage); this->Controls->Add(this->lblControlCount); this->Controls->Add(this->lblSure); this->Controls->Add(this->btnClearPanel); this->Controls->Add(this->btnKadarSiraYarat); this->Controls->Add(this->txtSiraSayisi); this->Controls->Add(this->bntCreatePanel); this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D; this->MaximizeBox = false; this->MinimizeBox = false; this->Name = S"Form1"; this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen; this->Text = S"Form1 - Once Alt Alta Sonra Yan Yana Diz"; this->WindowState = System::Windows::Forms::FormWindowState::Maximized; this->Load += new System::EventHandler(this, Form1_Load); this->DoubleClick += new System::EventHandler(this, Form1_DoubleClick); this->ResumeLayout(false); } //THIS IS THE FUNCTION WHICH CREATES PANEL private: System::Void bntCreatePanel_Click(System::Object * sender, System::EventArgs * e) { //Panel panel1 = new Panel(); //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Initialize the Panel control. panel1->Location = System: rawing::Point(8,50);panel1->Size = System: rawing::Size( (this->get_Width() - 30),(this->get_Height() - 85)); // Set the Borderstyle for the Panel to three-dimensional. panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; //Backcolor panel1->set_BackColor(System: rawing::Color::Aqua);//Name panel1->Name = String::Concat(S"Panel_Name_", (++i32Panel_Number).ToString()); //TAG panel1->Tag = i32Panel_Number.ToString(); //---------------------------------------------------------------------------------------- // Add the Panel control to the form. this->Controls->Add(panel1); txtSiraSayisi->Enabled = true; btnKadarSiraYarat->Enabled = true; bntCreatePanel->Enabled = false; } private: System::Void CreateRows_Function() { try { //Labels Label __gc *lblA = new Label(); Label __gc *lblB = new Label(); Label __gc *lblC = new Label(); //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Initialize the Label and TextBox controls. lblA->Location = System: rawing::Point(i32Current_Pos_X,i32Current_Pos_Y); lblA->Text = String::Concat(S"Label_", (++i32Label_Number).ToString()); lblA->Name = String::Concat(S"lblA_Name_", (i32Label_Number).ToString()); lblA->Size = System: rawing::Size(i32LabelWidth, i32LabelHeight);lblA->TextAlign = System: rawing::ContentAlignment::MiddleLeft;lblA->ForeColor = System: rawing::Color::Yellow;lblA->BackColor = System: rawing::Color::Black;lblA->Font = new System: rawing::Font(S"Microsoft Sans Serif", 9.75F,System: rawing::FontStyle::Bold, System: rawing::GraphicsUnit::Point,(System::Byte)162); //----------------------------------------------------------------------------------"------ //Update the current i32Current_Pos_X and i32Current_Pos_Y i32Current_Pos_X += (i32LabelWidth + i32SpaceBetweenControls) ; //i32Current_Pos_Y += ; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Initialize the Label and TextBox controls. lblB->Location = System: rawing::Point(i32Current_Pos_X,i32Current_Pos_Y); lblB->Text = String::Concat(S"lblB_Name_", (i32Label_Number).ToString()); lblB->Name = String::Concat(S"lblB_Name_", (i32Label_Number).ToString()); lblB->Size = System: rawing::Size(i32LabelWidth, i32LabelHeight);lblB->TextAlign = System: rawing::ContentAlignment::MiddleLeft;lblB->ForeColor = System: rawing::Color::Yellow;lblB->BackColor = System: rawing::Color::Blue;lblB->Font = new System: rawing::Font(S"Microsoft Sans Serif", 9.75F,System: rawing::FontStyle::Bold, System: rawing::GraphicsUnit::Point,(System::Byte)162); //---------------------------------------------------------------------------------------- //Update the current i32Current_Pos_X and i32Current_Pos_Y i32Current_Pos_X += (i32LabelWidth + i32SpaceBetweenControls) ; //i32Current_Pos_Y += ; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Initialize the Label and TextBox controls. lblC->Location = System: rawing::Point(i32Current_Pos_X,i32Current_Pos_Y); lblC->Text = String::Concat(S"lblC_Name_", (i32Label_Number).ToString()); lblC->Name = String::Concat(S"lblC_Name_", (i32Label_Number).ToString()); lblC->Size = System: rawing::Size(i32LabelWidth, i32LabelHeight);lblC->TextAlign = System: rawing::ContentAlignment::MiddleLeft;lblC->ForeColor = System: rawing::Color::Yellow;lblC->BackColor = System: rawing::Color::Gray;lblC->Font = new System: rawing::Font(S"Microsoft Sans Serif", 9.75F,System: rawing::FontStyle::Bold, System: rawing::GraphicsUnit::Point,(System::Byte)162); //---------------------------------------------------------------------------------------- //Update the current i32Current_Pos_X and i32Current_Pos_Y i32Current_Pos_X = i32Current_Column_Pos_X ; i32Current_Pos_Y = i32Current_Pos_Y + i32LabelHeight + i32SpaceBetweenControls; ; if ( (this->panel1->Height - i32Current_Pos_Y) >= (i32SpaceBetweenControls + i32LabelHeight) ) { } else { //Alta sira konulamaz, yana konulabilir i32Current_Column_Pos_X = i32Current_Pos_X + i32LabelWidth + i32SpaceBetweenControls + i32LabelWidth + i32SpaceBetweenControls + i32LabelWidth + (5*i32SpaceBetweenControls) ; i32Current_Pos_X = i32Current_Column_Pos_X; i32Current_Pos_Y = 8; } // Add the Label controls to the Panel. panel1->Controls->Add(lblA); panel1->Controls->Add(lblB); panel1->Controls->Add(lblC); // Add the event handler that will handle the event when the // mouse is hovered lblA->Click += new System::EventHandler(this, labelXXX_Click); lblB->Click += new System::EventHandler(this, labelXXX_Click); lblC->MouseHover += new System::EventHandler(this, labelXXX_MouseHover); //Buton Enable btnClearPanel->Enabled = true; } catch(Exception* exp) { MessageBox::Show(Convert::ToString(exp), S"Exception Thrown"); } } private: System::Void bntKadarSiraYarat_Click(System::Object * sender, System::EventArgs * e) { if (txtSiraSayisi->Text->Trim()->Length >0 ) { Int32 i32SiraSayisi = Convert::ToInt32(txtSiraSayisi->Text->Trim()); LARGE_INTEGER i64StartTime, i64StopTime , i64Frequency ; //CPU frekansını al QueryPerformanceFrequency(&i64Frequency); if (QueryPerformanceCounter(&i64StartTime) != 0) { for( Int32 i32Index = 1; i32Index <= i32SiraSayisi; ++i32Index) { if ( ((this->panel1->Height - i32Current_Pos_Y) >= (i32SpaceBetweenControls + i32LabelHeight)) && ( (this->panel1->Width - i32Current_Pos_X) >= ( (5 * i32SpaceBetweenControls) + (3*i32LabelWidth))) ) { CreateRows_Function(); //this->Refresh(); txtSiraSayisi->Text = Convert::ToString( Convert::ToInt32(txtSiraSayisi->Text->Trim()) - 1 ); } else { break; } } QueryPerformanceCounter(&i64StopTime); lblSure->Text = String::Concat( S"Row Creating Duration = ", ((long int)(double)((i64StopTime.QuadPart - i64StartTime.QuadPart) * 1000.0) / ((double)i64Frequency.QuadPart)).ToString(), S" mili seconds"); } txtSiraSayisi->Focus(); } } private: System::Void btnClearPanel_Click(System::Object * sender, System::EventArgs * e) { try { LARGE_INTEGER i64StartTime, i64StopTime , i64Frequency ; //CPU frekansını al QueryPerformanceFrequency(&i64Frequency); if (QueryPerformanceCounter(&i64StartTime) != 0) { panel1->Controls->Clear(); //Initialize the curretn location i32Current_Pos_X = 8; i32Current_Pos_Y = 8; i32Current_Column_Pos_X = 8 ; i32Label_Number = 0; //Buton Enable btnClearPanel->Enabled = false; QueryPerformanceCounter(&i64StopTime); lblSure->Text = String::Concat( S"Clearing Duration = ", ((long int)(double)((i64StopTime.QuadPart - i64StartTime.QuadPart) * 1000.0) / ((double)i64Frequency.QuadPart)).ToString(), S" mili seconds"); } } catch(...) { } } private: System::Void labelXXX_MouseHover(System::Object * sender, System::EventArgs * e) { if (String::Compare(sender->GetType()->ToString(), S"System.Windows.Forms.Label") == 0) { // Create a button object to use in its place Label* myLabel = dynamic_cast<Label*>(sender); // Display the text to the user MessageBox::Show(String::Concat(myLabel->Text, S" MouseHover"), this->Text, MessageBoxButtons::OK, MessageBoxIcon::Information); } } private: System::Void labelXXX_Click(System::Object * sender, System::EventArgs * e) { if (String::Compare(sender->GetType()->ToString(), S"System.Windows.Forms.Label") == 0) { // Create a button object to use in its place Label* myLabel = dynamic_cast<Label*>(sender); // Display the text to the user MessageBox::Show(String::Concat(myLabel->Text, S" is clicked!" ) , this->Text, MessageBoxButtons::OK, MessageBoxIcon::Information); } } private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e) { this->MinimumSize = System: rawing::Size(this->get_Width(),this->get_Height()); } private: System::Void Form1_DoubleClick(System::Object * sender, System::EventArgs * e) { this->WindowState = Maximized; } private: System::Void timer1_Tick(System::Object * sender, System::EventArgs * e) { if ( this->panel1 != NULL ) lblControlCount->Text = String::Concat(S"Number of Controls on Panel = ", this->panel1->Controls->Count.ToString()); } }; } |
|
||
|
||||
|
Asher Efrati
Guest
Posts: n/a
|
"Bil Muh" wrote: > Esteemede Developers, > > I would like to Thank All of You in advance for your sincere guidances. > > I am developing a software using Visual C++ .NET Standard Edition with > Windows Form (.NET) template. > > Briefly : > -------------------------------------------------------------------------------------------- > I need to create dynamically some controls on the forms, and display these > controls page by page on the form by using "Previous Page" and "Next Page" > buttons. > > In detailed : > -------------------------------------------------------------------------------------------- > I will read some information from a file. The contents of this file include > Parameter information line by line. Each line is formatted. We may think > that, this file is a Table with some columns of a database. > > Format of each line is similar to following: > Param_Number;Param_Name;Default_Value;Unit;Info1; > > Firstly, I will read this file and determine how many rows exist. Then, I > will create dynamically some controls for each line. Dynamically created > controls are as below: > 1. Param_Number : Label > 2. Param_Name : Label > 3. Default_Value : Label (contents of this field will change during the > running of application) > 4. Unit : Label > > This group of controls will be created on the form dynamically. > > The number of rows ( number of parameters) may change file to file, but > row data format will be same. > > My form's size will be maximized. I want to create control groups as much > as on the form one under the other. Let's say the number of parameter is > 1000, and It is possible to dynamically create 50 control groups on the form. > This means than it is required to create 20 different pages on the form. > > These are my questions...!! > > **** How can I create dynamically controls on the form? , > **** How can I show them page by page on the form.? and > **** How can I go through on the pages with "Previous Page" and "Next > Page" buttons? > > I will receive some parameter values from TCP/IP socket periodically. > Therefore I have to change the received parameter values at the related > Labels in each page on the form. > > I am requesting you to guide me ... > > With this, I extend you and all yours with my bests. > > Respectfully, yours > > Bil Muh > |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Page lifecycle and dynamic controls | Hans Kesting | Microsoft ASP .NET | 5 | 3rd Nov 2008 07:12 PM |
| Create Dynamic Controls and Displaying Page by Page on the form | =?Utf-8?B?QmlsIE11aA==?= | Microsoft VC .NET | 8 | 10th Feb 2008 10:27 AM |
| Best practice - dynamic controls vs page life cycle vs viewstate | HP | Microsoft ASP .NET | 2 | 1st Apr 2007 11:07 PM |
| creation of a set of dynamic hyperlink controls into a page | Carlos | Microsoft ASP .NET | 1 | 10th Nov 2006 01:57 PM |
| Controls on form move when I press Page Up or Page Down | ocmcnl | Microsoft Access Forms | 0 | 31st Jan 2006 09:30 PM |
Powered by vBulletin®. Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2010, Crawlability, Inc. |




