The main Menu is called the MenuStrip Menu’s that pop up within the context of some control, for instance when you right click, use the ContextMenuStrip. Creating a MenuStrip Drag the menu tool onto the top of the form You can edit the menu contents using the properties > collections (recomended for complex menu’s), or […]
All posts by
Regex IsMatch
Notes about Regex::IsMatch if (!System::Text::RegularExpressions::Regex::IsMatch (this->MyString->Text, “[0-9a-fA-f]{1,3}” )) MessageBox::Show ( “Invalid value” ); The problem with the above expression is that it doesn’t match what it should. There are 2 special characters, ^ and $ which specify the beginning and the end of the string to match. The way you used it, it matches any […]
Scroll Bars
Event When A Change Is Complete Use MouseCaptureChanged event with this if (!srlTimeline->Capture) //Don't do if scroll bar is being dragged (only do if this is the release event) { Scroll Event This is a general event that is triggered for many things, such as the scroll bar is moved to a new position. Use its […]
Table Layout Panel For Large Arrays
This example assumes there is a form that has a TableLayoutPanel with a vertical and horizontal scroll bar. The form can be resized and when it is the TableLayoutPanel is re-created to only include what is visible. This means that only the controls that can be seen are created and makes creating and updating it […]
Table Layout Panel
Use to make tables and grids which may have any control in each of their cells. Making Table Properly Resize On Change Of Contents There seems to be an issue with reducing the number of columsn and rows but the TLP scroll bars remaining at the previous larger size. A way to get round this […]
FTDI USB Devices
Finding Connected FTDI Devices using namespace Microsoft::Win32; //< Needed to access registry int Count; int CharPosn; int CheckEachPortCount; String ^RegistryMainFolder; String ^SerialNumber; String ^Port; array<String^> ^FoundCommPorts = gcnew array<String^>(0); array<String^> ^FoundSerialNumbers = gcnew array<String^>(0); //—– SETUP THE COMM PORT COMBO BOX —– //Add the default comm port "None" cmbCommPort->Items->Add(L"None"); try { //—– DISCOVER ALL AVAILABLE […]
Serial Port
using namespace System::IO::Ports; To Discover Available Comm Ports On The PC array<String^> ^AvailableSerialPorts; array<unsigned char> ^aTemp; String ^sTemp; try { AvailableSerialPorts = SerialPort::GetPortNames(); cmbCommPort->Items->Add("None"); for(int Count = 0; Count < AvailableSerialPorts->Length; Count++) { sTemp = AvailableSerialPorts[Count]; //Remove any non numeric last letter which can be added by microsoft bluetooth drivers aTemp = System::Text::Encoding::UTF8->GetBytes(sTemp); while ( […]
Shockwave Flash
Good Resources http://www.codeproject.com/KB/audio-video/flashexternalapi.aspx Add Shockwave Flash Movie To Your Form Rightclick in the form Tools popout menu and select ‘Choose Items’. Select the ‘COM Components’ tab and check ‘ShockwaveFlashObject’ which should be enabled if you have flash installed. Properties to change: Menu False Form Load AxShockwaveFlash1->Left = 0; AxShockwaveFlash1->Top = 0; AxShockwaveFlash1->Width = this->Width; AxShockwaveFlash1->Height […]
ToolTip Text
Adding Tool Tip Text To Form Components Add this to the global variables & classes declarations private: ToolTip^ toolTip1; Add this to the constructor //—– CREATE TOOL TIP TEXT —– toolTip1 = gcnew ToolTip; Add this to the formLoad Event //——————————- //—– SETUP TOOL TIP TEXT —– //——————————- toolTip1->AutoPopDelay = 5000; //mS – time ToolTip […]
typeof
Not used in VC++ For managed code use typeid instead: MyClassName::typeid N.B. typeid isn't shown as an as you type option after :: but when fully typed it becomes blue to confirm the special keyword. If using /clr:oldSyntax command line option you can use __typeof instead: __typeof(MyClassName) Examples XmlSerializer ^XmlSerializer1 = gcnew XmlSerializer(MyClassName::typeid); An example creating a […]
