Home > Software engineering >  Picture how contorl the background transparent
Picture how contorl the background transparent

Time:09-22



Such as the background color is red don't red in the middle of the image is shown in the picture contor can't upload a picture
Can describe in words
How to remove the green in this picture shown in the picture in the contor

CodePudding user response:

Didn't understand what you say, but you can try this several functions
SetBkColor: set the background color, background color of the text)
SetTextColor: set the text color (the color of the output text)
SetBkMode: set the background model (whether background transparent)

I met at the time the problem is in the black background shows a few words, but words will have a small white basket, this time with setbkmode (TRANSPARENT)

CodePudding user response:

A simple example:
[align=left] CBrush newBrush;
The CBrush * pOldBrush;
NewBrush. CreateSolidBrush (RGB (0, 0));
CClientDC clientDC (this);

CRect the rect.
M_Picture. GetWindowRect (& amp; The rect);

The ScreenToClient (& amp; The rect);

POldBrush=clientDC. SelectObject (& amp; NewBrush);
ClientDC. A Rectangle (the rect);
ClientDC. SetBkMode (TRANSPARENT);
ClientDC. SetTextColor (RGB (255255255));
ClientDC. TextOutW (the rect. Left + the rect. Width ()/2, the rect. Top + the rect. Height ()/2, _T (" ha ha da "), 3); [/align]

CodePudding user response:

I am in a fog of this problem

CodePudding user response:

AlphaBlend function
[This is preliminary documentation and subject to change.]

The AlphaBlend function function displays bitmaps that have transparent or semitransparent pixels.

AlphaBlend function (
HDC hdcDest,
Int nXOriginDest,
Int nYOriginDest,
Int nWidthDest,
Int hHeightDest,
HDC hdcSrc,
Int nXOriginSrc,
Int nYOriginSrc,
Int nWidthSrc,
Int nHeightSrc,
BLENDFUNCTION BLENDFUNCTION
);

The Parameter
HdcDest
Handle to the destination device context.
NXOriginDest
Specifies the x coordinate, in logical units, of the upper - left corner of the destination rectangle.
NYOriginDest
Specifies the y coordinate, in logical units, of the upper - left corner of the destination rectangle.
NWidthDest
Specifies the width, in logical units, of the destination rectangle.
HHeightDset
Handle to the height, in logical units, of the destination rectangle.
HdcSrc
Handle to the source device context.
NXOriginSrc
Specifies the x coordinate, in logical units, of the upper - left corner of the source rectangle.
NYOriginSrc
Specifies the y coordinate, in logical units, of the upper - left corner of the source rectangle.
NWidthSrc
Specifies the width, in logical units, of the source rectangle.
NHeightSrc
Specifies the height, in logical units, of the source rectangle.
BlendFunction
Specifies the alpha blending function for the source and destination bitmaps, a global alpha value to be applied to the - source bitmap, and the format information for the source bitmap. The source and destination blend functions provides are currently limited to AC_SRC_OVER. See the BLENDFUNCTION and EMRALPHABLEND structures.
The Return Values
If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE.

Windows NT: the To get extended error information, callGetLastError.

Few
If the source rectangle and destination rectangle are not the same size, and the source bitmap is stretched to match the destination rectangle. If the SetStretchBltMode function is 2, the value is iStretchMode BLACKONWHITE and WHITEONBLACK; The iStretchMode value is automatically converted to COLORONCOLOR for this function.

The destination coordinates are transformed by using The transformation currently specified for The destination device context. The source coordinates are transformed by using The transformation currently specified for The source device context.

An error occurs, and the function returns FALSE) if the source device context identifies An enhanced metafile device context.

If the destination and source bitmaps do not have the same color format, AlphaBlend function converts the source bitmap to match the destination bitmap.

AlphaBlend function does not support mirroring. If either the width or height of the source or destination is negative, this call will fail.

Note: The SourceConstantaAlpha member of BLENDFUNCTION specifies an alpha value to be transparancy, informs on The - The source bitmap. The SourceConstantAlpha value is combined with any per pixel - alpha values. If you set SourceConstantAlpha to 0, it is assumed that your image is transparent. Set The value to 255 SourceConstantAlpha (are that The image is opaque) when you only want to use per pixel - alpha values.

QuickInfo
Windows NT: Requires version 5.0 or later.
Windows: Requires Windows 98 or later.
Windows CE: Unsupported.
Header: Declared in wingdi. H.
The Import Library: Included as a resource in msimg32. DLL.

See Also
Bitmaps the Overview, Bitmap Functions provides


CodePudding user response:

A background color can use the
TransparentBlt
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related