since hook is not supported under wince, therefore, it is very helpful to change the software of Ce. However, I have seen a foreign website with the Code I didn't understand it. Oh, I am too watery. This involves another problem. I haven't found a method to implement hook. I have to find another method, therefore, you should rewrite the control in any case. Refer to the skin replacement implemented by some VC and implement the basic class cbitmapsk here. One of the depressing points is that EVC does not fully support crgn, And it is troublesome to implement windows of any shape. Therefore, an important function cannot be implemented. If you want to implement other functions,
///////////////////////////////////// /// //
> // basesk. h: interface for the cbitmapsk class.
// Writer: erran
// time:
/////////////////////////////// /// //
Class cbitmapsk: Public cbitmap
{
Public:
Cbitmapsk ();
Virtual ~ Cbitmapsk ();
// Load bitmap by resource file path
Bool loadbitmapex (lpctstr lpszfilename );
// Load bitmap by resource name or ID
Bool loadbitmapex (lpctstr lpszresourcename, uint nidresource );
// Attaches a hbitmap to a cbitmap object.
Bool attach (hbitmap hbmp)
{
Return cbitmap: attach (hbmp );
}
Void Size (Int & width, Int & height)
{
Bitmap bm;
Memset (& BM, 0, sizeof (BM ));
Cbitmap: getbitmap (& BM );
Width = BM. bmwidth;
Height = BM. bmheight;
}
// Bitmap width
Int width (void)
{
Bitmap bm;
Memset (& BM, 0, sizeof (BM ));
Cbitmap: getbitmap (& BM );
Return BM. bmwidth;
}
// Bitmap height
Int height ()
{
Bitmap bm;
Memset (& BM, 0, sizeof (BM ));
Cbitmap: getbitmap (& BM );
Return BM. bmheight;
}
//// // SRC (BMP) ---> des (PDC)
// Draw current bitmap to device (PDC rect (LPR ))
Bool draw (CDC * PDC, lprect lprdes );
// Draw current bitmap to device (PDC rect (LPR), transparent
Bool draw (CDC * PDC, lprect lprdes, colorref crtrans, bool istrans );
// Draw sub Bitmap (the rect lprsrc of current Bitmap) to special point (the begin point (x, y) of PDC device)
Bool draw (CDC * PDC, int X, int y, lprect lprsrc );
// Draw sub bitmap to Special Point
Bool draw (CDC * PDC, int X, int y, lprect lprsrc, colorref crtrans, bool istrans );
Bool fill (CDC * PDC, lprect lprdes );
Bool fill (CDC * PDC, lprect lprdes, colorref crtrans, bool istrans );
Bool fill (CDC * PDC, lprect lprdes, lprect lprsrc );
Bool fill (CDC * PDC, lprect lprdes, lprect lprsrc, colorref crtrans, bool istrans );
// Drawing transparent bitmaps, copies a bitmap transparently onto the destination DC
Bool transparentdraw (CDC * PDC, int X, int y, colorref crcolour );
// Copies a bitmap from a source rectangle into a destination rectangle,
// Stretching or compressing the bitmap if necessary to fit the dimensions of the destination rectangle.
Bool stretchdraw (CDC * PDC, lprect lprdes, lprect lprsrc );
// Copies a bitmap from a source rectangle into a destination rectangle,
// Stretching or compressing the bitmap if necessary to fit the dimensions of the destination rectangle.
Bool stretchdraw (CDC * PDC, lprect lprsrc );
// Make a region from bitmap, it will show as a window: faulse function :::
// Hrgn createregion (colorref crcolour, bool istrans = true );
};
/// For class cbitmapsk
Cbitmapsk: cbitmapsk ()
{
}
Cbitmapsk ::~ Cbitmapsk ()
{
}
Bool cbitmapsk: loadbitmapex (lpctstr lpszfilename)
{
Deleteobject ();
Assert (m_hobject = NULL );
Hbitmap = NULL;
Hbitmap = (hbitmap): LoadImage (0, lpszfilename, image_bitmap, 0, 0, 0 );
If (hbitmap = NULL) return false;
Return cbitmap: attach (hbitmap );
}
Bool cbitmapsk: loadbitmapex (lpctstr lpszresourcename, uint nidresource)
{
Deleteobject ();
Assert (m_hobject = NULL );
If (lpszresourcename! = NULL)
{
Return cbitmap: loadbitmap (lpszresourcename );
}
If (nidresource! = 0)
{
Return cbitmap: loadbitmap (nidresource );
}
Return false;
}
Bool cbitmapsk: Draw (CDC * PDC, lprect lprdes)
{
Assert (PDC! = NULL );
Cdc dc;
DC. createcompatibledc (PDC );
Cbitmap * BMP = Dc. SelectObject (this );
PDC-> bitblt (lprdes-> left, lprdes-> top,
Lprdes-> right-lprdes-> left, lprdes-> bottom-lprdes-> top,
& DC, 0, 0, srccopy );
DC. SelectObject (BMP );
DC. deletedc ();
BMP = NULL;
Return true;
}
Bool cbitmapsk: Draw (CDC * PDC, lprect lprdes, colorref crtrans, bool istrans)
{
Assert (PDC! = NULL );
If (! Istrans)
{
Return draw (PDC, lprdes );
}
Else
{
Return transparentbitblt (PDC-> getsafehdc (),
Lprdes-> left, lprdes-> top, width (), height (),
(Hbitmap) This-> getsafehandle (), 0, crtrans, null );
}
}
Bool cbitmapsk: Draw (CDC * PDC, int X, int y, lprect lprsrc)
{
Assert (PDC! = NULL );
Cdc dc;
DC. createcompatibledc (PDC );
Cbitmap * poldbmp = Dc. SelectObject (this );
If (lprsrc! = NULL)
{
// Copies a bitmap from the source device context to this current device context
PDC-> bitblt (X, Y, lprsrc-> right-lprsrc-> left, lprsrc-> bottom-lprsrc-> top,
& DC, lprsrc-> left, lprsrc-> top, srccopy );
}
Else
{
PDC-> bitblt (X, Y, width (), height (), & DC, 0, 0, srccopy );
}
DC. SelectObject (poldbmp );
DC. deletedc ();
Poldbmp = NULL;
Return true;
}
Bool cbitmapsk: Draw (CDC * PDC, int X, int y, lprect lprsrc, colorref crtrans, bool istrans)
{
Assert (PDC! = NULL );
If (! Istrans)
{
Return draw (PDC, X, Y, lprsrc );
}
Else
{
Return transparentbitblt (PDC-> getsafehdc (), X, Y, lprsrc-> right-lprsrc-> left, lprsrc-> bottom-lprsrc-> top,
(Hbitmap) This-> getsafehandle (), lprsrc-> left, lprsrc-> top, crtrans, null );
}
}
Bool cbitmapsk: Fill (CDC * PDC, lprect lprdes, lprect lprsrc)
{
Assert (PDC! = NULL );
Int widthdes, widthsrc, heightdes, heightsrc;
Widthdes = ABS (lprdes-> right-lprdes-> left );
Widthsrc = ABS (lprsrc-> right-lprsrc-> left );
Heightdes = ABS (lprdes-> bottom-lprdes-> top );
Heightsrc = ABS (lprsrc-> bottom-lprsrc-> top );
Int paddingx, paddingy, I, j;
Paddingx = int (widthdes/widthsrc );
Paddingy = int (heightdes/heightsrc );
Cdc dc;
DC. createcompatibledc (PDC );
Cbitmap * poldbmp = Dc. SelectObject (this );
If (widthdes <= widthsrc)
{
If (heightdes <= heightsrc)
{
Draw (PDC, lprdes );
}
Else
{
For (I = 1; I <paddingy; I ++)
{
PDC-> bitblt (lprdes-> left, lprdes-> top + heightsrc * (I-1), widthdes, heightsrc, & DC, lprsrc-> left, lprsrc-> top, srccopy );
}
PDC-> bitblt (lprdes-> left, lprdes-> top + heightsrc * (I-1), widthdes, heightdes-heightsrc * (I-1), & DC, lprsrc-> left, lprsrc-> top, srccopy );
}
}
Else
{
If (heightdes <= heightsrc)
{
For (I = 1; I <paddingx; I ++)
{
PDC-> bitblt (lprdes-> left + widthsrc * (I-1), lprdes-> top, widthsrc, heightdes, & DC, lprsrc-> left, lprsrc-> top, srccopy );
}
PDC-> bitblt (lprdes-> left + widthsrc * (I-1), lprdes-> top, widthdes-widthsrc * (I-1), heightdes, & DC, lprsrc-> left, lprsrc-> top, srccopy );
}
Else
{
For (j = 1; j <= paddingy; j ++)
{
For (I = 1; I <= paddingx; I ++)
{
PDC-> bitblt (lprdes-> left + widthsrc * (I-1), lprdes-> top + heightsrc * (J-1), widthsrc, heightsrc, & DC, lprsrc-> left, lprsrc-> top, srccopy );
}
PDC-> bitblt (lprdes-> left + widthsrc * (I-1), lprdes-> top + heightsrc * (J-1), widthdes-widthsrc * (I-1), heightsrc, & DC, lprsrc-> left, lprsrc-> top, srccopy );
}
}
For (I = 1; I <= paddingx; I ++)
{
PDC-> bitblt (lprdes-> left + widthsrc * (I-1), lprdes-> top + heightsrc * (J-1), widthsrc, heightdes-heightsrc * (J-1), & DC, lprsrc-> left, lprsrc-> top, srccopy );
}
PDC-> bitblt (lprdes-> left + widthsrc * (I-1), lprdes-> top + heightsrc * (J-1), widthdes-widthsrc * (I-1 ),
Heightdes-heightsrc * (J-1), & DC, lprsrc-> left, lprsrc-> top, srccopy );
}
DC. SelectObject (poldbmp );
DC. deletedc ();
Poldbmp = NULL;
Return true;
}
Bool cbitmapsk: transparentdraw (CDC * PDC, int X, int y, colorref crtrans)
{
Assert (PDC! = NULL );
Return transparentbitblt (PDC-> getsafehdc (), X, Y, width (), height (), (hbitmap) This-> getsafehandle (),
0, 0, crtrans, null );
}
Bool cbitmapsk: stretchdraw (CDC * PDC, lprect lprdes, lprect lprsrc)
{
Assert (PDC! = NULL );
If (lprdes = NULL) return false;
Cdc dc;
DC. createcompatibledc (PDC );
Cbitmap * poldbmp = Dc. SelectObject (this );
// Setstretchbltmode (PDC-> getsafehdc (), coloroncolor );
If (! Lprsrc)
{
PDC-> stretchblt (lprdes-> left, lprdes-> top, lprdes-> right, lprdes-> bottom, & DC, 0, 0, width (), height (), srccopy );
}
Else
{
PDC-> stretchblt (lprdes-> left, lprdes-> top, lprdes-> right-lprdes-> left, lprdes-> bottom-lprdes-> top,
& DC, lprsrc-> left, lprsrc-> top, lprsrc-> right-lprsrc-> left, lprsrc-> bottom-lprsrc-> top, srccopy );
}
DC. SelectObject (poldbmp );
DC. deletedc ();
Poldbmp = NULL;
Return true;
}
Bool cbitmapsk: stretchdraw (CDC * PDC, lprect lprsrc)
{
Assert (PDC! = NULL );
Cdc dc;
DC. createcompatibledc (PDC );
Cbitmap * poldbmp = Dc. SelectObject (this );
PDC-> stretchblt (lprsrc-> left, lprsrc-> top, lprsrc-> right, lprsrc-> bottom, & DC,
0, 0, width (), height (), srccopy );
DC. SelectObject (poldbmp );
DC. deletedc ();
Poldbmp = NULL;
Return true;
}
This class is used to replace the dialog box. The test is okay.
We haven't found any third-party controls under CE. We have seen the best ccebutton, which was developed under evc3.0...