VC Common Getting Started Summary (2)

zhaozj2021-02-16  57

VC Common Getting Started Summary (2)

1: Why can't my drop-down list not find the added content?

VC If the patch is not installed, the drop-down list box just dragged from the control bar to the designed dialog box, the height of the drop-down list is small, so it often occurs the content of the content, in the dialog design, click below The triangle on the right side of the list, then drag the drop-down list.

2: Why is one bitmap in the print state? Is it very small?

It can be considered that the bitmap is made of color dot matrix, so in general, it only has the concept of the number of horizontal longitudinal pixels, and there is no concept of the horizontal longitudinal width height specific value, and therefore, the display size of the bitmap is displayed by the display bit. The resolution of the apparatus of the figure is determined. The size of the pixel point of the display is much larger than the printer, so a bitmap print and a very small problem in print preview state. Solving the StretchBLT function to pull the graph, see the applet below:

/ *

// Print or draw a bitmap on the screen

/ / PDC printer or screen DC pointer

Ilogpixelx

Ilogpixely

The GetDeviceCaps (Logpixelsx) value of the screen DC, where

Ilogpixelx = dc.getDeviceCaps (LogPixelsx);

Ilogpixely = dc.getDeviceCaps (Logpixelsy);

Strfilename BMP file

* /

Void DrawBMP (CDC * PDC, INT ILOGPIXELX, ILOGPIELY, Const Char * Strfilename)

{

CDC MEMDC; // Memory device environment pointer, the entire existence process will exist

CBITMAP Bitmap, * PoldBMP;

CRECT SOURCE, DEST; // Record source bitmap size and final display size

Bitmap BM;

IF (MEMDC.GETSAFEHDC () == NULL)

{

Hbitmap hbitmap = (hbitmap) loading (0, strfilename, image_bitmap, 0, 0, lr_createdibsection | lr_defaultsize | lr_loadfromfile);

Bitmap.attach (hbitmap);

MEMDC.CREATECOMPALEDC (PDC);

Bitmap.GetObject (Sizeof (BM), & BM);

PoldBMP = MEMDC.SELECTOBJECT (& BITMAP);

Source.top = 0;

Source.Left = 0;

Source.right = bm.bmwidth;

Source.bottom = BM.BMHEIGHT;

Dest = Source;

}

PDC-> DPTOLP (& DEST);

IF (PDC-> isprinting ())

{

DEST.LEFT = (int) (DOUBLE) PDC-> getDeviceCaps (Logpixelsx)) / iLogpixelx);

DEST.right = (int) (DEST.Right * ((Double) PDC-> getDeviceCaps (Logpixelsx)) / iLogpixelx);

DEST.TOP = (int) (DEST.TOP * ((Double) PDC-> getDeviceCaps (Logpixelsy)) / iLogpixally

DEST.BOTTOM = (int) (DOUBLE) PDC-> getDeviceCaps (LogPixelsy)) / iLogpixly

PDC-> Stretchblt (dest.Lest, Dest.top, DEST.RIGHT, DEST.BOTTOM,

& MEMDC, Source.Left, Source.top, Source.right, Source.Bottom, Srcopy;

MEMDC.SELECTOBJECT (POLDBMP);

Bitmap.deleteObject ();

MEMDC.DELETEDC ();

Return;

}

3: How to get the current application path?

Char * str = new char [256]; :: getModuleFileName (null, str, max_path); // STR is the DELETE [] str; str = NULL;

转载请注明原文地址:https://www.9cbs.com/read-22835.html

New Post(0)