1 | #include "stdafx.h"
|
---|
2 |
|
---|
3 | #include "Common.h"
|
---|
4 |
|
---|
5 | void DrawLineInClient(int WndNum,long StartX,long StartY,long EndX,long EndY){
|
---|
6 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
7 | MoveToEx(MdiInfo[WndNum].MdiRadInfo->hMemDC,
|
---|
8 | StartX+MdiInfo[WndNum].MdiRadInfo->ClientPos.x,
|
---|
9 | StartY+MdiInfo[WndNum].MdiRadInfo->ClientPos.y,
|
---|
10 | NULL);
|
---|
11 | LineTo(MdiInfo[WndNum].MdiRadInfo->hMemDC,
|
---|
12 | EndX+MdiInfo[WndNum].MdiRadInfo->ClientPos.x,
|
---|
13 | EndY+MdiInfo[WndNum].MdiRadInfo->ClientPos.y);
|
---|
14 | }
|
---|
15 | void DrawRectangleInClient(int WndNum,long left,long top,long right,long bottom,COLORREF RGB_Pen,COLORREF RGB_Brush,BOOL bBrushing){
|
---|
16 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
17 | HPEN hPen,hOldPen;
|
---|
18 | HBRUSH hBrush,hOldBrush;
|
---|
19 |
|
---|
20 | hPen=CreatePen(PS_SOLID,0,RGB_Pen);
|
---|
21 | if(bBrushing) hBrush=CreateSolidBrush(RGB_Brush);
|
---|
22 | else hBrush=(HBRUSH)GetStockObject(NULL_BRUSH);
|
---|
23 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
24 | hOldBrush=(HBRUSH)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hBrush);
|
---|
25 |
|
---|
26 | Rectangle(MdiInfo[WndNum].MdiRadInfo->hMemDC,
|
---|
27 | left+MdiInfo[WndNum].MdiRadInfo->ClientPos.x,
|
---|
28 | top+MdiInfo[WndNum].MdiRadInfo->ClientPos.y,
|
---|
29 | right+MdiInfo[WndNum].MdiRadInfo->ClientPos.x,
|
---|
30 | bottom+MdiInfo[WndNum].MdiRadInfo->ClientPos.y);
|
---|
31 |
|
---|
32 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
33 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldBrush);
|
---|
34 | DeleteObject(hPen);
|
---|
35 | if(bBrushing) DeleteObject(hBrush);
|
---|
36 | }
|
---|
37 | void DrawButtonEdge(int WndNum,POINT *pPos,SIZE *pSize){
|
---|
38 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
39 | HPEN hPen,hOldPen;
|
---|
40 |
|
---|
41 | //光源方向の縁
|
---|
42 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
43 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
44 | DrawLineInClient(WndNum,
|
---|
45 | pPos->x, pPos->y,
|
---|
46 | pPos->x+pSize->cx-1, pPos->y);
|
---|
47 | DrawLineInClient(WndNum,
|
---|
48 | pPos->x, pPos->y,
|
---|
49 | pPos->x, pPos->y+pSize->cy-1);
|
---|
50 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
51 | DeleteObject(hPen);
|
---|
52 |
|
---|
53 | //影側の縁
|
---|
54 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DDKSHADOW));
|
---|
55 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
56 | DrawLineInClient(WndNum,
|
---|
57 | pPos->x, pPos->y+pSize->cy-1,
|
---|
58 | pPos->x+pSize->cx, pPos->y+pSize->cy-1);
|
---|
59 | DrawLineInClient(WndNum,
|
---|
60 | pPos->x+pSize->cx-1, pPos->y,
|
---|
61 | pPos->x+pSize->cx-1, pPos->y+pSize->cy-1);
|
---|
62 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
63 | DeleteObject(hPen);
|
---|
64 |
|
---|
65 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DSHADOW));
|
---|
66 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
67 | DrawLineInClient(WndNum,
|
---|
68 | pPos->x+1, pPos->y+pSize->cy-2,
|
---|
69 | pPos->x+pSize->cx-1, pPos->y+pSize->cy-2);
|
---|
70 | DrawLineInClient(WndNum,
|
---|
71 | pPos->x+pSize->cx-2, pPos->y+1,
|
---|
72 | pPos->x+pSize->cx-2, pPos->y+pSize->cy-2);
|
---|
73 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
74 | DeleteObject(hPen);
|
---|
75 |
|
---|
76 | //内部
|
---|
77 | DrawRectangleInClient(WndNum,
|
---|
78 | pPos->x+1,pPos->y+1,
|
---|
79 | pPos->x+pSize->cx-2,pPos->y+pSize->cy-2,
|
---|
80 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
81 |
|
---|
82 | pPos->x+=3;
|
---|
83 | pPos->y+=2;
|
---|
84 | pSize->cx-=5;
|
---|
85 | pSize->cy-=4;
|
---|
86 | }
|
---|
87 | void DrawItemEdgeByExStyle(int WndNum,int ExStyle,POINT *pPos,SIZE *pSize){
|
---|
88 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
89 | HPEN hPen,hOldPen;
|
---|
90 | RECT rect;
|
---|
91 |
|
---|
92 | if(ExStyle&WS_EX_DLGMODALFRAME){
|
---|
93 | ///////////////////////////
|
---|
94 | //モーダル フレーム境界線
|
---|
95 |
|
---|
96 | rect.left=pPos->x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
97 | rect.top=pPos->y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
98 | rect.right=pPos->x+pSize->cx+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
99 | rect.bottom=pPos->y+pSize->cy+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
100 | DrawEdge(MdiInfo[WndNum].MdiRadInfo->hMemDC,&rect,EDGE_RAISED,BF_RECT);
|
---|
101 | pPos->x+=2;
|
---|
102 | pPos->y+=2;
|
---|
103 | pSize->cx-=4;
|
---|
104 | pSize->cy-=4;
|
---|
105 |
|
---|
106 | //細枠
|
---|
107 | DrawRectangleInClient(WndNum,
|
---|
108 | pPos->x,pPos->y,
|
---|
109 | pPos->x+pSize->cx,pPos->y+pSize->cy,
|
---|
110 | GetSysColor(COLOR_ACTIVEBORDER),0,0);
|
---|
111 |
|
---|
112 | pPos->x+=1;
|
---|
113 | pPos->y+=1;
|
---|
114 | pSize->cx-=2;
|
---|
115 | pSize->cy-=2;
|
---|
116 | }
|
---|
117 | else if(ExStyle&WS_EX_STATICEDGE){
|
---|
118 | //////////////////////
|
---|
119 | //スタティック境界線
|
---|
120 |
|
---|
121 | //影側の色
|
---|
122 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DSHADOW));
|
---|
123 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
124 | DrawLineInClient(WndNum,
|
---|
125 | pPos->x,
|
---|
126 | pPos->y,
|
---|
127 | pPos->x,
|
---|
128 | pPos->y+pSize->cy-1);
|
---|
129 | DrawLineInClient(WndNum,
|
---|
130 | pPos->x,
|
---|
131 | pPos->y,
|
---|
132 | pPos->x+pSize->cx-1,
|
---|
133 | pPos->y);
|
---|
134 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
135 | DeleteObject(hPen);
|
---|
136 |
|
---|
137 | //光源方向の縁
|
---|
138 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
139 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
140 | DrawLineInClient(WndNum,
|
---|
141 | pPos->x,
|
---|
142 | pPos->y+pSize->cy-1,
|
---|
143 | pPos->x+pSize->cx-1,
|
---|
144 | pPos->y+pSize->cy-1);
|
---|
145 | DrawLineInClient(WndNum,
|
---|
146 | pPos->x+pSize->cx-1,
|
---|
147 | pPos->y,
|
---|
148 | pPos->x+pSize->cx-1,
|
---|
149 | pPos->y+pSize->cy);
|
---|
150 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
151 | DeleteObject(hPen);
|
---|
152 |
|
---|
153 | pPos->x+=1;
|
---|
154 | pPos->y+=1;
|
---|
155 | pSize->cx-=2;
|
---|
156 | pSize->cy-=2;
|
---|
157 | }
|
---|
158 | if(ExStyle&WS_EX_CLIENTEDGE){
|
---|
159 | //////////////////////
|
---|
160 | //クライアント境界線
|
---|
161 |
|
---|
162 | rect.left=pPos->x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
163 | rect.top=pPos->y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
164 | rect.right=pPos->x+pSize->cx+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
165 | rect.bottom=pPos->y+pSize->cy+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
166 | DrawEdge(MdiInfo[WndNum].MdiRadInfo->hMemDC,&rect,EDGE_SUNKEN,BF_RECT);
|
---|
167 | pPos->x+=2;
|
---|
168 | pPos->y+=2;
|
---|
169 | pSize->cx-=4;
|
---|
170 | pSize->cy-=4;
|
---|
171 | }
|
---|
172 | }
|
---|
173 | void DrawScrollBar(int WndNum,DWORD style,BOOL bSwitch,POINT *pPos,SIZE *pSize){
|
---|
174 | extern PROJECTINFO ProjectInfo;
|
---|
175 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
176 | int i,i2;
|
---|
177 | HPEN hPen,hOldPen;
|
---|
178 | COLORREF rgb;
|
---|
179 | POINT pos;
|
---|
180 | SIZE size;
|
---|
181 |
|
---|
182 | if(bSwitch==0){
|
---|
183 | //水平スクロールバー
|
---|
184 |
|
---|
185 | //左ボタン
|
---|
186 | if(pSize->cx>16*2){
|
---|
187 | pos=*pPos;
|
---|
188 | size.cx=16;
|
---|
189 | size.cy=pSize->cy;
|
---|
190 | }
|
---|
191 | else{
|
---|
192 | pos=*pPos;
|
---|
193 | size.cx=pSize->cx/2;
|
---|
194 | size.cy=pSize->cy;
|
---|
195 | }
|
---|
196 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
197 |
|
---|
198 | //内部
|
---|
199 | DrawRectangleInClient(WndNum,
|
---|
200 | pos.x,pos.y,
|
---|
201 | pos.x+size.cx,pos.y+size.cy,
|
---|
202 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
203 |
|
---|
204 | if(style&WS_DISABLED){
|
---|
205 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
206 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
207 | pos.x++;
|
---|
208 | pos.y++;
|
---|
209 | i2=pos.y+(size.cy/2);
|
---|
210 | for(i=0;i<4;i++,i2--){
|
---|
211 | DrawLineInClient(WndNum,i+pos.x+2,i2,i+pos.x+2,i2+(i*2)+1);
|
---|
212 | }
|
---|
213 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
214 | DeleteObject(hPen);
|
---|
215 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
216 | pos.x--;
|
---|
217 | pos.y--;
|
---|
218 | }
|
---|
219 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
220 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
221 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
222 | i2=pos.y+(size.cy/2);
|
---|
223 | for(i=0;i<4;i++,i2--){
|
---|
224 | DrawLineInClient(WndNum,i+pos.x+2,i2,i+pos.x+2,i2+(i*2)+1);
|
---|
225 | }
|
---|
226 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
227 | DeleteObject(hPen);
|
---|
228 |
|
---|
229 | //右ボタン
|
---|
230 | if(pSize->cx>16*2){
|
---|
231 | pos.x=pPos->x+pSize->cx-16;
|
---|
232 | pos.y=pPos->y;
|
---|
233 | size.cx=16;
|
---|
234 | size.cy=pSize->cy;
|
---|
235 | }
|
---|
236 | else{
|
---|
237 | pos.x=pPos->x+pSize->cx/2+pSize->cx%2;
|
---|
238 | pos.y=pPos->y;
|
---|
239 | size.cx=pSize->cx/2;
|
---|
240 | size.cy=pSize->cy;
|
---|
241 | }
|
---|
242 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
243 |
|
---|
244 | //内部
|
---|
245 | DrawRectangleInClient(WndNum,
|
---|
246 | pos.x,pos.y,
|
---|
247 | pos.x+size.cx,pos.y+size.cy,
|
---|
248 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
249 |
|
---|
250 | if(style&WS_DISABLED){
|
---|
251 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
252 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
253 | pos.x++;
|
---|
254 | pos.y++;
|
---|
255 | i2=pos.y+(size.cy/2);
|
---|
256 | for(i=3;i>=0;i--,i2--){
|
---|
257 | DrawLineInClient(WndNum,i+pos.x+3,i2,i+pos.x+3,i2+((3-i)*2)+1);
|
---|
258 | }
|
---|
259 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
260 | DeleteObject(hPen);
|
---|
261 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
262 | pos.x--;
|
---|
263 | pos.y--;
|
---|
264 | }
|
---|
265 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
266 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
267 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
268 | i2=pos.y+(size.cy/2);
|
---|
269 | for(i=3;i>=0;i--,i2--){
|
---|
270 | DrawLineInClient(WndNum,i+pos.x+3,i2,i+pos.x+3,i2+((3-i)*2)+1);
|
---|
271 | }
|
---|
272 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
273 | DeleteObject(hPen);
|
---|
274 |
|
---|
275 | if(pSize->cx>16*3){
|
---|
276 | if(!(style&WS_DISABLED)){
|
---|
277 | pos.x=pPos->x+16;
|
---|
278 | pos.y=pPos->y;
|
---|
279 | size.cx=16;
|
---|
280 | size.cy=pSize->cy;
|
---|
281 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
282 |
|
---|
283 | //内部
|
---|
284 | DrawRectangleInClient(WndNum,
|
---|
285 | pos.x,pos.y,
|
---|
286 | pos.x+size.cx,pos.y+size.cy,
|
---|
287 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
288 |
|
---|
289 | pos.x=pPos->x+16*2;
|
---|
290 | pos.y=pPos->y;
|
---|
291 | size.cx=pSize->cx-16*3;
|
---|
292 | size.cy=pSize->cy;
|
---|
293 | }
|
---|
294 | else{
|
---|
295 | pos.x=pPos->x+16;
|
---|
296 | pos.y=pPos->y;
|
---|
297 | size.cx=pSize->cx-16*2;
|
---|
298 | size.cy=pSize->cy;
|
---|
299 | }
|
---|
300 | }
|
---|
301 | else if(pSize->cx>16*2){
|
---|
302 | pos.x=pPos->x+16;
|
---|
303 | pos.y=pPos->y;
|
---|
304 | size.cx=pSize->cx-16*2;
|
---|
305 | size.cy=pSize->cy;
|
---|
306 | }
|
---|
307 | else{
|
---|
308 | pos.x=pPos->x+pSize->cx/2;
|
---|
309 | pos.y=pPos->y;
|
---|
310 | size.cx=pSize->cx%2;
|
---|
311 | size.cy=pSize->cy;
|
---|
312 | }
|
---|
313 | }
|
---|
314 | else{
|
---|
315 | //垂直スクロールバー
|
---|
316 |
|
---|
317 | //上ボタン
|
---|
318 | if(pSize->cy>16*2){
|
---|
319 | pos=*pPos;
|
---|
320 | size.cy=16;
|
---|
321 | size.cx=pSize->cx;
|
---|
322 | }
|
---|
323 | else{
|
---|
324 | pos=*pPos;
|
---|
325 | size.cy=pSize->cy/2;
|
---|
326 | size.cx=pSize->cx;
|
---|
327 | }
|
---|
328 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
329 |
|
---|
330 | //内部
|
---|
331 | DrawRectangleInClient(WndNum,
|
---|
332 | pos.x,pos.y,
|
---|
333 | pos.x+size.cx,pos.y+size.cy,
|
---|
334 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
335 |
|
---|
336 | pos.y++;
|
---|
337 | if(style&WS_DISABLED){
|
---|
338 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
339 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
340 | pos.x++;
|
---|
341 | pos.y++;
|
---|
342 | i2=pos.x+(size.cx/2)-1;
|
---|
343 | for(i=0;i<4;i++,i2--){
|
---|
344 | DrawLineInClient(WndNum,i2,i+pos.y+2,i2+(i*2)+1,i+pos.y+2);
|
---|
345 | }
|
---|
346 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
347 | DeleteObject(hPen);
|
---|
348 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
349 | pos.x--;
|
---|
350 | pos.y--;
|
---|
351 | }
|
---|
352 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
353 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
354 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
355 | i2=pos.x+(size.cx/2)-1;
|
---|
356 | for(i=0;i<4;i++,i2--){
|
---|
357 | DrawLineInClient(WndNum,i2,i+pos.y+2,i2+(i*2)+1,i+pos.y+2);
|
---|
358 | }
|
---|
359 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
360 | DeleteObject(hPen);
|
---|
361 |
|
---|
362 | //下ボタン
|
---|
363 | if(pSize->cy>16*2){
|
---|
364 | pos.x=pPos->x;
|
---|
365 | pos.y=pPos->y+pSize->cy-16;
|
---|
366 | size.cx=pSize->cx;
|
---|
367 | size.cy=16;
|
---|
368 | }
|
---|
369 | else{
|
---|
370 | pos.x=pPos->x;
|
---|
371 | pos.y=pPos->y+pSize->cy/2+pSize->cy%2;
|
---|
372 | size.cx=pSize->cx;
|
---|
373 | size.cy=pSize->cy/2;
|
---|
374 | }
|
---|
375 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
376 |
|
---|
377 | //内部
|
---|
378 | DrawRectangleInClient(WndNum,
|
---|
379 | pos.x,pos.y,
|
---|
380 | pos.x+size.cx,pos.y+size.cy,
|
---|
381 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
382 |
|
---|
383 | pos.x--;
|
---|
384 | if(style&WS_DISABLED){
|
---|
385 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
386 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
387 | pos.x++;
|
---|
388 | pos.y++;
|
---|
389 | i2=pos.x+(size.cx/2);
|
---|
390 | for(i=3;i>=0;i--,i2--){
|
---|
391 | DrawLineInClient(WndNum,i2,i+pos.y+3,i2+((3-i)*2)+1,i+pos.y+3);
|
---|
392 | }
|
---|
393 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
394 | DeleteObject(hPen);
|
---|
395 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
396 | pos.x--;
|
---|
397 | pos.y--;
|
---|
398 | }
|
---|
399 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
400 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
401 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
402 | i2=pos.x+(size.cx/2);
|
---|
403 | for(i=3;i>=0;i--,i2--){
|
---|
404 | DrawLineInClient(WndNum,i2,i+pos.y+3,i2+((3-i)*2)+1,i+pos.y+3);
|
---|
405 | }
|
---|
406 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
407 | DeleteObject(hPen);
|
---|
408 |
|
---|
409 | if(pSize->cy>16*3){
|
---|
410 | if(!(style&WS_DISABLED)){
|
---|
411 | pos.x=pPos->x;
|
---|
412 | pos.y=pPos->y+16;
|
---|
413 | size.cx=pSize->cx;
|
---|
414 | size.cy=16;
|
---|
415 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
416 |
|
---|
417 | //内部
|
---|
418 | DrawRectangleInClient(WndNum,
|
---|
419 | pos.x,pos.y,
|
---|
420 | pos.x+size.cx,pos.y+size.cy,
|
---|
421 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
422 |
|
---|
423 | pos.x=pPos->x;
|
---|
424 | pos.y=pPos->y+16*2;
|
---|
425 | size.cx=pSize->cx;
|
---|
426 | size.cy=pSize->cy-16*3;
|
---|
427 | }
|
---|
428 | else{
|
---|
429 | pos.x=pPos->x;
|
---|
430 | pos.y=pPos->y+16;
|
---|
431 | size.cx=pSize->cx;
|
---|
432 | size.cy=pSize->cy-16*2;
|
---|
433 | }
|
---|
434 | }
|
---|
435 | else if(pSize->cy>16*2){
|
---|
436 | pos.x=pPos->x;
|
---|
437 | pos.y=pPos->y+16;
|
---|
438 | size.cx=pSize->cx;
|
---|
439 | size.cy=pSize->cy-16*2;
|
---|
440 | }
|
---|
441 | else{
|
---|
442 | pos.x=pPos->x;
|
---|
443 | pos.y=pPos->y+pSize->cy/2;
|
---|
444 | size.cx=pSize->cx;
|
---|
445 | size.cy=pSize->cy%2;
|
---|
446 | }
|
---|
447 | }
|
---|
448 |
|
---|
449 | if(size.cx){
|
---|
450 | int x,y;
|
---|
451 | HBITMAP hBitmap;
|
---|
452 | BITMAPINFO BitmapInfo;
|
---|
453 | BYTE *pByte;
|
---|
454 |
|
---|
455 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
|
---|
456 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
|
---|
457 | BitmapInfo.bmiHeader.biWidth=size.cx;
|
---|
458 | BitmapInfo.bmiHeader.biHeight=size.cy;
|
---|
459 | BitmapInfo.bmiHeader.biPlanes=1;
|
---|
460 | BitmapInfo.bmiHeader.biBitCount=24;
|
---|
461 |
|
---|
462 | hBitmap=CreateDIBSection(MdiInfo[WndNum].MdiRadInfo->hMemDC,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0);
|
---|
463 | i=BitmapInfo.bmiHeader.biWidth*3;
|
---|
464 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG));
|
---|
465 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){
|
---|
466 | if(y%2==0) rgb=GetSysColor(COLOR_3DFACE);
|
---|
467 | else rgb=RGB(255,255,255);
|
---|
468 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){
|
---|
469 | i2=y*i+x*3;
|
---|
470 | pByte[i2+2]=LOBYTE(LOWORD(rgb));
|
---|
471 | pByte[i2+1]=HIBYTE(LOWORD(rgb));
|
---|
472 | pByte[i2]=LOBYTE(HIWORD(rgb));
|
---|
473 | if(rgb==RGB(255,255,255)) rgb=GetSysColor(COLOR_3DFACE);
|
---|
474 | else rgb=RGB(255,255,255);
|
---|
475 | }
|
---|
476 | }
|
---|
477 | SetDIBitsToDevice(MdiInfo[WndNum].MdiRadInfo->hMemDC,
|
---|
478 | pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x,
|
---|
479 | pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y,
|
---|
480 | BitmapInfo.bmiHeader.biWidth, BitmapInfo.bmiHeader.biHeight,
|
---|
481 | 0,0,
|
---|
482 | 0,BitmapInfo.bmiHeader.biHeight,
|
---|
483 | pByte,
|
---|
484 | &BitmapInfo,
|
---|
485 | DIB_RGB_COLORS);
|
---|
486 | DeleteObject(hBitmap);
|
---|
487 | }
|
---|
488 | }
|
---|
489 | void DrawUpDownControl(int WndNum,DWORD style,BOOL bSwitch,POINT *pPos,SIZE *pSize){
|
---|
490 | extern PROJECTINFO ProjectInfo;
|
---|
491 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
492 | int i,i2;
|
---|
493 | HPEN hPen,hOldPen;
|
---|
494 | COLORREF rgb;
|
---|
495 | POINT pos;
|
---|
496 | SIZE size;
|
---|
497 |
|
---|
498 | if(bSwitch==0){
|
---|
499 | //水平
|
---|
500 |
|
---|
501 | //左ボタン
|
---|
502 | pos=*pPos;
|
---|
503 | size.cx=pSize->cx/2;
|
---|
504 | size.cy=pSize->cy;
|
---|
505 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
506 |
|
---|
507 | //内部
|
---|
508 | DrawRectangleInClient(WndNum,
|
---|
509 | pos.x,pos.y,
|
---|
510 | pos.x+size.cx,pos.y+size.cy,
|
---|
511 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
512 |
|
---|
513 | if(style&WS_DISABLED){
|
---|
514 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
515 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
516 | pos.x++;
|
---|
517 | pos.y++;
|
---|
518 | i2=pos.y+(size.cy/2);
|
---|
519 | for(i=0;i<4;i++,i2--){
|
---|
520 | DrawLineInClient(WndNum,i+pos.x+2,i2,i+pos.x+2,i2+(i*2)+1);
|
---|
521 | }
|
---|
522 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
523 | DeleteObject(hPen);
|
---|
524 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
525 | pos.x--;
|
---|
526 | pos.y--;
|
---|
527 | }
|
---|
528 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
529 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
530 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
531 | i2=pos.y+(size.cy/2);
|
---|
532 | for(i=0;i<4;i++,i2--){
|
---|
533 | DrawLineInClient(WndNum,i+pos.x+2,i2,i+pos.x+2,i2+(i*2)+1);
|
---|
534 | }
|
---|
535 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
536 | DeleteObject(hPen);
|
---|
537 |
|
---|
538 | //右ボタン
|
---|
539 | pos.x=pPos->x+pSize->cx/2+pSize->cx%2;
|
---|
540 | pos.y=pPos->y;
|
---|
541 | size.cx=pSize->cx/2;
|
---|
542 | size.cy=pSize->cy;
|
---|
543 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
544 |
|
---|
545 | //内部
|
---|
546 | DrawRectangleInClient(WndNum,
|
---|
547 | pos.x,pos.y,
|
---|
548 | pos.x+size.cx,pos.y+size.cy,
|
---|
549 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
550 |
|
---|
551 | if(style&WS_DISABLED){
|
---|
552 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
553 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
554 | pos.x++;
|
---|
555 | pos.y++;
|
---|
556 | i2=pos.y+(size.cy/2);
|
---|
557 | for(i=3;i>=0;i--,i2--){
|
---|
558 | DrawLineInClient(WndNum,i+pos.x+3,i2,i+pos.x+3,i2+((3-i)*2)+1);
|
---|
559 | }
|
---|
560 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
561 | DeleteObject(hPen);
|
---|
562 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
563 | pos.x--;
|
---|
564 | pos.y--;
|
---|
565 | }
|
---|
566 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
567 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
568 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
569 | i2=pos.y+(size.cy/2);
|
---|
570 | for(i=3;i>=0;i--,i2--){
|
---|
571 | DrawLineInClient(WndNum,i+pos.x+3,i2,i+pos.x+3,i2+((3-i)*2)+1);
|
---|
572 | }
|
---|
573 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
574 | DeleteObject(hPen);
|
---|
575 | }
|
---|
576 | else{
|
---|
577 | //垂直
|
---|
578 |
|
---|
579 | //上ボタン
|
---|
580 | pos=*pPos;
|
---|
581 | size.cy=pSize->cy/2;
|
---|
582 | size.cx=pSize->cx;
|
---|
583 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
584 |
|
---|
585 | //内部
|
---|
586 | DrawRectangleInClient(WndNum,
|
---|
587 | pos.x,pos.y,
|
---|
588 | pos.x+size.cx,pos.y+size.cy,
|
---|
589 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
590 |
|
---|
591 | pos.y++;
|
---|
592 | if(style&WS_DISABLED){
|
---|
593 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
594 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
595 | pos.x++;
|
---|
596 | pos.y++;
|
---|
597 | i2=pos.x+(size.cx/2)-1;
|
---|
598 | for(i=0;i<4;i++,i2--){
|
---|
599 | DrawLineInClient(WndNum,i2,i+pos.y+2,i2+(i*2)+1,i+pos.y+2);
|
---|
600 | }
|
---|
601 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
602 | DeleteObject(hPen);
|
---|
603 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
604 | pos.x--;
|
---|
605 | pos.y--;
|
---|
606 | }
|
---|
607 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
608 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
609 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
610 | i2=pos.x+(size.cx/2)-1;
|
---|
611 | for(i=0;i<4;i++,i2--){
|
---|
612 | DrawLineInClient(WndNum,i2,i+pos.y+2,i2+(i*2)+1,i+pos.y+2);
|
---|
613 | }
|
---|
614 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
615 | DeleteObject(hPen);
|
---|
616 |
|
---|
617 | //下ボタン
|
---|
618 | pos.x=pPos->x;
|
---|
619 | pos.y=pPos->y+pSize->cy/2+pSize->cy%2;
|
---|
620 | size.cx=pSize->cx;
|
---|
621 | size.cy=pSize->cy/2;
|
---|
622 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size);
|
---|
623 |
|
---|
624 | //内部
|
---|
625 | DrawRectangleInClient(WndNum,
|
---|
626 | pos.x,pos.y,
|
---|
627 | pos.x+size.cx,pos.y+size.cy,
|
---|
628 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
629 |
|
---|
630 | pos.x--;
|
---|
631 | if(style&WS_DISABLED){
|
---|
632 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
633 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
634 | pos.x++;
|
---|
635 | pos.y++;
|
---|
636 | i2=pos.x+(size.cx/2);
|
---|
637 | for(i=3;i>=0;i--,i2--){
|
---|
638 | DrawLineInClient(WndNum,i2,i+pos.y+3,i2+((3-i)*2)+1,i+pos.y+3);
|
---|
639 | }
|
---|
640 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
641 | DeleteObject(hPen);
|
---|
642 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
643 | pos.x--;
|
---|
644 | pos.y--;
|
---|
645 | }
|
---|
646 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
647 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
648 | hOldPen=(HPEN)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hPen);
|
---|
649 | i2=pos.x+(size.cx/2);
|
---|
650 | for(i=3;i>=0;i--,i2--){
|
---|
651 | DrawLineInClient(WndNum,i2,i+pos.y+3,i2+((3-i)*2)+1,i+pos.y+3);
|
---|
652 | }
|
---|
653 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldPen);
|
---|
654 | DeleteObject(hPen);
|
---|
655 | }
|
---|
656 | }
|
---|
657 | void DrawWindowScrollBar(int WndNum,DWORD style,POINT *pPos,SIZE *pSize){
|
---|
658 | POINT pos;
|
---|
659 | SIZE size;
|
---|
660 | if(style&WS_HSCROLL){
|
---|
661 | pos.x=pPos->x;
|
---|
662 | pos.y=pPos->y+pSize->cy-GetSystemMetrics(SM_CYVSCROLL);
|
---|
663 | if(style&WS_VSCROLL) size.cx=pSize->cx-GetSystemMetrics(SM_CXVSCROLL);
|
---|
664 | else size.cx=pSize->cx;
|
---|
665 | size.cy=GetSystemMetrics(SM_CYVSCROLL);
|
---|
666 | DrawScrollBar(WndNum,style,0,&pos,&size);
|
---|
667 | }
|
---|
668 | if(style&WS_VSCROLL){
|
---|
669 | pos.x=pPos->x+pSize->cx-GetSystemMetrics(SM_CXHSCROLL);
|
---|
670 | pos.y=pPos->y;
|
---|
671 | size.cx=GetSystemMetrics(SM_CXHSCROLL);
|
---|
672 | if(style&WS_HSCROLL) size.cy=pSize->cy-GetSystemMetrics(SM_CYHSCROLL);
|
---|
673 | else size.cy=pSize->cy;
|
---|
674 | DrawScrollBar(WndNum,style,1,&pos,&size);
|
---|
675 | }
|
---|
676 | }
|
---|
677 | void DrawOEMImage(HDC hdc,POINT *pPos,SIZE *pSize,DWORD dwImage){
|
---|
678 | HBITMAP hBmp,hOldBmp;
|
---|
679 | HDC memdc;
|
---|
680 |
|
---|
681 | //未完成(XPのみに対応?)
|
---|
682 |
|
---|
683 | memdc=CreateCompatibleDC(hdc);
|
---|
684 | hBmp=LoadBitmap(NULL,(LPSTR)dwImage);
|
---|
685 | hOldBmp=(HBITMAP)SelectObject(memdc,hBmp);
|
---|
686 | BitBlt(hdc,pPos->x,pPos->y,pSize->cx,pSize->cy,memdc,0,0,SRCCOPY);
|
---|
687 | SelectObject(memdc,hOldBmp);
|
---|
688 | DeleteDC(memdc);
|
---|
689 | DeleteObject(hBmp);
|
---|
690 | }
|
---|
691 | void DesigningWindow(int WndNum,HDC hdc,POINT *pBasePos,WINDOW_INFO *pWindowInfo){
|
---|
692 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
693 | extern PROJECTINFO ProjectInfo;
|
---|
694 | int i,i2,i3,i4;
|
---|
695 | double red,green,blue,d_red,d_green,d_blue;
|
---|
696 | char temporary[MAX_PATH];
|
---|
697 | COLORREF rgb;
|
---|
698 | HPEN hPen,hOldPen;
|
---|
699 | HBRUSH hBrush,hOldBrush;
|
---|
700 | HFONT hFont,hOldFont;
|
---|
701 | HANDLE hImage;
|
---|
702 | RECT InsideRect,rect,rc2;
|
---|
703 | POINT pos,pos2;
|
---|
704 | SIZE size,size2;
|
---|
705 |
|
---|
706 | HGLOBAL hResource;
|
---|
707 | BITMAPINFO *pBitmapInfo;
|
---|
708 | BYTE *pByte,*pByte2;
|
---|
709 |
|
---|
710 |
|
---|
711 | ////////////////////////
|
---|
712 | //ウィンドウの縁を描画
|
---|
713 | InsideRect.left=pBasePos->x;
|
---|
714 | InsideRect.top=pBasePos->y;
|
---|
715 | InsideRect.right=InsideRect.left+pWindowInfo->size.cx;
|
---|
716 | InsideRect.bottom=InsideRect.top+pWindowInfo->size.cy;
|
---|
717 |
|
---|
718 | if(pWindowInfo->style&(WS_BORDER|WS_THICKFRAME)){
|
---|
719 | DrawEdge(hdc,&InsideRect,EDGE_RAISED,BF_RECT);
|
---|
720 |
|
---|
721 | InsideRect.left+=2;
|
---|
722 | InsideRect.top+=2;
|
---|
723 | InsideRect.right-=2;
|
---|
724 | InsideRect.bottom-=2;
|
---|
725 | }
|
---|
726 |
|
---|
727 |
|
---|
728 | ////////////
|
---|
729 | //枠を描画
|
---|
730 | if(pWindowInfo->style&(WS_BORDER|WS_THICKFRAME)){
|
---|
731 | //細枠
|
---|
732 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_ACTIVEBORDER));
|
---|
733 | hBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
---|
734 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
735 | hOldBrush=(HBRUSH)SelectObject(hdc,hBrush);
|
---|
736 | Rectangle(hdc,InsideRect.left,InsideRect.top,InsideRect.right,InsideRect.bottom);
|
---|
737 |
|
---|
738 | InsideRect.left+=1;
|
---|
739 | InsideRect.top+=1;
|
---|
740 | InsideRect.right-=1;
|
---|
741 | InsideRect.bottom-=1;
|
---|
742 |
|
---|
743 | //サイズ変更枠
|
---|
744 | if(pWindowInfo->style&WS_THICKFRAME){
|
---|
745 | Rectangle(hdc,InsideRect.left,InsideRect.top,InsideRect.right,InsideRect.bottom);
|
---|
746 |
|
---|
747 | InsideRect.left+=1;
|
---|
748 | InsideRect.top+=1;
|
---|
749 | InsideRect.right-=1;
|
---|
750 | InsideRect.bottom-=1;
|
---|
751 | }
|
---|
752 | SelectObject(hdc,hOldPen);
|
---|
753 | SelectObject(hdc,hOldBrush);
|
---|
754 | DeleteObject(hPen);
|
---|
755 | DeleteObject(hBrush);
|
---|
756 | }
|
---|
757 |
|
---|
758 |
|
---|
759 | //Draw...InClient関数のため
|
---|
760 | MdiInfo[WndNum].MdiRadInfo->ClientPos.x=0;
|
---|
761 | MdiInfo[WndNum].MdiRadInfo->ClientPos.y=0;
|
---|
762 |
|
---|
763 | if(pWindowInfo->style&(WS_CAPTION&(~WS_BORDER))){
|
---|
764 | //////////////////////
|
---|
765 | //タイトルバーを描画
|
---|
766 |
|
---|
767 | //背景を描画(グラデーション可)
|
---|
768 | i=GetSysColor(COLOR_ACTIVECAPTION);
|
---|
769 | OSVERSIONINFO OsVersionInfo;
|
---|
770 | OsVersionInfo.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
|
---|
771 | GetVersionEx(&OsVersionInfo);
|
---|
772 | if((OsVersionInfo.dwPlatformId==VER_PLATFORM_WIN32_NT&&OsVersionInfo.dwMajorVersion>=5)||
|
---|
773 | (OsVersionInfo.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS&&LOWORD(OsVersionInfo.dwBuildNumber)>=1998)){
|
---|
774 | #define COLOR_GRADIENTACTIVECAPTION 27
|
---|
775 | i2=GetSysColor(COLOR_GRADIENTACTIVECAPTION);
|
---|
776 | }
|
---|
777 | else i2=i;
|
---|
778 | if(pWindowInfo->ExStyle&WS_EX_TOOLWINDOW)
|
---|
779 | i3=GetSystemMetrics(SM_CYSMCAPTION);
|
---|
780 | else i3=GetSystemMetrics(SM_CYCAPTION);
|
---|
781 | d_red=((double)((i2&0xFF)-(i&0xFF)))/(double)(InsideRect.right-InsideRect.left);
|
---|
782 | d_green=((double)(((i2>>8)&0xFF))-((i>>8)&0xFF))/(double)(InsideRect.right-InsideRect.left);
|
---|
783 | d_blue=((double)(((i2>>16)&0xFF))-((i>>16)&0xFF))/(double)(InsideRect.right-InsideRect.left);
|
---|
784 |
|
---|
785 | red=(double)(i&0xFF);
|
---|
786 | green=(double)((i>>8)&0xFF);
|
---|
787 | blue=(double)((i>>16)&0xFF);
|
---|
788 | for(i4=InsideRect.left;i4<InsideRect.right;i4++){
|
---|
789 | hPen=CreatePen(PS_SOLID,0,RGB((_int8)red,(_int8)green,(_int8)blue));
|
---|
790 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
791 | MoveToEx(hdc,i4,InsideRect.top,NULL);
|
---|
792 | LineTo(hdc,i4,InsideRect.top+i3-1);
|
---|
793 | SelectObject(hdc,hOldPen);
|
---|
794 | DeleteObject(hPen);
|
---|
795 | red+=d_red;
|
---|
796 | green+=d_green;
|
---|
797 | blue+=d_blue;
|
---|
798 | }
|
---|
799 |
|
---|
800 | //タイトルテキストの描画
|
---|
801 | LOGFONT LogFont;
|
---|
802 | SystemParametersInfo(SPI_GETICONTITLELOGFONT,sizeof(LOGFONT),&LogFont,0);
|
---|
803 | hFont=CreateFontIndirect(&LogFont);
|
---|
804 | hOldFont=(HFONT)SelectObject(hdc,hFont);
|
---|
805 | SetTextColor(hdc,GetSysColor(COLOR_CAPTIONTEXT));
|
---|
806 | rect.left=InsideRect.left+20;
|
---|
807 | rect.top=InsideRect.top;
|
---|
808 | rect.right=InsideRect.right;
|
---|
809 | rect.bottom=InsideRect.top+i3;
|
---|
810 | DrawText(hdc,pWindowInfo->caption,lstrlen(pWindowInfo->caption),&rect,DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX);
|
---|
811 | SelectObject(hdc,hOldFont);
|
---|
812 | DeleteObject(hFont);
|
---|
813 |
|
---|
814 | //ボタン
|
---|
815 | if(pWindowInfo->style&WS_SYSMENU){
|
---|
816 | //終了ボタン
|
---|
817 | size.cx=GetSystemMetrics(SM_CXSIZE)-2;
|
---|
818 | size.cy=GetSystemMetrics(SM_CYSIZE)-4;
|
---|
819 | pos.x=InsideRect.right-2-size.cx;
|
---|
820 | pos.y=InsideRect.top+2;
|
---|
821 | DrawButtonEdge(WndNum,&pos,&size);
|
---|
822 |
|
---|
823 | hResource=LoadResource(hResInst,FindResource(hResInst,MAKEINTRESOURCE(IDB_TITLE_BUTTON_CLOSE),RT_BITMAP));
|
---|
824 | pBitmapInfo=(BITMAPINFO *)LockResource(hResource);
|
---|
825 | pByte=(BYTE *)pBitmapInfo+pBitmapInfo->bmiHeader.biSize;
|
---|
826 |
|
---|
827 | i2=pBitmapInfo->bmiHeader.biWidth*3;
|
---|
828 | if(i2%sizeof(LONG)!=0) i2+=sizeof(LONG)-(i2%sizeof(LONG));
|
---|
829 | pByte2=(BYTE *)GlobalAlloc(GMEM_FIXED,pBitmapInfo->bmiHeader.biHeight*i2);
|
---|
830 | int x,y;
|
---|
831 | for(y=0;y<pBitmapInfo->bmiHeader.biHeight;y++){
|
---|
832 | if(y%2==0) rgb=GetSysColor(COLOR_3DFACE);
|
---|
833 | else rgb=RGB(255,255,255);
|
---|
834 | for(x=0;x<pBitmapInfo->bmiHeader.biWidth;x++){
|
---|
835 | i4=y*i2+x*3;
|
---|
836 | rgb=RGB(pByte[i4+2],pByte[i4+1],pByte[i4]);
|
---|
837 | if(rgb==RGB(0,0,0)){
|
---|
838 | rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
839 | pByte2[i4+2]=LOBYTE(LOWORD(rgb));
|
---|
840 | pByte2[i4+1]=HIBYTE(LOWORD(rgb));
|
---|
841 | pByte2[i4]=LOBYTE(HIWORD(rgb));
|
---|
842 | }
|
---|
843 | else if(rgb==RGB(255,255,255)){
|
---|
844 | rgb=GetSysColor(COLOR_3DFACE);
|
---|
845 | pByte2[i4+2]=LOBYTE(LOWORD(rgb));
|
---|
846 | pByte2[i4+1]=HIBYTE(LOWORD(rgb));
|
---|
847 | pByte2[i4]=LOBYTE(HIWORD(rgb));
|
---|
848 | }
|
---|
849 | }
|
---|
850 | }
|
---|
851 | SetStretchBltMode(hdc,COLORONCOLOR);
|
---|
852 | StretchDIBits(hdc,
|
---|
853 | pos.x+(int)((double)size.cx*0.17), pos.y+(int)((double)size.cy*0.17),
|
---|
854 | (int)((double)size.cx*0.65)+1, (int)((double)size.cy*0.65)+1,
|
---|
855 | 0,0,
|
---|
856 | pBitmapInfo->bmiHeader.biWidth,pBitmapInfo->bmiHeader.biHeight,
|
---|
857 | pByte2,
|
---|
858 | pBitmapInfo,
|
---|
859 | DIB_RGB_COLORS,SRCCOPY);
|
---|
860 | GlobalFree(pByte2);
|
---|
861 |
|
---|
862 | if(pWindowInfo->style&WS_MAXIMIZEBOX||pWindowInfo->style&WS_MINIMIZEBOX){
|
---|
863 | //最大化ボタン
|
---|
864 | size.cx=GetSystemMetrics(SM_CXSIZE)-2;
|
---|
865 | size.cy=GetSystemMetrics(SM_CYSIZE)-4;
|
---|
866 | pos.x=InsideRect.right-size.cx*2-4;
|
---|
867 | pos.y=InsideRect.top+2;
|
---|
868 | DrawButtonEdge(WndNum,&pos,&size);
|
---|
869 | if(!(pWindowInfo->style&WS_MAXIMIZEBOX)){
|
---|
870 | pos.x++;
|
---|
871 | pos.y++;
|
---|
872 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
873 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
874 | hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(NULL_BRUSH));
|
---|
875 | Rectangle(hdc,pos.x,pos.y,pos.x+size.cx-2,pos.y+size.cy-1);
|
---|
876 | MoveToEx(hdc,pos.x,pos.y+1,NULL);
|
---|
877 | LineTo(hdc,pos.x+size.cx-2,pos.y+1);
|
---|
878 | SelectObject(hdc,hOldPen);
|
---|
879 | SelectObject(hdc,hOldBrush);
|
---|
880 | DeleteObject(hPen);
|
---|
881 | pos.x--;
|
---|
882 | pos.y--;
|
---|
883 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
884 | }
|
---|
885 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
886 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
887 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
888 | hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(NULL_BRUSH));
|
---|
889 | Rectangle(hdc,pos.x,pos.y,pos.x+size.cx-2,pos.y+size.cy-1);
|
---|
890 | MoveToEx(hdc,pos.x,pos.y+1,NULL);
|
---|
891 | LineTo(hdc,pos.x+size.cx-2,pos.y+1);
|
---|
892 | SelectObject(hdc,hOldPen);
|
---|
893 | SelectObject(hdc,hOldBrush);
|
---|
894 | DeleteObject(hPen);
|
---|
895 |
|
---|
896 | //最小化ボタン
|
---|
897 | size.cx=GetSystemMetrics(SM_CXSIZE)-2;
|
---|
898 | size.cy=GetSystemMetrics(SM_CYSIZE)-4;
|
---|
899 | pos.x=InsideRect.right-size.cx*3-4;
|
---|
900 | pos.y=InsideRect.top+2;
|
---|
901 | DrawButtonEdge(WndNum,&pos,&size);
|
---|
902 | if(!(pWindowInfo->style&WS_MINIMIZEBOX)){
|
---|
903 | pos.x++;
|
---|
904 | pos.y++;
|
---|
905 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
906 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
907 | MoveToEx(hdc,pos.x+1,pos.y+size.cy-2,NULL);
|
---|
908 | LineTo(hdc,pos.x+size.cy-3,pos.y+size.cy-2);
|
---|
909 | MoveToEx(hdc,pos.x+1,pos.y+size.cy-3,NULL);
|
---|
910 | LineTo(hdc,pos.x+size.cy-3,pos.y+size.cy-3);
|
---|
911 | SelectObject(hdc,hOldPen);
|
---|
912 | DeleteObject(hPen);
|
---|
913 | pos.x--;
|
---|
914 | pos.y--;
|
---|
915 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
916 | }
|
---|
917 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
918 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
919 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
920 | MoveToEx(hdc,pos.x+1,pos.y+size.cy-2,NULL);
|
---|
921 | LineTo(hdc,pos.x+size.cy-3,pos.y+size.cy-2);
|
---|
922 | MoveToEx(hdc,pos.x+1,pos.y+size.cy-3,NULL);
|
---|
923 | LineTo(hdc,pos.x+size.cy-3,pos.y+size.cy-3);
|
---|
924 | SelectObject(hdc,hOldPen);
|
---|
925 | DeleteObject(hPen);
|
---|
926 | }
|
---|
927 | }
|
---|
928 |
|
---|
929 | InsideRect.top+=i3;
|
---|
930 | }
|
---|
931 |
|
---|
932 | if(pWindowInfo->MenuID){
|
---|
933 | //メニューラインを3DFACEで描画
|
---|
934 | rgb=GetSysColor(COLOR_3DFACE);
|
---|
935 | i=GetSystemMetrics(SM_CYMENU);
|
---|
936 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
937 | hBrush=CreateSolidBrush(rgb);
|
---|
938 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
939 | hOldBrush=(HBRUSH)SelectObject(hdc,hBrush);
|
---|
940 | Rectangle(hdc,
|
---|
941 | InsideRect.left,InsideRect.top-1,InsideRect.right,InsideRect.top+i);
|
---|
942 | SelectObject(hdc,hOldPen);
|
---|
943 | SelectObject(hdc,hOldBrush);
|
---|
944 | DeleteObject(hPen);
|
---|
945 | DeleteObject(hBrush);
|
---|
946 |
|
---|
947 | InsideRect.top+=i;
|
---|
948 | }
|
---|
949 |
|
---|
950 | //クライアント左上ポジションを設定
|
---|
951 | MdiInfo[WndNum].MdiRadInfo->ClientPos.x=InsideRect.left;
|
---|
952 | MdiInfo[WndNum].MdiRadInfo->ClientPos.y=InsideRect.top;
|
---|
953 |
|
---|
954 | //ExStyleによる縁を描画
|
---|
955 | pos.x=0;
|
---|
956 | pos.y=0;
|
---|
957 | size.cx=InsideRect.right-InsideRect.left;
|
---|
958 | size.cy=InsideRect.bottom-InsideRect.top;
|
---|
959 | DrawItemEdgeByExStyle(WndNum,pWindowInfo->ExStyle,&pos,&size);
|
---|
960 |
|
---|
961 | //スクロールバーを描画
|
---|
962 | DrawWindowScrollBar(WndNum,pWindowInfo->style,&pos,&size);
|
---|
963 |
|
---|
964 | //クライアント領域のサイズを設定
|
---|
965 | MdiInfo[WndNum].MdiRadInfo->ClientSize=size;
|
---|
966 |
|
---|
967 |
|
---|
968 | //////////////
|
---|
969 | //背景を描画
|
---|
970 | if(pWindowInfo->bgColor==COLOR_3DFACE){
|
---|
971 | //3DFACE
|
---|
972 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DFACE));
|
---|
973 | hBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE));
|
---|
974 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
975 | hOldBrush=(HBRUSH)SelectObject(hdc,hBrush);
|
---|
976 | Rectangle(hdc,InsideRect.left,InsideRect.top,InsideRect.right,InsideRect.bottom);
|
---|
977 | SelectObject(hdc,hOldPen);
|
---|
978 | SelectObject(hdc,hOldBrush);
|
---|
979 | DeleteObject(hPen);
|
---|
980 | DeleteObject(hBrush);
|
---|
981 | }
|
---|
982 | else if(pWindowInfo->bgColor<=0){
|
---|
983 | //色指定
|
---|
984 | hPen=CreatePen(PS_SOLID,0,-pWindowInfo->bgColor);
|
---|
985 | hBrush=CreateSolidBrush(-pWindowInfo->bgColor);
|
---|
986 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
987 | hOldBrush=(HBRUSH)SelectObject(hdc,hBrush);
|
---|
988 | Rectangle(hdc,InsideRect.left,InsideRect.top,InsideRect.right,InsideRect.bottom);
|
---|
989 | SelectObject(hdc,hOldPen);
|
---|
990 | SelectObject(hdc,hOldBrush);
|
---|
991 | DeleteObject(hPen);
|
---|
992 | DeleteObject(hBrush);
|
---|
993 | }
|
---|
994 | else if(pWindowInfo->bgColor>=0x1000){
|
---|
995 | //ビットマップ
|
---|
996 | for(i2=0;i2<ProjectInfo.res.NumberOfBitmapRes;i2++){
|
---|
997 | if(lstrcmp(ProjectInfo.res.pBitmapResInfo[pWindowInfo->bgColor-0x1000].IdName,
|
---|
998 | ProjectInfo.res.pBitmapResInfo[i2].IdName)==0) break;
|
---|
999 | }
|
---|
1000 | if(i2!=ProjectInfo.res.NumberOfBitmapRes){
|
---|
1001 | lstrcpy(temporary,ProjectInfo.res.pBitmapResInfo[i2].path);
|
---|
1002 | GetFullPath(temporary,ProjectInfo.dir);
|
---|
1003 | hImage=LoadImage(NULL,temporary,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
|
---|
1004 |
|
---|
1005 | hBrush=CreatePatternBrush((HBITMAP)hImage);
|
---|
1006 | hOldBrush=(HBRUSH)SelectObject(hdc,hBrush);
|
---|
1007 | SetBrushOrgEx(hdc,InsideRect.left,InsideRect.top,&pos);
|
---|
1008 | PatBlt(hdc,
|
---|
1009 | InsideRect.left, InsideRect.top,
|
---|
1010 | InsideRect.right-InsideRect.left, InsideRect.bottom-InsideRect.top,PATCOPY);
|
---|
1011 | SetBrushOrgEx(hdc,pos.x,pos.y,0);
|
---|
1012 | SelectObject(hdc,hOldBrush);
|
---|
1013 | DeleteObject(hBrush);
|
---|
1014 | DeleteObject(hImage);
|
---|
1015 | }
|
---|
1016 | }
|
---|
1017 |
|
---|
1018 |
|
---|
1019 | ////////////////////////////////////////////
|
---|
1020 | //子ウィンドウ(ダイアログアイテム)を描画
|
---|
1021 | hFont=CreateFontIndirect(&pWindowInfo->LogFont);
|
---|
1022 | for(i=0;i<pWindowInfo->NumberOfChildWindows;i++){
|
---|
1023 | pos=pWindowInfo->pChildInfo[i].pos;
|
---|
1024 | size=pWindowInfo->pChildInfo[i].size;
|
---|
1025 |
|
---|
1026 | //ExStyleによる縁を描画
|
---|
1027 | DrawItemEdgeByExStyle(WndNum,pWindowInfo->pChildInfo[i].ExStyle,&pos,&size);
|
---|
1028 |
|
---|
1029 | if(pWindowInfo->pChildInfo[i].Control==CT_BUTTON){
|
---|
1030 | ////////////////////////
|
---|
1031 | // Button コントロール
|
---|
1032 |
|
---|
1033 | if((pWindowInfo->pChildInfo[i].style&0x0000000F)==BS_DEFPUSHBUTTON){
|
---|
1034 | //標準のボタンの場合(黒枠描画)
|
---|
1035 | DrawRectangleInClient(WndNum,
|
---|
1036 | pos.x, pos.y,
|
---|
1037 | pos.x+size.cx, pos.y+size.cy,
|
---|
1038 | RGB(0,0,0),0,0);
|
---|
1039 | pos.x++;
|
---|
1040 | pos.y++;
|
---|
1041 | size.cx-=2;
|
---|
1042 | size.cy-=2;
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | //ボタンの縁を描画
|
---|
1046 | DrawButtonEdge(WndNum,&pos,&size);
|
---|
1047 |
|
---|
1048 | if(!(pWindowInfo->pChildInfo[i].style&(BS_ICON|BS_BITMAP))){
|
---|
1049 | //キャプション テキスト
|
---|
1050 |
|
---|
1051 | rect.left=pos.x+1+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1052 | rect.top=pos.y+1+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1053 | rect.right=pos.x+size.cx-2+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1054 | rect.bottom=pos.y+size.cy-2+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1055 |
|
---|
1056 | if(pWindowInfo->pChildInfo[i].style&BS_MULTILINE) i4=0;
|
---|
1057 | else i4=DT_SINGLELINE;
|
---|
1058 |
|
---|
1059 | //ビットを考慮してBS_CENTERを最初に比較する
|
---|
1060 | if((pWindowInfo->pChildInfo[i].style&BS_CENTER)==BS_CENTER) i2=DT_CENTER;
|
---|
1061 | else if(pWindowInfo->pChildInfo[i].style&BS_LEFT) i2=DT_LEFT;
|
---|
1062 | else if(pWindowInfo->pChildInfo[i].style&BS_RIGHT) i2=DT_RIGHT;
|
---|
1063 | else i2=DT_CENTER;
|
---|
1064 |
|
---|
1065 | //ビットを考慮してBS_VCENTERを最初に比較する
|
---|
1066 | if((pWindowInfo->pChildInfo[i].style&BS_VCENTER)==BS_VCENTER) i3=DT_VCENTER;
|
---|
1067 | else if(pWindowInfo->pChildInfo[i].style&BS_TOP) i3=DT_TOP;
|
---|
1068 | else if(pWindowInfo->pChildInfo[i].style&BS_BOTTOM) i3=DT_BOTTOM;
|
---|
1069 | else i3=DT_VCENTER;
|
---|
1070 |
|
---|
1071 | hOldFont=(HFONT)SelectObject(hdc,hFont);
|
---|
1072 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED){
|
---|
1073 | SetTextColor(hdc,RGB(255,255,255));
|
---|
1074 | rc2.left=rect.left+1;
|
---|
1075 | rc2.top=rect.top+1;
|
---|
1076 | rc2.right=rect.right+1;
|
---|
1077 | rc2.bottom=rect.bottom+1;
|
---|
1078 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rc2,i4|i2|i3);
|
---|
1079 | SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT));
|
---|
1080 | }
|
---|
1081 | else SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT));
|
---|
1082 |
|
---|
1083 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rect,i4|i2|i3);
|
---|
1084 | SelectObject(hdc,hOldFont);
|
---|
1085 | }
|
---|
1086 | }
|
---|
1087 | else if(pWindowInfo->pChildInfo[i].Control==CT_CHECKBOX){
|
---|
1088 | //////////////////////////
|
---|
1089 | // CheckBox コントロール
|
---|
1090 |
|
---|
1091 | if(pWindowInfo->pChildInfo[i].style&BS_PUSHLIKE){
|
---|
1092 | //ボタンの縁を描画
|
---|
1093 | DrawButtonEdge(WndNum,&pos,&size);
|
---|
1094 | }
|
---|
1095 | else{
|
---|
1096 | //チェックボックスを描画
|
---|
1097 | size2.cx=13;
|
---|
1098 | size2.cy=13;
|
---|
1099 | if(pWindowInfo->pChildInfo[i].style&BS_LEFTTEXT)
|
---|
1100 | pos2.x=pos.x+size.cx-size2.cx;
|
---|
1101 | else pos2.x=pos.x;
|
---|
1102 | if((pWindowInfo->pChildInfo[i].style&BS_VCENTER)==BS_VCENTER||
|
---|
1103 | (pWindowInfo->pChildInfo[i].style&BS_VCENTER)==0)
|
---|
1104 | pos2.y=pos.y+(size.cy/2)-(size2.cy/2);
|
---|
1105 | else if(pWindowInfo->pChildInfo[i].style&BS_TOP)
|
---|
1106 | pos2.y=pos.y+1;
|
---|
1107 | else if(pWindowInfo->pChildInfo[i].style&BS_BOTTOM)
|
---|
1108 | pos2.y=pos.y+size.cy-size2.cy-1;
|
---|
1109 | DrawItemEdgeByExStyle(WndNum,WS_EX_CLIENTEDGE,&pos2,&size2);
|
---|
1110 |
|
---|
1111 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED)
|
---|
1112 | rgb=GetSysColor(COLOR_3DFACE);
|
---|
1113 | else rgb=GetSysColor(COLOR_WINDOW);
|
---|
1114 | DrawRectangleInClient(WndNum,pos2.x, pos2.y,
|
---|
1115 | pos2.x+size2.cx, pos2.y+size2.cy,
|
---|
1116 | rgb,rgb,1);
|
---|
1117 | if(!(pWindowInfo->pChildInfo[i].style&BS_LEFTTEXT)) pos.x+=17;
|
---|
1118 | else pos.x++;
|
---|
1119 | size.cx-=17;
|
---|
1120 | }
|
---|
1121 |
|
---|
1122 | if(!(pWindowInfo->pChildInfo[i].style&(BS_ICON|BS_BITMAP))){
|
---|
1123 | //キャプション テキスト
|
---|
1124 | rect.left=pos.x+1+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1125 | rect.top=pos.y+1+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1126 | rect.right=pos.x+size.cx-2+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1127 | rect.bottom=pos.y+size.cy-2+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1128 |
|
---|
1129 | if(pWindowInfo->pChildInfo[i].style&BS_MULTILINE) i4=0;
|
---|
1130 | else i4=DT_SINGLELINE;
|
---|
1131 |
|
---|
1132 | //ビットを考慮してBS_CENTERを最初に比較する
|
---|
1133 | if((pWindowInfo->pChildInfo[i].style&BS_CENTER)==BS_CENTER) i2=DT_CENTER;
|
---|
1134 | else if(pWindowInfo->pChildInfo[i].style&BS_LEFT) i2=DT_LEFT;
|
---|
1135 | else if(pWindowInfo->pChildInfo[i].style&BS_RIGHT) i2=DT_RIGHT;
|
---|
1136 | else i2=DT_LEFT;
|
---|
1137 |
|
---|
1138 | //ビットを考慮してBS_VCENTERを最初に比較する
|
---|
1139 | if((pWindowInfo->pChildInfo[i].style&BS_VCENTER)==BS_VCENTER) i3=DT_VCENTER;
|
---|
1140 | else if(pWindowInfo->pChildInfo[i].style&BS_TOP) i3=DT_TOP;
|
---|
1141 | else if(pWindowInfo->pChildInfo[i].style&BS_BOTTOM) i3=DT_BOTTOM;
|
---|
1142 | else i3=DT_VCENTER;
|
---|
1143 |
|
---|
1144 | hOldFont=(HFONT)SelectObject(hdc,hFont);
|
---|
1145 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED){
|
---|
1146 | SetTextColor(hdc,RGB(255,255,255));
|
---|
1147 | rc2.left=rect.left+1;
|
---|
1148 | rc2.top=rect.top+1;
|
---|
1149 | rc2.right=rect.right+1;
|
---|
1150 | rc2.bottom=rect.bottom+1;
|
---|
1151 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rc2,i4|i2|i3);
|
---|
1152 | SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT));
|
---|
1153 | }
|
---|
1154 | else SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT));
|
---|
1155 |
|
---|
1156 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rect,i4|i2|i3);
|
---|
1157 | SelectObject(hdc,hOldFont);
|
---|
1158 | }
|
---|
1159 | }
|
---|
1160 | else if(pWindowInfo->pChildInfo[i].Control==CT_COMBOBOX){
|
---|
1161 | //////////////////////////
|
---|
1162 | // ComboBox コントロール
|
---|
1163 |
|
---|
1164 | pos2=pos;
|
---|
1165 | size2.cx=size.cx;
|
---|
1166 | size2.cy=20;
|
---|
1167 | DrawItemEdgeByExStyle(WndNum,WS_EX_CLIENTEDGE,&pos2,&size2);
|
---|
1168 |
|
---|
1169 | //内部
|
---|
1170 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED)
|
---|
1171 | rgb=GetSysColor(COLOR_3DFACE);
|
---|
1172 | else rgb=GetSysColor(COLOR_WINDOW);
|
---|
1173 | DrawRectangleInClient(WndNum,
|
---|
1174 | pos2.x,pos2.y,
|
---|
1175 | pos2.x+size2.cx,pos2.y+size2.cy,
|
---|
1176 | rgb,rgb,1);
|
---|
1177 |
|
---|
1178 | if((pWindowInfo->pChildInfo[i].style&0x000F)==CBS_SIMPLE){
|
---|
1179 | pos.y+=20;
|
---|
1180 | size.cy-=20;
|
---|
1181 | DrawItemEdgeByExStyle(WndNum,WS_EX_CLIENTEDGE,&pos,&size);
|
---|
1182 |
|
---|
1183 | //内部
|
---|
1184 | rgb=GetSysColor(COLOR_WINDOW);
|
---|
1185 | DrawRectangleInClient(WndNum,
|
---|
1186 | pos.x,pos.y,
|
---|
1187 | pos.x+size.cx,pos.y+size.cy,
|
---|
1188 | rgb,rgb,1);
|
---|
1189 | }
|
---|
1190 | else{
|
---|
1191 | //下ボタン
|
---|
1192 | pos2.x+=size2.cx-16;
|
---|
1193 | size2.cx=16;
|
---|
1194 | size2.cy=16;
|
---|
1195 | DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos2,&size2);
|
---|
1196 |
|
---|
1197 | //内部
|
---|
1198 | DrawRectangleInClient(WndNum,
|
---|
1199 | pos2.x,pos2.y,
|
---|
1200 | pos2.x+size2.cx,pos2.y+size2.cy,
|
---|
1201 | GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1);
|
---|
1202 |
|
---|
1203 | pos2.x--;
|
---|
1204 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED){
|
---|
1205 | hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT));
|
---|
1206 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
1207 | pos2.x++;
|
---|
1208 | pos2.y++;
|
---|
1209 | i3=pos2.x+(size2.cx/2);
|
---|
1210 | for(i2=3;i2>=0;i2--,i3--){
|
---|
1211 | DrawLineInClient(WndNum,i3,i2+pos2.y+3,i3+((3-i2)*2)+1,i2+pos2.y+3);
|
---|
1212 | }
|
---|
1213 | SelectObject(hdc,hOldPen);
|
---|
1214 | DeleteObject(hPen);
|
---|
1215 | rgb=GetSysColor(COLOR_GRAYTEXT);
|
---|
1216 | pos2.x--;
|
---|
1217 | pos2.y--;
|
---|
1218 | }
|
---|
1219 | else rgb=GetSysColor(COLOR_BTNTEXT);
|
---|
1220 | hPen=CreatePen(PS_SOLID,0,rgb);
|
---|
1221 | hOldPen=(HPEN)SelectObject(hdc,hPen);
|
---|
1222 | i3=pos2.x+(size2.cx/2);
|
---|
1223 | for(i2=3;i2>=0;i2--,i3--){
|
---|
1224 | DrawLineInClient(WndNum,i3,i2+pos2.y+3,i3+((3-i2)*2)+1,i2+pos2.y+3);
|
---|
1225 | }
|
---|
1226 | SelectObject(hdc,hOldPen);
|
---|
1227 | DeleteObject(hPen);
|
---|
1228 | }
|
---|
1229 | }
|
---|
1230 | else if(pWindowInfo->pChildInfo[i].Control==CT_EDIT){
|
---|
1231 | //////////////////////
|
---|
1232 | // Edit コントロール
|
---|
1233 |
|
---|
1234 | //内部
|
---|
1235 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED||pWindowInfo->pChildInfo[i].style&ES_READONLY)
|
---|
1236 | rgb=GetSysColor(COLOR_3DFACE);
|
---|
1237 | else rgb=GetSysColor(COLOR_WINDOW);
|
---|
1238 | DrawRectangleInClient(WndNum,
|
---|
1239 | pos.x,pos.y,
|
---|
1240 | pos.x+size.cx,pos.y+size.cy,
|
---|
1241 | rgb,rgb,1);
|
---|
1242 |
|
---|
1243 | //キャプション テキスト
|
---|
1244 | rect.left=pos.x+1+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1245 | rect.top=pos.y+1+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1246 | rect.right=pos.x+size.cx-1+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1247 | rect.bottom=pos.y+size.cy-1+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1248 |
|
---|
1249 | if(pWindowInfo->pChildInfo[i].style&ES_MULTILINE) i4=0;
|
---|
1250 | else i4=DT_SINGLELINE;
|
---|
1251 |
|
---|
1252 | //ビットを考慮してES_LEFTを最後に検討する
|
---|
1253 | if(pWindowInfo->pChildInfo[i].style&ES_CENTER) i2=DT_CENTER;
|
---|
1254 | else if(pWindowInfo->pChildInfo[i].style&ES_RIGHT) i2=DT_RIGHT;
|
---|
1255 | else i2=DT_LEFT;
|
---|
1256 |
|
---|
1257 | //文字色を設定
|
---|
1258 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED)
|
---|
1259 | SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT));
|
---|
1260 | else
|
---|
1261 | SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT));
|
---|
1262 |
|
---|
1263 | hOldFont=(HFONT)SelectObject(hdc,hFont);
|
---|
1264 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rect,i4|i2);
|
---|
1265 | SelectObject(hdc,hOldFont);
|
---|
1266 | }
|
---|
1267 |
|
---|
1268 | else if(pWindowInfo->pChildInfo[i].Control==CT_GROUPBOX){
|
---|
1269 | ///////////////////////////////////
|
---|
1270 | // グループ ボックス コントロール
|
---|
1271 |
|
---|
1272 | hOldFont=(HFONT)SelectObject(hdc,hFont);
|
---|
1273 | GetTextExtentPoint32(hdc,pWindowInfo->pChildInfo[i].caption,lstrlen(pWindowInfo->pChildInfo[i].caption),&size2);
|
---|
1274 |
|
---|
1275 | //枠を描画
|
---|
1276 | rect.left=pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1277 | rect.top=pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y+(size2.cy/2);
|
---|
1278 | rect.right=pos.x+size.cx+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1279 | rect.bottom=pos.y+size.cy+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1280 | DrawEdge(hdc,&rect,EDGE_ETCHED,BF_RECT);
|
---|
1281 |
|
---|
1282 | //ビットを考慮してBS_CENTERを最初に検討する
|
---|
1283 | if((pWindowInfo->pChildInfo[i].style&BS_CENTER)==BS_CENTER){
|
---|
1284 | rect.left=pos.x+(size.cx/2)-(size2.cx/2)-3;
|
---|
1285 | rect.right=rect.left+size2.cx+4;
|
---|
1286 | }
|
---|
1287 | else if(pWindowInfo->pChildInfo[i].style&BS_RIGHT){
|
---|
1288 | rect.right=pos.x+size.cx-7;
|
---|
1289 | rect.left=rect.right-size2.cx-4;
|
---|
1290 | }
|
---|
1291 | else{
|
---|
1292 | rect.left=pos.x+7;
|
---|
1293 | rect.right=rect.left+size2.cx+4;
|
---|
1294 | }
|
---|
1295 | rect.top=pos.y;
|
---|
1296 | rect.bottom=pos.y+size2.cy;
|
---|
1297 |
|
---|
1298 | if(pWindowInfo->bgColor==COLOR_3DFACE) rgb=GetSysColor(COLOR_3DFACE);
|
---|
1299 | else rgb=-pWindowInfo->bgColor;
|
---|
1300 | DrawRectangleInClient(WndNum,rect.left,rect.top,rect.right,rect.bottom,rgb,rgb,1);
|
---|
1301 |
|
---|
1302 | if(!((pWindowInfo->pChildInfo[i].style&BS_ICON)||(pWindowInfo->pChildInfo[i].style&BS_BITMAP))){
|
---|
1303 | rect.left+=MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1304 | rect.top+=MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1305 | rect.right+=MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1306 | rect.bottom+=MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1307 | rect.left+=2;
|
---|
1308 | rect.right-=2;
|
---|
1309 |
|
---|
1310 | //テキストを描画
|
---|
1311 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED){
|
---|
1312 | SetTextColor(hdc,RGB(255,255,255));
|
---|
1313 | rc2.left=rect.left+1;
|
---|
1314 | rc2.top=rect.top+1;
|
---|
1315 | rc2.right=rect.right+1;
|
---|
1316 | rc2.bottom=rect.bottom+1;
|
---|
1317 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rc2,DT_SINGLELINE);
|
---|
1318 | SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT));
|
---|
1319 | }
|
---|
1320 | else
|
---|
1321 | SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT));
|
---|
1322 |
|
---|
1323 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rect,DT_SINGLELINE);
|
---|
1324 | }
|
---|
1325 | SelectObject(hdc,hOldFont);
|
---|
1326 | }
|
---|
1327 |
|
---|
1328 | else if(pWindowInfo->pChildInfo[i].Control==CT_HSCROLLBAR){
|
---|
1329 | ////////////////////////////////////
|
---|
1330 | // 水平スクロールバー コントロール
|
---|
1331 | DrawScrollBar(WndNum,pWindowInfo->pChildInfo[i].style,0,&pos,&size);
|
---|
1332 | }
|
---|
1333 |
|
---|
1334 | else if(pWindowInfo->pChildInfo[i].Control==CT_IMAGEBOX){
|
---|
1335 | /////////////////////
|
---|
1336 | // イメージ ボックス
|
---|
1337 | HDC memdc;
|
---|
1338 |
|
---|
1339 | if((pWindowInfo->pChildInfo[i].style&0x0000000F)==SS_BLACKFRAME)
|
---|
1340 | DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(0,0,0),0,0);
|
---|
1341 | else if((pWindowInfo->pChildInfo[i].style&0x0000000F)==SS_GRAYFRAME)
|
---|
1342 | DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,GetSysColor(COLOR_3DSHADOW),0,0);
|
---|
1343 | else if((pWindowInfo->pChildInfo[i].style&0x0000000F)==SS_WHITEFRAME)
|
---|
1344 | DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(255,255,255),0,0);
|
---|
1345 | else if((pWindowInfo->pChildInfo[i].style&0x0000001F)==SS_ETCHEDFRAME){
|
---|
1346 | rect.left=pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1347 | rect.top=pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1348 | rect.right=pos.x+size.cx+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1349 | rect.bottom=pos.y+size.cy+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1350 | DrawEdge(hdc,&rect,EDGE_ETCHED,BF_RECT);
|
---|
1351 | }
|
---|
1352 | else if((pWindowInfo->pChildInfo[i].style&0x0000000F)==SS_BLACKRECT)
|
---|
1353 | DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,GetSysColor(COLOR_3DDKSHADOW),GetSysColor(COLOR_3DDKSHADOW),1);
|
---|
1354 | else if((pWindowInfo->pChildInfo[i].style&0x0000000F)==SS_GRAYRECT)
|
---|
1355 | DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,GetSysColor(COLOR_3DSHADOW),GetSysColor(COLOR_3DSHADOW),1);
|
---|
1356 | else if((pWindowInfo->pChildInfo[i].style&0x0000000F)==SS_WHITERECT)
|
---|
1357 | DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(255,255,255),RGB(255,255,255),1);
|
---|
1358 | else if((pWindowInfo->pChildInfo[i].style&0x0000000F)==SS_ICON){
|
---|
1359 | if(pWindowInfo->pChildInfo[i].ImageCtrlInfo.type==IMGTYPE_FILE)
|
---|
1360 | lstrcpy(temporary,pWindowInfo->pChildInfo[i].ImageCtrlInfo.path);
|
---|
1361 | else{
|
---|
1362 | for(i2=0;i2<ProjectInfo.res.NumberOfIconRes;i2++){
|
---|
1363 | if(lstrcmp(pWindowInfo->pChildInfo[i].ImageCtrlInfo.path,
|
---|
1364 | ProjectInfo.res.pIconResInfo[i2].IdName)==0) break;
|
---|
1365 | }
|
---|
1366 | if(i2==ProjectInfo.res.NumberOfIconRes) goto NonIconImage;
|
---|
1367 |
|
---|
1368 | lstrcpy(temporary,ProjectInfo.res.pIconResInfo[i2].path);
|
---|
1369 | }
|
---|
1370 | GetFullPath(temporary,ProjectInfo.dir);
|
---|
1371 | hImage=LoadImage(NULL,temporary,IMAGE_ICON,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
|
---|
1372 | if(hImage){
|
---|
1373 | pWindowInfo->pChildInfo[i].size.cx=32+(pWindowInfo->pChildInfo[i].size.cx-size.cx);
|
---|
1374 | pWindowInfo->pChildInfo[i].size.cy=32+(pWindowInfo->pChildInfo[i].size.cy-size.cy);
|
---|
1375 | pos=pWindowInfo->pChildInfo[i].pos;
|
---|
1376 | size=pWindowInfo->pChildInfo[i].size;
|
---|
1377 |
|
---|
1378 | //ExStyleによる縁を再描画
|
---|
1379 | DrawItemEdgeByExStyle(WndNum,pWindowInfo->pChildInfo[i].ExStyle,&pos,&size);
|
---|
1380 |
|
---|
1381 | DrawIcon(hdc,
|
---|
1382 | pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x,
|
---|
1383 | pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y,
|
---|
1384 | (HICON)hImage);
|
---|
1385 | DestroyIcon((HICON)hImage);
|
---|
1386 | }
|
---|
1387 | else{
|
---|
1388 | NonIconImage:
|
---|
1389 | DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(0,0,0),0,0);
|
---|
1390 | hOldFont=(HFONT)SelectObject(hdc,hFont);
|
---|
1391 | rect.left=pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1392 | rect.top=pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1393 | rect.right=pos.x+size.cx+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1394 | rect.bottom=pos.y+size.cy+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1395 | SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT));
|
---|
1396 | DrawText(hdc,"icon...",-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
|
---|
1397 | SelectObject(hdc,hOldFont);
|
---|
1398 | }
|
---|
1399 | }
|
---|
1400 | else if((pWindowInfo->pChildInfo[i].style&0x0000000F)==SS_BITMAP){
|
---|
1401 | BITMAP Bitmap;
|
---|
1402 |
|
---|
1403 | if(pWindowInfo->pChildInfo[i].ImageCtrlInfo.type==IMGTYPE_FILE)
|
---|
1404 | lstrcpy(temporary,pWindowInfo->pChildInfo[i].ImageCtrlInfo.path);
|
---|
1405 | else{
|
---|
1406 | for(i2=0;i2<ProjectInfo.res.NumberOfBitmapRes;i2++){
|
---|
1407 | if(lstrcmp(pWindowInfo->pChildInfo[i].ImageCtrlInfo.path,
|
---|
1408 | ProjectInfo.res.pBitmapResInfo[i2].IdName)==0) break;
|
---|
1409 | }
|
---|
1410 | if(i2==ProjectInfo.res.NumberOfBitmapRes) goto NonBitmapImage;
|
---|
1411 |
|
---|
1412 | lstrcpy(temporary,ProjectInfo.res.pBitmapResInfo[i2].path);
|
---|
1413 | }
|
---|
1414 | GetFullPath(temporary,ProjectInfo.dir);
|
---|
1415 | hImage=LoadImage(NULL,temporary,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
|
---|
1416 | if(hImage){
|
---|
1417 | GetObject(hImage,sizeof(BITMAP),&Bitmap);
|
---|
1418 |
|
---|
1419 | pWindowInfo->pChildInfo[i].size.cx=Bitmap.bmWidth+(pWindowInfo->pChildInfo[i].size.cx-size.cx);
|
---|
1420 | pWindowInfo->pChildInfo[i].size.cy=Bitmap.bmHeight+(pWindowInfo->pChildInfo[i].size.cy-size.cy);
|
---|
1421 | pos=pWindowInfo->pChildInfo[i].pos;
|
---|
1422 | size=pWindowInfo->pChildInfo[i].size;
|
---|
1423 |
|
---|
1424 | //ExStyleによる縁を再描画
|
---|
1425 | DrawItemEdgeByExStyle(WndNum,pWindowInfo->pChildInfo[i].ExStyle,&pos,&size);
|
---|
1426 |
|
---|
1427 | memdc=CreateCompatibleDC(hdc);
|
---|
1428 | SelectObject(memdc,hImage);
|
---|
1429 | BitBlt(hdc,
|
---|
1430 | pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x,
|
---|
1431 | pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y,
|
---|
1432 | size.cx, size.cy,
|
---|
1433 | memdc, 0,0,
|
---|
1434 | SRCCOPY);
|
---|
1435 | DeleteDC(memdc);
|
---|
1436 | DeleteObject(hImage);
|
---|
1437 | }
|
---|
1438 | else{
|
---|
1439 | NonBitmapImage:
|
---|
1440 | DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(0,0,0),0,0);
|
---|
1441 | hOldFont=(HFONT)SelectObject(hdc,hFont);
|
---|
1442 | rect.left=pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1443 | rect.top=pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1444 | rect.right=pos.x+size.cx+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1445 | rect.bottom=pos.y+size.cy+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1446 | SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT));
|
---|
1447 | DrawText(hdc,"bmp...",-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
|
---|
1448 | SelectObject(hdc,hOldFont);
|
---|
1449 | }
|
---|
1450 | }
|
---|
1451 | }
|
---|
1452 |
|
---|
1453 | else if(pWindowInfo->pChildInfo[i].Control==CT_LISTBOX){
|
---|
1454 | /////////////////////////
|
---|
1455 | // ListBox コントロール
|
---|
1456 |
|
---|
1457 | //内部
|
---|
1458 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED)
|
---|
1459 | rgb=GetSysColor(COLOR_3DFACE);
|
---|
1460 | else rgb=GetSysColor(COLOR_WINDOW);
|
---|
1461 | DrawRectangleInClient(WndNum,
|
---|
1462 | pos.x,pos.y,
|
---|
1463 | pos.x+size.cx,pos.y+size.cy,
|
---|
1464 | rgb,rgb,1);
|
---|
1465 |
|
---|
1466 | if(pWindowInfo->pChildInfo[i].style&LBS_DISABLENOSCROLL)
|
---|
1467 | DrawWindowScrollBar(WndNum,pWindowInfo->pChildInfo[i].style|WS_DISABLED,&pos,&size);
|
---|
1468 | }
|
---|
1469 |
|
---|
1470 | else if(pWindowInfo->pChildInfo[i].Control==CT_LISTVIEW){
|
---|
1471 | //////////////////////////
|
---|
1472 | // ListView コントロール
|
---|
1473 |
|
---|
1474 | //内部
|
---|
1475 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED)
|
---|
1476 | rgb=GetSysColor(COLOR_3DFACE);
|
---|
1477 | else rgb=GetSysColor(COLOR_WINDOW);
|
---|
1478 | DrawRectangleInClient(WndNum,
|
---|
1479 | pos.x,pos.y,
|
---|
1480 | pos.x+size.cx,pos.y+size.cy,
|
---|
1481 | rgb,rgb,1);
|
---|
1482 |
|
---|
1483 | if((pWindowInfo->pChildInfo[i].style&LVS_REPORT)&&
|
---|
1484 | (!((pWindowInfo->pChildInfo[i].style&LVS_LIST)==LVS_LIST))){
|
---|
1485 | //レポート ビュー
|
---|
1486 | size.cy=16;
|
---|
1487 | DrawButtonEdge(WndNum,&pos,&size);
|
---|
1488 | }
|
---|
1489 | }
|
---|
1490 |
|
---|
1491 | else if(pWindowInfo->pChildInfo[i].Control==CT_PROGRESSBAR){
|
---|
1492 | /////////////////////////////
|
---|
1493 | // ProgressBar コントロール
|
---|
1494 |
|
---|
1495 | //内部
|
---|
1496 | pos.x++;
|
---|
1497 | pos.y++;
|
---|
1498 | size.cx-=2;
|
---|
1499 | size.cy-=2;
|
---|
1500 | rgb=GetSysColor(COLOR_ACTIVECAPTION);
|
---|
1501 | if(pWindowInfo->pChildInfo[i].style&PBS_SMOOTH){
|
---|
1502 | if(pWindowInfo->pChildInfo[i].style&PBS_VERTICAL){
|
---|
1503 | pos.y+=(long)((double)size.cy*0.3);
|
---|
1504 | DrawRectangleInClient(WndNum,
|
---|
1505 | pos.x,pos.y,
|
---|
1506 | pos.x+size.cx,pos.y+(long)((double)size.cy*0.7),
|
---|
1507 | rgb,rgb,1);
|
---|
1508 | }
|
---|
1509 | else{
|
---|
1510 | DrawRectangleInClient(WndNum,
|
---|
1511 | pos.x,pos.y,
|
---|
1512 | pos.x+(long)((double)size.cx*0.7),pos.y+size.cy,
|
---|
1513 | rgb,rgb,1);
|
---|
1514 | }
|
---|
1515 | }
|
---|
1516 | else{
|
---|
1517 | if(pWindowInfo->pChildInfo[i].style&PBS_VERTICAL){
|
---|
1518 | pos.y+=(long)((double)size.cy*0.3);
|
---|
1519 | i3=(size.cx*2)/3;
|
---|
1520 | i2=(int)((double)size.cy*0.7);
|
---|
1521 | for(;i2>i3;i2-=i3+2){
|
---|
1522 | DrawRectangleInClient(WndNum,
|
---|
1523 | pos.x,pos.y+i2-i3,
|
---|
1524 | pos.x+size.cx,pos.y+i2,
|
---|
1525 | rgb,rgb,1);
|
---|
1526 | }
|
---|
1527 | }
|
---|
1528 | else{
|
---|
1529 | i3=(size.cy*2)/3;
|
---|
1530 | i4=(int)((double)size.cx*0.7);
|
---|
1531 | for(i2=0;i2+i3<i4;i2+=i3+2){
|
---|
1532 | DrawRectangleInClient(WndNum,
|
---|
1533 | pos.x+i2,pos.y,
|
---|
1534 | pos.x+i2+i3,pos.y+size.cy,
|
---|
1535 | rgb,rgb,1);
|
---|
1536 | }
|
---|
1537 | }
|
---|
1538 | }
|
---|
1539 | }
|
---|
1540 |
|
---|
1541 | else if(pWindowInfo->pChildInfo[i].Control==CT_RADIOBUTTON){
|
---|
1542 | /////////////////////////////
|
---|
1543 | // RadioButton コントロール
|
---|
1544 |
|
---|
1545 | if(pWindowInfo->pChildInfo[i].style&BS_PUSHLIKE){
|
---|
1546 | //ボタンの縁を描画
|
---|
1547 | DrawButtonEdge(WndNum,&pos,&size);
|
---|
1548 | }
|
---|
1549 | else{
|
---|
1550 | //ラジオボタンを描画
|
---|
1551 | size2.cx=12;
|
---|
1552 | size2.cy=12;
|
---|
1553 | if(pWindowInfo->pChildInfo[i].style&BS_LEFTTEXT)
|
---|
1554 | pos2.x=pos.x+size.cx-size2.cx;
|
---|
1555 | else pos2.x=pos.x+1;
|
---|
1556 | if((pWindowInfo->pChildInfo[i].style&BS_VCENTER)==BS_VCENTER||
|
---|
1557 | (pWindowInfo->pChildInfo[i].style&BS_VCENTER)==0)
|
---|
1558 | pos2.y=pos.y+(size.cy/2)-(size2.cy/2);
|
---|
1559 | else if(pWindowInfo->pChildInfo[i].style&BS_TOP)
|
---|
1560 | pos2.y=pos.y+1;
|
---|
1561 | else if(pWindowInfo->pChildInfo[i].style&BS_BOTTOM)
|
---|
1562 | pos2.y=pos.y+size.cy-size2.cy-1;
|
---|
1563 |
|
---|
1564 | hResource=LoadResource(hResInst,FindResource(hResInst,MAKEINTRESOURCE(IDB_RADIOBUTTON),RT_BITMAP));
|
---|
1565 | pBitmapInfo=(BITMAPINFO *)LockResource(hResource);
|
---|
1566 | pByte=(BYTE *)pBitmapInfo+pBitmapInfo->bmiHeader.biSize;
|
---|
1567 | pByte2=(BYTE *)GlobalAlloc(GMEM_FIXED,pBitmapInfo->bmiHeader.biWidth*pBitmapInfo->bmiHeader.biHeight*3);
|
---|
1568 | for(i2=0,i3=0;i2<pBitmapInfo->bmiHeader.biWidth*pBitmapInfo->bmiHeader.biHeight;i2++,i3+=3){
|
---|
1569 | rgb=RGB(pByte[i3+2],pByte[i3+1],pByte[i3]);
|
---|
1570 |
|
---|
1571 | if(rgb==RGB(255,255,0)){
|
---|
1572 | if(pWindowInfo->bgColor==COLOR_3DFACE) rgb=GetSysColor(COLOR_3DFACE);
|
---|
1573 | else rgb=-pWindowInfo->bgColor;
|
---|
1574 | }
|
---|
1575 |
|
---|
1576 | //影側
|
---|
1577 | else if(rgb==RGB(0,0,0)) rgb=GetSysColor(COLOR_3DSHADOW);
|
---|
1578 | else if(rgb==RGB(255,0,0)) rgb=GetSysColor(COLOR_3DDKSHADOW);
|
---|
1579 |
|
---|
1580 | //光源側
|
---|
1581 | else if(rgb==RGB(0,0,255)) rgb=GetSysColor(COLOR_3DLIGHT);
|
---|
1582 | else if(rgb==RGB(0,255,0)) rgb=GetSysColor(COLOR_3DHIGHLIGHT);
|
---|
1583 |
|
---|
1584 | //内部
|
---|
1585 | else if(rgb==RGB(255,255,255)){
|
---|
1586 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED) rgb=GetSysColor(COLOR_3DFACE);
|
---|
1587 | }
|
---|
1588 |
|
---|
1589 | pByte2[i3+2]=LOBYTE(LOWORD(rgb));
|
---|
1590 | pByte2[i3+1]=HIBYTE(LOWORD(rgb));
|
---|
1591 | pByte2[i3]=LOBYTE(HIWORD(rgb));
|
---|
1592 | }
|
---|
1593 | SetDIBitsToDevice(hdc,
|
---|
1594 | pos2.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x,
|
---|
1595 | pos2.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y,
|
---|
1596 | pBitmapInfo->bmiHeader.biWidth, pBitmapInfo->bmiHeader.biHeight,
|
---|
1597 | 0,0,
|
---|
1598 | 0,pBitmapInfo->bmiHeader.biHeight,
|
---|
1599 | pByte2,
|
---|
1600 | pBitmapInfo,
|
---|
1601 | DIB_RGB_COLORS);
|
---|
1602 | GlobalFree(pByte2);
|
---|
1603 |
|
---|
1604 | if(!(pWindowInfo->pChildInfo[i].style&BS_LEFTTEXT)) pos.x+=17;
|
---|
1605 | else pos.x++;
|
---|
1606 | size.cx-=17;
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 | if(!(pWindowInfo->pChildInfo[i].style&(BS_ICON|BS_BITMAP))){
|
---|
1610 | //キャプション テキスト
|
---|
1611 | rect.left=pos.x+1+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1612 | rect.top=pos.y+1+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1613 | rect.right=pos.x+size.cx-2+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1614 | rect.bottom=pos.y+size.cy-2+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1615 |
|
---|
1616 | if(pWindowInfo->pChildInfo[i].style&BS_MULTILINE) i4=0;
|
---|
1617 | else i4=DT_SINGLELINE;
|
---|
1618 |
|
---|
1619 | //ビットを考慮してBS_CENTERを最初に比較する
|
---|
1620 | if((pWindowInfo->pChildInfo[i].style&BS_CENTER)==BS_CENTER) i2=DT_CENTER;
|
---|
1621 | else if(pWindowInfo->pChildInfo[i].style&BS_LEFT) i2=DT_LEFT;
|
---|
1622 | else if(pWindowInfo->pChildInfo[i].style&BS_RIGHT) i2=DT_RIGHT;
|
---|
1623 | else i2=DT_LEFT;
|
---|
1624 |
|
---|
1625 | //ビットを考慮してBS_VCENTERを最初に比較する
|
---|
1626 | if((pWindowInfo->pChildInfo[i].style&BS_VCENTER)==BS_VCENTER) i3=DT_VCENTER;
|
---|
1627 | else if(pWindowInfo->pChildInfo[i].style&BS_TOP) i3=DT_TOP;
|
---|
1628 | else if(pWindowInfo->pChildInfo[i].style&BS_BOTTOM) i3=DT_BOTTOM;
|
---|
1629 | else i3=DT_VCENTER;
|
---|
1630 |
|
---|
1631 | hOldFont=(HFONT)SelectObject(hdc,hFont);
|
---|
1632 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED){
|
---|
1633 | SetTextColor(hdc,RGB(255,255,255));
|
---|
1634 | rc2.left=rect.left+1;
|
---|
1635 | rc2.top=rect.top+1;
|
---|
1636 | rc2.right=rect.right+1;
|
---|
1637 | rc2.bottom=rect.bottom+1;
|
---|
1638 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rc2,i4|i2|i3);
|
---|
1639 | SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT));
|
---|
1640 | }
|
---|
1641 | else SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT));
|
---|
1642 |
|
---|
1643 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rect,i4|i2|i3);
|
---|
1644 | SelectObject(hdc,hOldFont);
|
---|
1645 | }
|
---|
1646 | }
|
---|
1647 |
|
---|
1648 | else if(pWindowInfo->pChildInfo[i].Control==CT_STATIC){
|
---|
1649 | ////////////////////////
|
---|
1650 | // Static コントロール
|
---|
1651 |
|
---|
1652 | //キャプション テキスト
|
---|
1653 | rect.left=pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1654 | rect.top=pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1655 | rect.right=pos.x+size.cx+MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
|
---|
1656 | rect.bottom=pos.y+size.cy+MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
|
---|
1657 |
|
---|
1658 | //ビットを考慮してSS_LEFTを最後に検討する
|
---|
1659 | if(pWindowInfo->pChildInfo[i].style&SS_CENTER) i2=DT_CENTER;
|
---|
1660 | else if(pWindowInfo->pChildInfo[i].style&SS_RIGHT) i2=DT_RIGHT;
|
---|
1661 | else i2=DT_LEFT;
|
---|
1662 |
|
---|
1663 | hOldFont=(HFONT)SelectObject(hdc,hFont);
|
---|
1664 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED){
|
---|
1665 | SetTextColor(hdc,RGB(255,255,255));
|
---|
1666 | rc2.left=rect.left+1;
|
---|
1667 | rc2.top=rect.top+1;
|
---|
1668 | rc2.right=rect.right+1;
|
---|
1669 | rc2.bottom=rect.bottom+1;
|
---|
1670 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rc2,i2);
|
---|
1671 | SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT));
|
---|
1672 | }
|
---|
1673 | else
|
---|
1674 | SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT));
|
---|
1675 |
|
---|
1676 | //折り返すかどうか
|
---|
1677 | if(!(pWindowInfo->pChildInfo[i].style&SS_LEFTNOWORDWRAP)){
|
---|
1678 | i2|=DT_WORDBREAK;
|
---|
1679 | }
|
---|
1680 |
|
---|
1681 | DrawText(hdc,pWindowInfo->pChildInfo[i].caption,-1,&rect,i2);
|
---|
1682 | SelectObject(hdc,hOldFont);
|
---|
1683 | }
|
---|
1684 |
|
---|
1685 | else if(pWindowInfo->pChildInfo[i].Control==CT_TRACKBAR){
|
---|
1686 | //////////////////////////
|
---|
1687 | // TrackBar コントロール
|
---|
1688 |
|
---|
1689 | if(pWindowInfo->pChildInfo[i].style&TBS_VERT){
|
---|
1690 | pos.x+=2;
|
---|
1691 | size.cx-=2;
|
---|
1692 | if(size.cx>21) size.cx=21;
|
---|
1693 | pos.y+=8;
|
---|
1694 | size.cy-=16;
|
---|
1695 |
|
---|
1696 | rect.left=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+pos.x+(size.cx/2)-2;
|
---|
1697 | rect.right=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+pos.x+(size.cx/2)+2;
|
---|
1698 | rect.top=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+pos.y;
|
---|
1699 | rect.bottom=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+pos.y+size.cy;
|
---|
1700 | DrawEdge(hdc,&rect,EDGE_SUNKEN,BF_RECT);
|
---|
1701 |
|
---|
1702 | size.cy=size.cx/2;
|
---|
1703 | DrawButtonEdge(WndNum,&pos,&size);
|
---|
1704 | }
|
---|
1705 | else{
|
---|
1706 | pos.x+=8;
|
---|
1707 | size.cx-=16;
|
---|
1708 | pos.y+=2;
|
---|
1709 | size.cy-=2;
|
---|
1710 | if(size.cy>21) size.cy=21;
|
---|
1711 |
|
---|
1712 | rect.left=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+pos.x;
|
---|
1713 | rect.right=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+pos.x+size.cx;
|
---|
1714 | rect.top=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+pos.y+(size.cy/2)-2;
|
---|
1715 | rect.bottom=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+pos.y+(size.cy/2)+2;
|
---|
1716 | DrawEdge(hdc,&rect,EDGE_SUNKEN,BF_RECT);
|
---|
1717 |
|
---|
1718 | size.cx=size.cy/2;
|
---|
1719 | DrawButtonEdge(WndNum,&pos,&size);
|
---|
1720 | }
|
---|
1721 | }
|
---|
1722 |
|
---|
1723 | else if(pWindowInfo->pChildInfo[i].Control==CT_TREEVIEW){
|
---|
1724 | //////////////////////////
|
---|
1725 | // TreeView コントロール
|
---|
1726 |
|
---|
1727 | //内部
|
---|
1728 | if(pWindowInfo->pChildInfo[i].style&WS_DISABLED)
|
---|
1729 | rgb=GetSysColor(COLOR_3DFACE);
|
---|
1730 | else rgb=GetSysColor(COLOR_WINDOW);
|
---|
1731 | DrawRectangleInClient(WndNum,
|
---|
1732 | pos.x,pos.y,
|
---|
1733 | pos.x+size.cx,pos.y+size.cy,
|
---|
1734 | rgb,rgb,1);
|
---|
1735 | }
|
---|
1736 |
|
---|
1737 | else if(pWindowInfo->pChildInfo[i].Control==CT_UPDOWN){
|
---|
1738 | ///////////////////////////////
|
---|
1739 | // アップ ダウン コントロール
|
---|
1740 | if(pWindowInfo->pChildInfo[i].style&UDS_HORZ)
|
---|
1741 | DrawUpDownControl(WndNum,pWindowInfo->pChildInfo[i].style,0,&pos,&size);
|
---|
1742 | else DrawUpDownControl(WndNum,pWindowInfo->pChildInfo[i].style,1,&pos,&size);
|
---|
1743 | }
|
---|
1744 |
|
---|
1745 | else if(pWindowInfo->pChildInfo[i].Control==CT_VSCROLLBAR){
|
---|
1746 | ////////////////////////////////////
|
---|
1747 | // 垂直スクロールバー コントロール
|
---|
1748 | DrawScrollBar(WndNum,pWindowInfo->pChildInfo[i].style,1,&pos,&size);
|
---|
1749 | }
|
---|
1750 | }
|
---|
1751 | DeleteObject(hFont);
|
---|
1752 | }
|
---|
1753 | void DrawRadWindow(int WndNum,WINDOW_INFO *pWindowInfo){
|
---|
1754 | extern MDIINFO MdiInfo[MAX_WNDNUM];
|
---|
1755 | HBRUSH hOldBrush;
|
---|
1756 | POINT pos;
|
---|
1757 |
|
---|
1758 | SetBkMode(MdiInfo[WndNum].MdiRadInfo->hMemDC,TRANSPARENT);
|
---|
1759 |
|
---|
1760 | hOldBrush=(HBRUSH)SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,GetStockObject(WHITE_BRUSH));
|
---|
1761 | PatBlt(MdiInfo[WndNum].MdiRadInfo->hMemDC,0,0,ScreenX*2,ScreenY*2,PATCOPY);
|
---|
1762 | SelectObject(MdiInfo[WndNum].MdiRadInfo->hMemDC,hOldBrush);
|
---|
1763 |
|
---|
1764 | pos.x=LEVER_THICK;
|
---|
1765 | pos.y=LEVER_THICK;
|
---|
1766 | DesigningWindow(WndNum,MdiInfo[WndNum].MdiRadInfo->hMemDC,&pos,pWindowInfo);
|
---|
1767 |
|
---|
1768 | InvalidateRect(MdiInfo[WndNum].MdiRadInfo->hRad,NULL,0);
|
---|
1769 | }
|
---|