nav-left cat-right
cat-right

Open, Save and Read Bitmaps

The task to read a bitmap into a data array, show this bitmap and save an array or dc to a file sound like a simple task but is rather difficult in reality if one uses MFC. Maybe I am totaly wrong when stating this, but that is my result of one week searching for solutions and implementing my own ones. What I have achieved can be as an example project.   bitmapopenandsave.zip (61,0 KiB) The idea of these classes is...

Show Dialog on Second Screen

The following Code maximises a dialog on the second screen. The code is available for download:   DrawOnSecondScreen.zip (43,9 KiB) void DlgSecondScreen::ResizeDialog(const CRect newRect) { // Resize Dialog SetWindowPos(&CWnd::wndTop, newRect.left, newRect.top, newRect.right, newRect.bottom, SWP_SHOWWINDOW | // Displays the window. SWP_NOCOPYBITS // Do NOT Save content ); }   void...

Flicker Free example with CStatic Control

The following code shows how to paint into a CStatic Control and make sure this painting is flicker-free. Overloading of CStaticCGraphCtrlFlicker Free drawingResizing of Images The example code for download:   FlickerFreeDemoStatic.zip (61,6 KiB) Overloading of CStatic Unfortunately one can not draw inside a CStatic control directly. Therefore one need to overload the CStatic class an do the following (let...

Flicker Free example with dialog

One can find several examples for flicker free drawing in MFC. (see for example Flicker Free Drawing In MFC) Here is an example done by myself. I used the CMemDC Class posted in Enhanced CMemDC. The example code for download:   FlickerFreeDemoBackground.zip (27,7 KiB) What is the magic? We need to make sure, that the background of our window is not painted when OnPaint is called. For that we need to include the...

Enhanced CMemDC

Flicker Free drawing onto a dc can be realised by using the class CMemDC by Keith Rule (Flicker free drawing using memory DC) I changed the Class in such a way that it supports the automatic resizing of images that have higher or lower size than the dc that it is painted onto. The change is thus from using BitBlt to StretchBlt. CMemDC.h #ifndef _MEMDC_H_ #define _MEMDC_H_  ...

Streams in C++

Bei der Einarbeitung der Ein und Ausgabe von Daten in C++ bin ich bei der Suche nach Dokumentationen zu streams auf folgende Webseiten gestoßen: http://www.cplusplus.com/reference/iostream/ Ein- und Ausgabe in C++ – IO-Streams http://www.mathematik.uni-marburg.de/~cpp/streams/index.html Writing integers in different...

Convert Cstring to int

The solution is the following CString samplecstring; int i = _ttoi(samplecstring);CString samplecstring; int i = _ttoi(samplecstring); further conversion examples are listed at http://www.codeproject.com/cpp/data_conversions.asp. Converting backwards from int to CString can be done via int i = 255; Cstring text; text.Format(_T("%d"), i);int i = 255; Cstring text;...

Add non modal dialog to project

If we have an existing project one needs to do the following steps to add an non-modal dialog. Example Project:   ModelessDialog.zip (45,5 KiB) Add a new dialog to the project and add a class for that dialog Add a member variable for the dialog to the application class. If our project is called ‚SecondDialog‘ the application class would then look like this class CSecondDialogApp : public CWinApp {...
Seite 15 von 18« Erste...10...1314151617...Letzte »