1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
Function
void Pantalla()
{
TSay oSay = TSay();
oPan4 = oSay.Crear(hInstance, 10*TamPan, 30*TamPan, wtex000, oDlgwVen, oFont, escri1, fondo2,1020*TamPan, 77*TamPan, 0, 0, "oPan4");
oPan401 = oSay.Crear(hInstance, 25*TamPan,340*TamPan, wtex001, oPan4 , oFon3, escri3, fondo1, 630*TamPan, 30*TamPan, 1, 1, "oPan401");
oMenPan = oSay.Crear(hInstance, 95*TamPan, 30*TamPan, wtex000, oDlgwVen, oFont, escri3, fondo1, 245*TamPan,555*TamPan, 0, 0, "oMenPan");
oMenPan01 = oSay.Crear(hInstance, 22*TamPan, 30*TamPan, wtex002, oMenPan , oFont, escri1, fondo1, 200*TamPan, 28*TamPan, 0, 0, "oMenPan01");
oMenPan02 = oSay.Crear(hInstance, 52*TamPan, 30*TamPan, wtex003, oMenPan , oFont, escri1, fondo1, 200*TamPan, 28*TamPan, 0, 0, "oMenPan02");
oMenPan03 = oSay.Crear(hInstance, 82*TamPan, 30*TamPan, wtex004, oMenPan , oFont, escri1, fondo1, 200*TamPan, 28*TamPan, 0, 0, "oMenPan03");
oMenPan04 = oSay.Crear(hInstance, 112*TamPan, 30*TamPan, wtex008, oMenPan , oFont, escri1, fondo1, 200*TamPan, 28*TamPan, 0, 0, "oMenPan04");
oMenPan05 = oSay.Crear(hInstance, 142*TamPan, 30*TamPan, wtex009, oMenPan , oFont, escri1, fondo1, 200*TamPan, 28*TamPan, 0, 0, "oMenPan05");
oMenPan06 = oSay.Crear(hInstance, 172*TamPan, 30*TamPan, wtex010, oMenPan , oFont, escri1, fondo1, 200*TamPan, 28*TamPan, 0, 0, "oMenPan06");
oMenPan07 = oSay.Crear(hInstance, 202*TamPan, 30*TamPan, wtex011, oMenPan , oFont, escri1, fondo1, 200*TamPan, 28*TamPan, 0, 0, "oMenPan07");
oMenPan08 = oSay.Crear(hInstance, 232*TamPan, 30*TamPan, wtex012, oMenPan , oFont, escri1, fondo1, 200*TamPan, 28*TamPan, 0, 0, "oMenPan08");
oMenPan09 = oSay.Crear(hInstance, 262*TamPan, 30*TamPan, wtex013, oMenPan , oFont, escri1, fondo1, 200*TamPan, 28*TamPan, 0, 0, "oMenPan09");
oPant = oSay.Crear(hInstance, 95*TamPan,300*TamPan, wtex001, oDlgwVen, oFont, escri1, fondo2, 750*TamPan,555*TamPan, 1, 0, "oPant");
oPan2 = oSay.Crear(hInstance, 117*TamPan, 30*TamPan, wtex001, oDlgwVen, oFont, escri1, fondo2, 280*TamPan, 25*TamPan, 0, 0, "oPan2");
RedrawWindow(oDlgwVen,NULL,NULL,RDW_INVALIDATE | RDW_INTERNALPAINT);
UpdateWindow(oVentPrinc);
}
Class
#if !defined(TSAY)
#define TSAY
#include <windows.h>
WNDCLASS wc;
HWND vHij;
const char* pint;
HFONT letr;
COLORREF escr;
double x_tamX;
double x_tamY;
int alin;
class TSay
{
protected:
static LRESULT CALLBACK WinProc(HWND vHij, UINT msg, WPARAM wParam, LPARAM lParam)
{
HDC dc;
PAINTSTRUCT ps;
RECT rc;
int text;
HGDIOBJ old;
switch(msg)
{
case WM_PAINT:
dc = GetDC(vHij);
dc = BeginPaint (vHij, &ps);
SetRect (&rc, 2, 3, x_tamX-4, x_tamY-6);
SetBkMode (dc, escr);
SetTextColor (dc, escr);
old = SelectObject(dc, letr);
switch (alin)
{
case 0:
text = DrawTextA(dc, pint, -1, &rc, WS_BORDER | DT_LEFT | DT_VCENTER);
break;
case 1:
text = DrawTextA(dc, pint, -1, &rc, WS_BORDER | DT_CENTER | DT_VCENTER);
break;
case 2:
text = DrawTextA(dc, pint, -1, &rc, WS_BORDER | DT_RIGHT | DT_VCENTER);
break;
}
SelectObject(dc, old);
ReleaseDC(vHij, dc);
DeleteObject(old);
EndPaint (vHij, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(vHij, msg, wParam, lParam);
}
return 0;
}
public:
TSay()
{
}
~TSay()
{
}
HWND Crear(HINSTANCE hIns,double posX, double posY, const char *pint, HWND vent, HFONT letr, COLORREF escr, COLORREF fond, double tamX, double tamY, int bord, int alin, const char *cVen)
{
WNDCLASSEX WndClass;
WndClass.cbSize = sizeof(WNDCLASSEX);
WndClass.style = 0;
WndClass.lpfnWndProc = WinProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = hIns;
WndClass.hIcon = NULL;
WndClass.hIconSm = NULL;
WndClass.hCursor = LoadCursor(0, IDC_ARROW);
WndClass.hbrBackground = (HBRUSH)CreateSolidBrush(fond);
WndClass.lpszMenuName = 0;
WndClass.lpszClassName = cVen;
RegisterClassEx(&WndClass);
DWORD hPen;
if (bord == 1)
hPen = WS_BORDER | WS_CHILD| WS_VISIBLE;
else
hPen = WS_CHILD| WS_VISIBLE;
int x_posX = (int)posX;
int x_posY = (int)posY;
int x_tamX = (int)tamX;
int x_tamY = (int)tamY;
vHij = CreateWindow(
cVen,
"TSay",
hPen,
x_posY,
x_posX,
x_tamX,
x_tamY,
vent,
NULL,
hIns,
NULL);
return vHij;
}
};
#endif // TSAY
|