Opening a form #include "FormName.h" //Add this at top of file frmConfiguration ^ConfigForm = gcnew frmConfiguration(); ConfigForm->PassedValue1 = "This is a string I'm passing"; //TO OPEN AS A DIALOG FORM: ConfigForm->ShowDialog(); //or if (ConfigForm->ShowDialog() == System::Windows::Forms::DialogResult::OK) else if (ConfigForm->DialogResult == System::Windows::Forms::DialogResult::Cancel) //TO OPEN NOT AS A DIALOG FORM: ConfigForm->Show(); Closing a form Close(); //or this->Close(); […]
Category: Forms
Add a form from another project
Copy the .h, .cpp and .resx files into the project directory. Right click the project name in the solution explorer and use 'Add Existing Item' to add them to the project. Select the .h file and then in the properties change the file type from "C++ Class" to "C++ Form" Troubleshooting missingmanifestresourceexception error Wth an […]
Calling A Form Control Event
The maximum value of a scrollbar can only be reached programmatically. The value of a scroll bar cannot reach its maximum value through user interaction at run time. The maximum value that can be reached through user interaction is equal to 1 plus the Maximum property value minus the LargeChange property value. If necessary, you […]
Child Forms / Multiple Document Interface
Int Note: Kin Lib uses child forms Applications that have a main window which contain one or more child windows are called Multiple Document Interface (MDI) For the parent form (for instance the form created when creating a new project) set the IsMdiContainer property to true. Add a menu strip to the form and create […]
Create New Form
Creating The Form Project > Add New Item > Windows Form. Name it using 'frm' at the start (our convention) Set the 'Form Border Style' Set 'MaximiseBox' and 'MinimizeBox' properties Set StartPostion Set 'Text' Set 'icon' (or turn off ShowIcon) Nice Things To Do Add this before the constructor //********************************* //********************************* //********** CONSTRUCTOR ********** //********************************* //********************************* […]
Cursor
Show and hide the cursor Cursor->Show(); Cursor->Hide();
Focus
Detecting Form Has Got Focus Use the ‘Activated’ event Bring Form To Front this->BringToFront(); Does A Specific Control Have Focus? if (txtMyTextBox->ContainsFocus) Give an object on the form focus //Use the objects focus property: ObjectName->Focus(); //or give the form itself focus: frmMyForm->Focus(); Forcing a form to always be on top Set the forms ‘Top Most’ […]
Form Controls and Objects
Indexing Controls (refer to them by index number) Use a group box Stopping Refresh Of A Control ListBox->BeginUpdate(); //Supress drawing the listbox . . . ListBox->EndUpdate(); //Resume drawing of the list box Tab Control To see which tab is active use:- if (TabName->Visible) Visible doesn’t dictate if a tab is displayed, it tells you if […]
Function For Multiple Form Objects – What Object Called An Event?
You can assign the same event to multiple controls. When called the "object sender" portion will be a reference to whatever one of the controls was clicked. The EventArgs portion is a way to pass extra information to the event handler. Some events use a derivative of EventArgs which contain extra information. The function will […]
Link two forms
Set the secondary form owner to the main form. For instance, if you have created another form you do this: frmMyOtherForm->Owner = this;