Ever wondered how those cute little round dialog boxes are created. I too wondered for some time. But let me tell you it is easy, take a look: Do this from OnInitDialog! [sourcecode language=’cpp’]//Create a region object globally. CRgn m_EllipticRegion; //a rect object CRect crDialogRect; //get your dialog size this->GetClientRect(crDialogRect); //Now create the elliptic region […]
Continue reading…
Posts tagged with 'CDialog'
What happens before and after OnInitDialog!
Two functions to look up would be… _AfxPreInitDialog _AfxPostInitDialog As the name suggests _AfxPreInitDialog gets called before OnInitDialog is called and _AfxPostInitDialog gets called after OnInitDialog. One of the things that happens in _AfxPostInitDialog is centering of a dialog if user hasn’t changed position of the dialog in OnInitDialog, so how is this done? _AfxPreInitDialog […]
Continue reading…
Creating a dialog from it’s template!
Here is a sample on how to do it… [sourcecode language=’cpp’]CDialogTemplate dlgTemplate; // Load dialog template into memory dlgTemplate.Load( MAKEINTRESOURCE( IDD_DIALOG_ID )); // Change font of dialog dlgTempl.SetFont( _T( “Courier” ), 10 ); // Creates and displays a modal dialog from a template in memory CDialog dlg; dlg.InitModalIndirect( dlgTemplate.m_hTemplate, 0 ); dlg.DoModal();[/sourcecode] What’s the use […]
Continue reading…