原理:創建四個窗口平鋪在需要添加陰影的窗口上;
vs實現原理:可以使用QQ截圖放在vs工具的四周可看出實現原理;
頭文件:
#include <QtWidgets/QMainWindow>
#define int32 int
using float64 = double;
typedef unsigned int quint32;
using uint32 = quint32;
using ShiftedMultiplier = uint32;
namespace Main_Window {
enum class ShadowsChange {
Moved = 0x01,
Resized = 0x02,
Shown = 0x04,
Hidden = 0x08,
Activate = 0x10,
};
Q_DECLARE_FLAGS(ShadowsChanges, ShadowsChange);
}
enum {
_PsInitHor = 0x01,
_PsInitVer = 0x02,
};
#define for_const(range_declaration, range_expression) for (range_declaration : std::as_const(range_expression))
#include <QPainter>
#include <Shobjidl.h>
#include <shellapi.h>
#include <WtsApi32.h>
#include <Windowsx.h>
#include <gdiplus.h>
class _PsShadowWindows {
public:
using Change = Main_Window::ShadowsChange;
using Changes = Main_Window::ShadowsChanges;
_PsShadowWindows();
~_PsShadowWindows();
void setColor(QColor c);
bool init(QColor c);
void initCorners(int directions = (_PsInitHor | _PsInitVer));
void verCorners(int h, Gdiplus::Graphics *pgraphics1, Gdiplus::Graphics *pgraphics3);
void horCorners(int w, Gdiplus::Graphics *pgraphics0, Gdiplus::Graphics *pgraphics2);
void update(Changes changes, WINDOWPOS *pos = 0);
void updateWindow(int i, POINT *p, SIZE *s = 0);
void destroy();
//void setApp(myDialog* d);
static void setApp(QWidget* d);
static void setResizeEnable(bool flag);
private:
int _x, _y, _w, _h;
int _metaSize, _fullsize, _size, _shift;
QVector<BYTE> _alphas, _colors;
bool hidden;
HWND hwnds[4];;
static QWidget* m_myApp;
static bool m_bRsizeEnable;
static bool m_bNCactivate;
HDC dcs[4], screenDC;
HBITMAP bitmaps[4];
int max_w, max_h;
BLENDFUNCTION blend;
BYTE r, g, b;
COLORREF noKeyColor;
static LRESULT __stdcall wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
};
extern _PsShadowWindows _psShadowWindows;
實現:
#include "shadow_win.h"
#include <QCoreApplication>
int32 _psSize = 0;
QWidget* _PsShadowWindows::m_myApp = NULL;
bool _PsShadowWindows::m_bRsizeEnable = true;
bool _PsShadowWindows::m_bNCactivate = true;
#pragma comment(lib,"gdiplus.lib")
_PsShadowWindows::_PsShadowWindows() : screenDC(0), max_w(0), max_h(0), _x(0), _y(0), _w(0), _h(0), hidden(true), r(0), g(0), b(0), noKeyColor(RGB(255, 255, 255)) {
for (int i = 0; i < 4; ++i) {
dcs[i] = 0;
bitmaps[i] = 0;
hwnds[i] = 0;
}
}
_PsShadowWindows::~_PsShadowWindows()
{
}
void _PsShadowWindows::setColor(QColor c) {
r = c.red();
g = c.green();
b = c.blue();
if (!hwnds[0]) return;
Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b));
for (int i = 0; i < 4; ++i) {
Gdiplus::Graphics graphics(dcs[i]);
graphics.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);
if ((i % 2) && _h || !(i % 2) && _w) {
graphics.FillRectangle(&brush, 0, 0, (i % 2) ? _size : _w, (i % 2) ? _h : _size);
}
}
initCorners();
_x = _y = _w = _h = 0;
update( (Change)(0x01 | 0x02));
}
bool _PsShadowWindows::init(QColor c) {
_fullsize = 19;
_shift = 1;
auto cornersImage = QImage(_fullsize, _fullsize, QImage::Format_ARGB32_Premultiplied);
QCoreApplication::applicationDirPath();
cornersImage.load(QCoreApplication::applicationDirPath() + "\\Resources\\shadow.png");
_metaSize = _fullsize + 2 * _shift;
_alphas.reserve(_metaSize);
_colors.reserve(_metaSize * _metaSize);
for (int32 j = 0; j < _metaSize; ++j) {
for (int32 i = 0; i < _metaSize; ++i) {
_colors.push_back((i < 2 * _shift || j < 2 * _shift) ? 1 : qMax(BYTE(1), BYTE(cornersImage.pixel(QPoint(i - 2 * _shift, j - 2 * _shift)) >> 24)));
}
}
uchar prev = 0;
for (int32 i = 0; i < _metaSize; ++i) {
uchar a = _colors[(_metaSize - 1) * _metaSize + i];
if (a < prev) break;
_alphas.push_back(a);
prev = a;
}
_psSize = _size = _alphas.size() - 2 * _shift;
setColor(c);
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
Gdiplus::Status gdiRes = Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
if (gdiRes != Gdiplus::Ok) {
return false;
}
blend.AlphaFormat = AC_SRC_ALPHA;
blend.SourceConstantAlpha = 255;
blend.BlendFlags = 0;
blend.BlendOp = AC_SRC_OVER;
screenDC = GetDC(0);
if (!screenDC) {
return false;
}
QRect avail(m_myApp->geometry());
max_w = avail.width();
max(max_w, 19);
max_h = avail.height();
//max(max_h, st::titleHeight + st::windowMinHeight);
HINSTANCE appinst = (HINSTANCE)GetModuleHandle(0);
HWND hwnd = (HWND)m_myApp->winId() ? (HWND)m_myApp->winId() : 0;
for (int i = 0; i < 4; ++i) {
QString cn = QString("TelegramShadow%1").arg(i);
LPCWSTR _cn = (LPCWSTR)cn.utf16();
WNDCLASSEX wc;
wc.cbSize = sizeof(wc);
wc.style = 0;
wc.lpfnWndProc = wndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = appinst;
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground = 0;
wc.lpszMenuName = NULL;
wc.lpszClassName = _cn;
wc.hIconSm = 0;
if (!RegisterClassEx(&wc)) {
destroy();
return false;
}
hwnds[i] = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW, _cn, 0, WS_POPUP, 0, 0, 0, 0, 0, 0, appinst, 0);
if (!hwnds[i]) {
destroy();
return false;
}
SetWindowLong(hwnds[i], GWL_HWNDPARENT, (LONG)hwnd);
dcs[i] = CreateCompatibleDC(screenDC);
if (!dcs[i]) {
destroy();
return false;
}
bitmaps[i] = CreateCompatibleBitmap(screenDC, (i % 2) ? _size : max_w, (i % 2) ? max_h : _size);
if (!bitmaps[i]) {
destroy();
return false;
}
SelectObject(dcs[i], bitmaps[i]);
}
QStringList alphasForLog;
for_const(auto alpha, _alphas) {
alphasForLog.append(QString::number(alpha));
}
initCorners();
return true;
}
void _PsShadowWindows::initCorners(int directions ) {
bool hor = (directions & _PsInitHor), ver = (directions & _PsInitVer);
Gdiplus::Graphics graphics0(dcs[0]), graphics1(dcs[1]), graphics2(dcs[2]), graphics3(dcs[3]);
graphics0.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);
graphics1.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);
graphics2.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);
graphics3.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);
Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b));
if (hor) graphics0.FillRectangle(&brush, 0, 0, _fullsize - (_size - _shift), 2 * _shift);
if (ver) {
graphics1.FillRectangle(&brush, 0, 0, _size, 2 * _shift);
graphics3.FillRectangle(&brush, 0, 0, _size, 2 * _shift);
graphics1.FillRectangle(&brush, _size - _shift, 2 * _shift, _shift, _fullsize);
graphics3.FillRectangle(&brush, 0, 2 * _shift, _shift, _fullsize);
}
if (hor) {
for (int j = 2 * _shift; j < _size; ++j) {
for (int k = 0; k < _fullsize - (_size - _shift); ++k) {
brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + k + (_size + _shift)], r, g, b));
graphics0.FillRectangle(&brush, k, j, 1, 1);
graphics2.FillRectangle(&brush, k, _size - (j - 2 * _shift) - 1, 1, 1);
}
}
for (int j = _size; j < _size + 2 * _shift; ++j) {
for (int k = 0; k < _fullsize - (_size - _shift); ++k) {
brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + k + (_size + _shift)], r, g, b));
graphics2.FillRectangle(&brush, k, _size - (j - 2 * _shift) - 1, 1, 1);
}
}
}
if (ver) {
for (int j = 2 * _shift; j < _fullsize + 2 * _shift; ++j) {
for (int k = _shift; k < _size; ++k) {
brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + (k + _shift)], r, g, b));
graphics1.FillRectangle(&brush, _size - k - 1, j, 1, 1);
graphics3.FillRectangle(&brush, k, j, 1, 1);
}
}
}
}
void _PsShadowWindows::verCorners(int h, Gdiplus::Graphics *pgraphics1, Gdiplus::Graphics *pgraphics3) {
Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b));
pgraphics1->FillRectangle(&brush, _size - _shift, h - _fullsize, _shift, _fullsize);
pgraphics3->FillRectangle(&brush, 0, h - _fullsize, _shift, _fullsize);
for (int j = 0; j < _fullsize; ++j) {
for (int k = _shift; k < _size; ++k) {
brush.SetColor(Gdiplus::Color(_colors[(j + 2 * _shift) * _metaSize + k + _shift], r, g, b));
pgraphics1->FillRectangle(&brush, _size - k - 1, h - j - 1, 1, 1);
pgraphics3->FillRectangle(&brush, k, h - j - 1, 1, 1);
}
}
}
void _PsShadowWindows::horCorners(int w, Gdiplus::Graphics *pgraphics0, Gdiplus::Graphics *pgraphics2) {
Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b));
pgraphics0->FillRectangle(&brush, w - 2 * _size - (_fullsize - (_size - _shift)), 0, _fullsize - (_size - _shift), 2 * _shift);
for (int j = 2 * _shift; j < _size; ++j) {
for (int k = 0; k < _fullsize - (_size - _shift); ++k) {
brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + k + (_size + _shift)], r, g, b));
pgraphics0->FillRectangle(&brush, w - 2 * _size - k - 1, j, 1, 1);
pgraphics2->FillRectangle(&brush, w - 2 * _size - k - 1, _size - (j - 2 * _shift) - 1, 1, 1);
}
}
for (int j = _size; j < _size + 2 * _shift; ++j) {
for (int k = 0; k < _fullsize - (_size - _shift); ++k) {
brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + k + (_size + _shift)], r, g, b));
pgraphics2->FillRectangle(&brush, w - 2 * _size - k - 1, _size - (j - 2 * _shift) - 1, 1, 1);
}
}
}
void _PsShadowWindows::update(Changes changes, WINDOWPOS *pos) {
HWND hwnd = (HWND)m_myApp->winId() ? (HWND)m_myApp->winId() : 0;
if (!hwnd || !hwnds[0]) return;
if (changes == Changes(Change::Activate)) {
for (int i = 0; i < 4; ++i) {
SetWindowPos(hwnds[i], hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
return;
}
if (changes & Change::Hidden) {
if (!hidden) {
for (int i = 0; i < 4; ++i) {
hidden = true;
ShowWindow(hwnds[i], SW_HIDE);
}
}
return;
}
if (!m_myApp->isVisible()) return;
int x = _x, y = _y, w = _w, h = _h;
/*if (pos && (!(pos->flags & SWP_NOMOVE) || !(pos->flags & SWP_NOSIZE) || !(pos->flags & SWP_NOREPOSITION))) {
if (!(pos->flags & SWP_NOMOVE)) {
x = pos->x - _size;
y = pos->y - _size;
}
else if (pos->flags & SWP_NOSIZE) {
for (int i = 0; i < 4; ++i) {
SetWindowPos(hwnds[i], hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
return;
}
if (!(pos->flags & SWP_NOSIZE)) {
w = pos->cx + 2 * _size;
h = pos->cy + 2 * _size;
}
}
else*/ {
RECT r;
GetWindowRect(hwnd, &r);
x = r.left - _size;
y = r.top - _size;
w = r.right + _size - x;
h = r.bottom + _size - y;
}
if (h < 2 * _fullsize + 2 * _shift) {
h = 2 * _fullsize + 2 * _shift;
}
if (w < 2 * (_fullsize + _shift)) {
w = 2 * (_fullsize + _shift);
}
if (w != _w) {
int from = (_w > 2 * (_fullsize + _shift)) ? (_w - _size - _fullsize - _shift) : (_fullsize - (_size - _shift));
int to = w - _size - _fullsize - _shift;
if (w > max_w) {
from = _fullsize - (_size - _shift);
max_w *= 2;
for (int i = 0; i < 4; i += 2) {
DeleteObject(bitmaps[i]);
bitmaps[i] = CreateCompatibleBitmap(screenDC, max_w, _size);
SelectObject(dcs[i], bitmaps[i]);
}
initCorners(_PsInitHor);
}
Gdiplus::Graphics graphics0(dcs[0]), graphics2(dcs[2]);
graphics0.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);
graphics2.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);
Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b));
if (to > from) {
graphics0.FillRectangle(&brush, from, 0, to - from, 2 * _shift);
for (int i = 2 * _shift; i < _size; ++i) {
Gdiplus::Pen pen(Gdiplus::Color(_alphas[i], r, g, b));
graphics0.DrawLine(&pen, from, i, to, i);
graphics2.DrawLine(&pen, from, _size - (i - 2 * _shift) - 1, to, _size - (i - 2 * _shift) - 1);
}
for (int i = _size; i < _size + 2 * _shift; ++i) {
Gdiplus::Pen pen(Gdiplus::Color(_alphas[i], r, g, b));
graphics2.DrawLine(&pen, from, _size - (i - 2 * _shift) - 1, to, _size - (i - 2 * _shift) - 1);
}
}
if (_w > w) {
graphics0.FillRectangle(&brush, w - _size - _fullsize - _shift, 0, _fullsize - (_size - _shift), _size);
graphics2.FillRectangle(&brush, w - _size - _fullsize - _shift, 0, _fullsize - (_size - _shift), _size);
}
horCorners(w, &graphics0, &graphics2);
POINT p0 = { x + _size, y }, p2 = { x + _size, y + h - _size }, f = { 0, 0 };
SIZE s = { w - 2 * _size, _size };
updateWindow(0, &p0, &s);
updateWindow(2, &p2, &s);
}
else if (x != _x || y != _y) {
POINT p0 = { x + _size, y }, p2 = { x + _size, y + h - _size };
updateWindow(0, &p0);
updateWindow(2, &p2);
}
else if (h != _h) {
POINT p2 = { x + _size, y + h - _size };
updateWindow(2, &p2);
}
if (h != _h) {
int from = (_h > 2 * _fullsize + 2 * _shift) ? (_h - _fullsize) : (_fullsize + 2 * _shift);
int to = h - _fullsize;
if (h > max_h) {
from = (_fullsize + 2 * _shift);
max_h *= 2;
for (int i = 1; i < 4; i += 2) {
DeleteObject(bitmaps[i]);
bitmaps[i] = CreateCompatibleBitmap(dcs[i], _size, max_h);
SelectObject(dcs[i], bitmaps[i]);
}
initCorners(_PsInitVer);
}
Gdiplus::Graphics graphics1(dcs[1]), graphics3(dcs[3]);
graphics1.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);
graphics3.SetCompositingMode(Gdiplus::CompositingModeSourceCopy);
Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b));
if (to > from) {
graphics1.FillRectangle(&brush, _size - _shift, from, _shift, to - from);
graphics3.FillRectangle(&brush, 0, from, _shift, to - from);
for (int i = 2 * _shift; i < _size + _shift; ++i) {
Gdiplus::Pen pen(Gdiplus::Color(_alphas[i], r, g, b));
graphics1.DrawLine(&pen, _size + _shift - i - 1, from, _size + _shift - i - 1, to);
graphics3.DrawLine(&pen, i - _shift, from, i - _shift, to);
}
}
if (_h > h) {
graphics1.FillRectangle(&brush, 0, h - _fullsize, _size, _fullsize);
graphics3.FillRectangle(&brush, 0, h - _fullsize, _size, _fullsize);
}
verCorners(h, &graphics1, &graphics3);
POINT p1 = { x + w - _size, y }, p3 = { x, y }, f = { 0, 0 };
SIZE s = { _size, h };
updateWindow(1, &p1, &s);
updateWindow(3, &p3, &s);
}
else if (x != _x || y != _y) {
POINT p1 = { x + w - _size, y }, p3 = { x, y };
updateWindow(1, &p1);
updateWindow(3, &p3);
}
else if (w != _w) {
POINT p1 = { x + w - _size, y };
updateWindow(1, &p1);
}
_x = x;
_y = y;
_w = w;
_h = h;
if (hidden && (changes & Change::Shown)) {
for (int i = 0; i < 4; ++i) {
SetWindowPos(hwnds[i], hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE);
}
hidden = false;
}
}
void _PsShadowWindows::updateWindow(int i, POINT *p, SIZE *s) {
static POINT f = { 0, 0 };
if (s) {
UpdateLayeredWindow(hwnds[i], (s ? screenDC : 0), p, s, (s ? dcs[i] : 0), (s ? (&f) : 0), noKeyColor, &blend, ULW_ALPHA);
}
else {
SetWindowPos(hwnds[i], 0, p->x, p->y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
}
}
void _PsShadowWindows::destroy() {
for (int i = 0; i < 4; ++i) {
if (dcs[i]) DeleteDC(dcs[i]);
if (bitmaps[i]) DeleteObject(bitmaps[i]);
if (hwnds[i]) DestroyWindow(hwnds[i]);
dcs[i] = 0;
bitmaps[i] = 0;
hwnds[i] = 0;
}
if (screenDC) ReleaseDC(0, screenDC);
}
void _PsShadowWindows::setApp(QWidget* d) {
m_myApp = d;
}
void _PsShadowWindows::setResizeEnable(bool flag)
{
m_bRsizeEnable = flag;
}
LRESULT __stdcall _PsShadowWindows::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
auto wnd = m_myApp;
if (!wnd) return DefWindowProc(hwnd, msg, wParam, lParam);
if (!m_bRsizeEnable) return DefWindowProc(hwnd, msg, wParam, lParam);
int i;
for (i = 0; i < 4; ++i) {
if (_psShadowWindows.hwnds[i] && hwnd == _psShadowWindows.hwnds[i]) {
break;
}
}
if (i == 4) return DefWindowProc(hwnd, msg, wParam, lParam);
POINT mouse_point;
GetCursorPos(&mouse_point);
RECT rec;
GetWindowRect(hwnd, &rec);
if(mouse_point.x<rec.left || mouse_point.x > rec.right ||
mouse_point.y<rec.top || mouse_point.y>rec.bottom)
return DefWindowProc(hwnd, msg, wParam, lParam);
switch (msg) {
case WM_CLOSE:
m_myApp->close();
break;
case WM_NCHITTEST: {
int32 xPos = GET_X_LPARAM(lParam), yPos = GET_Y_LPARAM(lParam);
switch (i) {
case 0: return HTTOP;
case 1: return (yPos < _psShadowWindows._y + _psSize) ? HTTOPRIGHT : ((yPos >= _psShadowWindows._y + _psShadowWindows._h - _psSize) ? HTBOTTOMRIGHT : HTRIGHT);
case 2: return HTBOTTOM;
case 3: return (yPos < _psShadowWindows._y + _psSize) ? HTTOPLEFT : ((yPos >= _psShadowWindows._y + _psShadowWindows._h - _psSize) ? HTBOTTOMLEFT : HTLEFT);
}
return HTTRANSPARENT;
} break;
case WM_NCACTIVATE:
DefWindowProc(hwnd, msg, wParam, lParam);
if (m_bNCactivate) return 0;
else {
m_bNCactivate = true; return 1;
}
case WM_NCLBUTTONDOWN:
m_bNCactivate = false;
case WM_NCLBUTTONUP:
case WM_NCLBUTTONDBLCLK:
case WM_NCMBUTTONDOWN:
case WM_NCMBUTTONUP:
case WM_NCMBUTTONDBLCLK:
case WM_NCRBUTTONDOWN:
case WM_NCRBUTTONUP:
case WM_NCRBUTTONDBLCLK:
case WM_NCXBUTTONDOWN:
case WM_NCXBUTTONUP:
case WM_NCXBUTTONDBLCLK:
case WM_NCMOUSEHOVER:
case WM_NCMOUSEMOVE:
case WM_NCMOUSELEAVE:
//case WM_NCPOINTERUPDATE:
//case WM_NCPOINTERDOWN:
//case WM_NCPOINTERUP:
if (wnd) {
if (msg == WM_NCLBUTTONDOWN) {
::SetForegroundWindow((HWND)wnd->winId());
}
LRESULT res = SendMessage((HWND)wnd->winId(), msg, wParam, lParam);
return res;
}
return 0;
break;
case WM_ACTIVATE:
if ((HWND)m_myApp && wParam == WA_ACTIVE) {
::SetForegroundWindow(hwnd);
::SetWindowPos((HWND)m_myApp->winId(), hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
return DefWindowProc(hwnd, msg, wParam, lParam);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
調用:
//引入
#ifdef WIN32
#include "shadow_win.h"
_PsShadowWindows _psShadowWindows;
#endif
//構造
#ifdef WIN32
_psShadowWindows.setApp(this);
_psShadowWindows.init(QColor(0, 0, 0));
_psShadowWindows.update(Main_Window::ShadowsChange::Hidden);
_psShadowWindows.setResizeEnable(true);
#endif
//重載
bool CMainWindow::nativeEvent(const QByteArray & eventType, void * message, long * result)
{
MSG *msg = static_cast<MSG *>(message);
switch (msg->message)
{
case WM_PAINT:
_psShadowWindows.update(Main_Window::ShadowsChange::Shown);
break;
case WM_SIZE:
_psShadowWindows.update(Main_Window::ShadowsChange::Resized);
break;
case WM_MOVE:
_psShadowWindows.update(Main_Window::ShadowsChange::Moved);
break;
case WM_SHOWWINDOW:
if(!*result)
_psShadowWindows.update(Main_Window::ShadowsChange::Hidden);
break;
}
return QWidget::nativeEvent(eventType, message, result);
}
示例中用到的圖片資源:
陰影效果: