#include "stdafx.h" #include "Common.h" void DrawLineInClient(int WndNum,long StartX,long StartY,long EndX,long EndY){ MoveToEx(MdiInfo[WndNum]->MdiRadInfo->hMemDC, StartX+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x, StartY+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y, NULL); LineTo(MdiInfo[WndNum]->MdiRadInfo->hMemDC, EndX+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x, EndY+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y); } void DrawRectangleInClient(int WndNum,long left,long top,long right,long bottom,COLORREF RGB_Pen,COLORREF RGB_Brush,BOOL bBrushing){ HPEN hPen,hOldPen; HBRUSH hBrush,hOldBrush; hPen=CreatePen(PS_SOLID,0,RGB_Pen); if(bBrushing) hBrush=CreateSolidBrush(RGB_Brush); else hBrush=(HBRUSH)GetStockObject(NULL_BRUSH); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); hOldBrush=(HBRUSH)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hBrush); Rectangle(MdiInfo[WndNum]->MdiRadInfo->hMemDC, left+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x, top+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y, right+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x, bottom+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y); SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldBrush); DeleteObject(hPen); if(bBrushing) DeleteObject(hBrush); } void DrawButtonEdge(int WndNum,POINT *pPos,SIZE *pSize){ HPEN hPen,hOldPen; //光源方向の縁 hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); DrawLineInClient(WndNum, pPos->x, pPos->y, pPos->x+pSize->cx-1, pPos->y); DrawLineInClient(WndNum, pPos->x, pPos->y, pPos->x, pPos->y+pSize->cy-1); SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); //影側の縁 hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DDKSHADOW)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); DrawLineInClient(WndNum, pPos->x, pPos->y+pSize->cy-1, pPos->x+pSize->cx, pPos->y+pSize->cy-1); DrawLineInClient(WndNum, pPos->x+pSize->cx-1, pPos->y, pPos->x+pSize->cx-1, pPos->y+pSize->cy-1); SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DSHADOW)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); DrawLineInClient(WndNum, pPos->x+1, pPos->y+pSize->cy-2, pPos->x+pSize->cx-1, pPos->y+pSize->cy-2); DrawLineInClient(WndNum, pPos->x+pSize->cx-2, pPos->y+1, pPos->x+pSize->cx-2, pPos->y+pSize->cy-2); SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); //内部 DrawRectangleInClient(WndNum, pPos->x+1,pPos->y+1, pPos->x+pSize->cx-2,pPos->y+pSize->cy-2, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); pPos->x+=3; pPos->y+=2; pSize->cx-=5; pSize->cy-=4; } void DrawItemEdgeByExStyle(int WndNum,int ExStyle,POINT *pPos,SIZE *pSize){ HPEN hPen,hOldPen; RECT rect; if(ExStyle&WS_EX_DLGMODALFRAME){ /////////////////////////// //モーダル フレーム境界線 rect.left=pPos->x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pPos->y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pPos->x+pSize->cx+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pPos->y+pSize->cy+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; DrawEdge(MdiInfo[WndNum]->MdiRadInfo->hMemDC,&rect,EDGE_RAISED,BF_RECT); pPos->x+=2; pPos->y+=2; pSize->cx-=4; pSize->cy-=4; //細枠 DrawRectangleInClient(WndNum, pPos->x,pPos->y, pPos->x+pSize->cx,pPos->y+pSize->cy, GetSysColor(COLOR_ACTIVEBORDER),0,0); pPos->x+=1; pPos->y+=1; pSize->cx-=2; pSize->cy-=2; } else if(ExStyle&WS_EX_STATICEDGE){ ////////////////////// //スタティック境界線 //影側の色 hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DSHADOW)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); DrawLineInClient(WndNum, pPos->x, pPos->y, pPos->x, pPos->y+pSize->cy-1); DrawLineInClient(WndNum, pPos->x, pPos->y, pPos->x+pSize->cx-1, pPos->y); SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); //光源方向の縁 hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); DrawLineInClient(WndNum, pPos->x, pPos->y+pSize->cy-1, pPos->x+pSize->cx-1, pPos->y+pSize->cy-1); DrawLineInClient(WndNum, pPos->x+pSize->cx-1, pPos->y, pPos->x+pSize->cx-1, pPos->y+pSize->cy); SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); pPos->x+=1; pPos->y+=1; pSize->cx-=2; pSize->cy-=2; } if(ExStyle&WS_EX_CLIENTEDGE){ ////////////////////// //クライアント境界線 rect.left=pPos->x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pPos->y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pPos->x+pSize->cx+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pPos->y+pSize->cy+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; DrawEdge(MdiInfo[WndNum]->MdiRadInfo->hMemDC,&rect,EDGE_SUNKEN,BF_RECT); pPos->x+=2; pPos->y+=2; pSize->cx-=4; pSize->cy-=4; } } void DrawScrollBar(int WndNum,DWORD style,BOOL bSwitch,POINT *pPos,SIZE *pSize){ int i,i2; HPEN hPen,hOldPen; COLORREF rgb; POINT pos; SIZE size; if(bSwitch==0){ //水平スクロールバー //左ボタン if(pSize->cx>16*2){ pos=*pPos; size.cx=16; size.cy=pSize->cy; } else{ pos=*pPos; size.cx=pSize->cx/2; size.cy=pSize->cy; } DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); if(style&WS_DISABLED){ hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); pos.x++; pos.y++; i2=pos.y+(size.cy/2); for(i=0;i<4;i++,i2--){ DrawLineInClient(WndNum,i+pos.x+2,i2,i+pos.x+2,i2+(i*2)+1); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); rgb=GetSysColor(COLOR_GRAYTEXT); pos.x--; pos.y--; } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); i2=pos.y+(size.cy/2); for(i=0;i<4;i++,i2--){ DrawLineInClient(WndNum,i+pos.x+2,i2,i+pos.x+2,i2+(i*2)+1); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); //右ボタン if(pSize->cx>16*2){ pos.x=pPos->x+pSize->cx-16; pos.y=pPos->y; size.cx=16; size.cy=pSize->cy; } else{ pos.x=pPos->x+pSize->cx/2+pSize->cx%2; pos.y=pPos->y; size.cx=pSize->cx/2; size.cy=pSize->cy; } DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); if(style&WS_DISABLED){ hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); pos.x++; pos.y++; i2=pos.y+(size.cy/2); for(i=3;i>=0;i--,i2--){ DrawLineInClient(WndNum,i+pos.x+3,i2,i+pos.x+3,i2+((3-i)*2)+1); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); rgb=GetSysColor(COLOR_GRAYTEXT); pos.x--; pos.y--; } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); i2=pos.y+(size.cy/2); for(i=3;i>=0;i--,i2--){ DrawLineInClient(WndNum,i+pos.x+3,i2,i+pos.x+3,i2+((3-i)*2)+1); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); if(pSize->cx>16*3){ if(!(style&WS_DISABLED)){ pos.x=pPos->x+16; pos.y=pPos->y; size.cx=16; size.cy=pSize->cy; DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); pos.x=pPos->x+16*2; pos.y=pPos->y; size.cx=pSize->cx-16*3; size.cy=pSize->cy; } else{ pos.x=pPos->x+16; pos.y=pPos->y; size.cx=pSize->cx-16*2; size.cy=pSize->cy; } } else if(pSize->cx>16*2){ pos.x=pPos->x+16; pos.y=pPos->y; size.cx=pSize->cx-16*2; size.cy=pSize->cy; } else{ pos.x=pPos->x+pSize->cx/2; pos.y=pPos->y; size.cx=pSize->cx%2; size.cy=pSize->cy; } } else{ //垂直スクロールバー //上ボタン if(pSize->cy>16*2){ pos=*pPos; size.cy=16; size.cx=pSize->cx; } else{ pos=*pPos; size.cy=pSize->cy/2; size.cx=pSize->cx; } DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); pos.y++; if(style&WS_DISABLED){ hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); pos.x++; pos.y++; i2=pos.x+(size.cx/2)-1; for(i=0;i<4;i++,i2--){ DrawLineInClient(WndNum,i2,i+pos.y+2,i2+(i*2)+1,i+pos.y+2); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); rgb=GetSysColor(COLOR_GRAYTEXT); pos.x--; pos.y--; } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); i2=pos.x+(size.cx/2)-1; for(i=0;i<4;i++,i2--){ DrawLineInClient(WndNum,i2,i+pos.y+2,i2+(i*2)+1,i+pos.y+2); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); //下ボタン if(pSize->cy>16*2){ pos.x=pPos->x; pos.y=pPos->y+pSize->cy-16; size.cx=pSize->cx; size.cy=16; } else{ pos.x=pPos->x; pos.y=pPos->y+pSize->cy/2+pSize->cy%2; size.cx=pSize->cx; size.cy=pSize->cy/2; } DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); pos.x--; if(style&WS_DISABLED){ hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); pos.x++; pos.y++; i2=pos.x+(size.cx/2); for(i=3;i>=0;i--,i2--){ DrawLineInClient(WndNum,i2,i+pos.y+3,i2+((3-i)*2)+1,i+pos.y+3); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); rgb=GetSysColor(COLOR_GRAYTEXT); pos.x--; pos.y--; } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); i2=pos.x+(size.cx/2); for(i=3;i>=0;i--,i2--){ DrawLineInClient(WndNum,i2,i+pos.y+3,i2+((3-i)*2)+1,i+pos.y+3); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); if(pSize->cy>16*3){ if(!(style&WS_DISABLED)){ pos.x=pPos->x; pos.y=pPos->y+16; size.cx=pSize->cx; size.cy=16; DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); pos.x=pPos->x; pos.y=pPos->y+16*2; size.cx=pSize->cx; size.cy=pSize->cy-16*3; } else{ pos.x=pPos->x; pos.y=pPos->y+16; size.cx=pSize->cx; size.cy=pSize->cy-16*2; } } else if(pSize->cy>16*2){ pos.x=pPos->x; pos.y=pPos->y+16; size.cx=pSize->cx; size.cy=pSize->cy-16*2; } else{ pos.x=pPos->x; pos.y=pPos->y+pSize->cy/2; size.cx=pSize->cx; size.cy=pSize->cy%2; } } if(size.cx){ int x,y; HBITMAP hBitmap; BITMAPINFO BitmapInfo; BYTE *pByte; memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER)); BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); BitmapInfo.bmiHeader.biWidth=size.cx; BitmapInfo.bmiHeader.biHeight=size.cy; BitmapInfo.bmiHeader.biPlanes=1; BitmapInfo.bmiHeader.biBitCount=24; hBitmap=CreateDIBSection(MdiInfo[WndNum]->MdiRadInfo->hMemDC,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0); i=BitmapInfo.bmiHeader.biWidth*3; if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG)); for(y=0;yMdiRadInfo->hMemDC, pos.x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x, pos.y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y, BitmapInfo.bmiHeader.biWidth, BitmapInfo.bmiHeader.biHeight, 0,0, 0,BitmapInfo.bmiHeader.biHeight, pByte, &BitmapInfo, DIB_RGB_COLORS); DeleteObject(hBitmap); } } void DrawUpDownControl(int WndNum,DWORD style,BOOL bSwitch,POINT *pPos,SIZE *pSize){ int i,i2; HPEN hPen,hOldPen; COLORREF rgb; POINT pos; SIZE size; if(bSwitch==0){ //水平 //左ボタン pos=*pPos; size.cx=pSize->cx/2; size.cy=pSize->cy; DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); if(style&WS_DISABLED){ hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); pos.x++; pos.y++; i2=pos.y+(size.cy/2); for(i=0;i<4;i++,i2--){ DrawLineInClient(WndNum,i+pos.x+2,i2,i+pos.x+2,i2+(i*2)+1); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); rgb=GetSysColor(COLOR_GRAYTEXT); pos.x--; pos.y--; } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); i2=pos.y+(size.cy/2); for(i=0;i<4;i++,i2--){ DrawLineInClient(WndNum,i+pos.x+2,i2,i+pos.x+2,i2+(i*2)+1); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); //右ボタン pos.x=pPos->x+pSize->cx/2+pSize->cx%2; pos.y=pPos->y; size.cx=pSize->cx/2; size.cy=pSize->cy; DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); if(style&WS_DISABLED){ hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); pos.x++; pos.y++; i2=pos.y+(size.cy/2); for(i=3;i>=0;i--,i2--){ DrawLineInClient(WndNum,i+pos.x+3,i2,i+pos.x+3,i2+((3-i)*2)+1); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); rgb=GetSysColor(COLOR_GRAYTEXT); pos.x--; pos.y--; } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); i2=pos.y+(size.cy/2); for(i=3;i>=0;i--,i2--){ DrawLineInClient(WndNum,i+pos.x+3,i2,i+pos.x+3,i2+((3-i)*2)+1); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); } else{ //垂直 //上ボタン pos=*pPos; size.cy=pSize->cy/2; size.cx=pSize->cx; DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); pos.y++; if(style&WS_DISABLED){ hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); pos.x++; pos.y++; i2=pos.x+(size.cx/2)-1; for(i=0;i<4;i++,i2--){ DrawLineInClient(WndNum,i2,i+pos.y+2,i2+(i*2)+1,i+pos.y+2); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); rgb=GetSysColor(COLOR_GRAYTEXT); pos.x--; pos.y--; } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); i2=pos.x+(size.cx/2)-1; for(i=0;i<4;i++,i2--){ DrawLineInClient(WndNum,i2,i+pos.y+2,i2+(i*2)+1,i+pos.y+2); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); //下ボタン pos.x=pPos->x; pos.y=pPos->y+pSize->cy/2+pSize->cy%2; size.cx=pSize->cx; size.cy=pSize->cy/2; DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos,&size); //内部 DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); pos.x--; if(style&WS_DISABLED){ hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); pos.x++; pos.y++; i2=pos.x+(size.cx/2); for(i=3;i>=0;i--,i2--){ DrawLineInClient(WndNum,i2,i+pos.y+3,i2+((3-i)*2)+1,i+pos.y+3); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); rgb=GetSysColor(COLOR_GRAYTEXT); pos.x--; pos.y--; } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hPen); i2=pos.x+(size.cx/2); for(i=3;i>=0;i--,i2--){ DrawLineInClient(WndNum,i2,i+pos.y+3,i2+((3-i)*2)+1,i+pos.y+3); } SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldPen); DeleteObject(hPen); } } void DrawWindowScrollBar(int WndNum,DWORD style,POINT *pPos,SIZE *pSize){ POINT pos; SIZE size; if(style&WS_HSCROLL){ pos.x=pPos->x; pos.y=pPos->y+pSize->cy-GetSystemMetrics(SM_CYVSCROLL); if(style&WS_VSCROLL) size.cx=pSize->cx-GetSystemMetrics(SM_CXVSCROLL); else size.cx=pSize->cx; size.cy=GetSystemMetrics(SM_CYVSCROLL); DrawScrollBar(WndNum,style,0,&pos,&size); } if(style&WS_VSCROLL){ pos.x=pPos->x+pSize->cx-GetSystemMetrics(SM_CXHSCROLL); pos.y=pPos->y; size.cx=GetSystemMetrics(SM_CXHSCROLL); if(style&WS_HSCROLL) size.cy=pSize->cy-GetSystemMetrics(SM_CYHSCROLL); else size.cy=pSize->cy; DrawScrollBar(WndNum,style,1,&pos,&size); } } void DrawOEMImage(HDC hdc,POINT *pPos,SIZE *pSize,DWORD dwImage){ HBITMAP hBmp,hOldBmp; HDC memdc; //未完成(XPのみに対応?) memdc=CreateCompatibleDC(hdc); hBmp=LoadBitmap(NULL,(LPSTR)dwImage); hOldBmp=(HBITMAP)SelectObject(memdc,hBmp); BitBlt(hdc,pPos->x,pPos->y,pSize->cx,pSize->cy,memdc,0,0,SRCCOPY); SelectObject(memdc,hOldBmp); DeleteDC(memdc); DeleteObject(hBmp); } void DesigningWindow(int WndNum,HDC hdc,POINT *pBasePos,const ActiveBasic::PM::WindowInfo *pWindowInfo){ int i,i2,i3,i4; double red,green,blue,d_red,d_green,d_blue; char temporary[MAX_PATH]; COLORREF rgb; HPEN hPen,hOldPen; HBRUSH hBrush,hOldBrush; HFONT hFont,hOldFont; HANDLE hImage; RECT InsideRect,rect,rc2; POINT pos,pos2; SIZE size,size2; HGLOBAL hResource; BITMAPINFO *pBitmapInfo; BYTE *pByte,*pByte2; //////////////////////// //ウィンドウの縁を描画 InsideRect.left=pBasePos->x; InsideRect.top=pBasePos->y; InsideRect.right=InsideRect.left+pWindowInfo->size.cx; InsideRect.bottom=InsideRect.top+pWindowInfo->size.cy; if(pWindowInfo->GetStyle()&(WS_BORDER|WS_THICKFRAME)){ DrawEdge(hdc,&InsideRect,EDGE_RAISED,BF_RECT); InsideRect.left+=2; InsideRect.top+=2; InsideRect.right-=2; InsideRect.bottom-=2; } //////////// //枠を描画 if(pWindowInfo->GetStyle()&(WS_BORDER|WS_THICKFRAME)){ //細枠 hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_ACTIVEBORDER)); hBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE)); hOldPen=(HPEN)SelectObject(hdc,hPen); hOldBrush=(HBRUSH)SelectObject(hdc,hBrush); Rectangle(hdc,InsideRect.left,InsideRect.top,InsideRect.right,InsideRect.bottom); InsideRect.left+=1; InsideRect.top+=1; InsideRect.right-=1; InsideRect.bottom-=1; //サイズ変更枠 if(pWindowInfo->GetStyle()&WS_THICKFRAME){ Rectangle(hdc,InsideRect.left,InsideRect.top,InsideRect.right,InsideRect.bottom); InsideRect.left+=1; InsideRect.top+=1; InsideRect.right-=1; InsideRect.bottom-=1; } SelectObject(hdc,hOldPen); SelectObject(hdc,hOldBrush); DeleteObject(hPen); DeleteObject(hBrush); } //Draw...InClient関数のため MdiInfo[WndNum]->MdiRadInfo->ClientPos.x=0; MdiInfo[WndNum]->MdiRadInfo->ClientPos.y=0; if(pWindowInfo->GetStyle()&(WS_CAPTION&(~WS_BORDER))){ ////////////////////// //タイトルバーを描画 //背景を描画(グラデーション可) i=GetSysColor(COLOR_ACTIVECAPTION); OSVERSIONINFO OsVersionInfo; OsVersionInfo.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(&OsVersionInfo); if((OsVersionInfo.dwPlatformId==VER_PLATFORM_WIN32_NT&&OsVersionInfo.dwMajorVersion>=5)|| (OsVersionInfo.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS&&LOWORD(OsVersionInfo.dwBuildNumber)>=1998)){ #define COLOR_GRADIENTACTIVECAPTION 27 i2=GetSysColor(COLOR_GRADIENTACTIVECAPTION); } else i2=i; if(pWindowInfo->GetExStyle()&WS_EX_TOOLWINDOW) i3=GetSystemMetrics(SM_CYSMCAPTION); else i3=GetSystemMetrics(SM_CYCAPTION); d_red=((double)((i2&0xFF)-(i&0xFF)))/(double)(InsideRect.right-InsideRect.left); d_green=((double)(((i2>>8)&0xFF))-((i>>8)&0xFF))/(double)(InsideRect.right-InsideRect.left); d_blue=((double)(((i2>>16)&0xFF))-((i>>16)&0xFF))/(double)(InsideRect.right-InsideRect.left); red=(double)(i&0xFF); green=(double)((i>>8)&0xFF); blue=(double)((i>>16)&0xFF); for(i4=InsideRect.left;i4GetCaption().c_str(),pWindowInfo->GetCaption().size(),&rect,DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX); SelectObject(hdc,hOldFont); DeleteObject(hFont); //ボタン if(pWindowInfo->GetStyle()&WS_SYSMENU){ //終了ボタン size.cx=GetSystemMetrics(SM_CXSIZE)-2; size.cy=GetSystemMetrics(SM_CYSIZE)-4; pos.x=InsideRect.right-2-size.cx; pos.y=InsideRect.top+2; DrawButtonEdge(WndNum,&pos,&size); hResource=LoadResource(hResInst,FindResource(hResInst,MAKEINTRESOURCE(IDB_TITLE_BUTTON_CLOSE),RT_BITMAP)); pBitmapInfo=(BITMAPINFO *)LockResource(hResource); pByte=(BYTE *)pBitmapInfo+pBitmapInfo->bmiHeader.biSize; i2=pBitmapInfo->bmiHeader.biWidth*3; if(i2%sizeof(LONG)!=0) i2+=sizeof(LONG)-(i2%sizeof(LONG)); pByte2=(BYTE *)GlobalAlloc(GMEM_FIXED,pBitmapInfo->bmiHeader.biHeight*i2); int x,y; for(y=0;ybmiHeader.biHeight;y++){ if(y%2==0) rgb=GetSysColor(COLOR_3DFACE); else rgb=RGB(255,255,255); for(x=0;xbmiHeader.biWidth;x++){ i4=y*i2+x*3; rgb=RGB(pByte[i4+2],pByte[i4+1],pByte[i4]); if(rgb==RGB(0,0,0)){ rgb=GetSysColor(COLOR_BTNTEXT); pByte2[i4+2]=LOBYTE(LOWORD(rgb)); pByte2[i4+1]=HIBYTE(LOWORD(rgb)); pByte2[i4]=LOBYTE(HIWORD(rgb)); } else if(rgb==RGB(255,255,255)){ rgb=GetSysColor(COLOR_3DFACE); pByte2[i4+2]=LOBYTE(LOWORD(rgb)); pByte2[i4+1]=HIBYTE(LOWORD(rgb)); pByte2[i4]=LOBYTE(HIWORD(rgb)); } } } SetStretchBltMode(hdc,COLORONCOLOR); StretchDIBits(hdc, pos.x+(int)((double)size.cx*0.17), pos.y+(int)((double)size.cy*0.17), (int)((double)size.cx*0.65)+1, (int)((double)size.cy*0.65)+1, 0,0, pBitmapInfo->bmiHeader.biWidth,pBitmapInfo->bmiHeader.biHeight, pByte2, pBitmapInfo, DIB_RGB_COLORS,SRCCOPY); GlobalFree(pByte2); if(pWindowInfo->GetStyle()&WS_MAXIMIZEBOX||pWindowInfo->GetStyle()&WS_MINIMIZEBOX){ //最大化ボタン size.cx=GetSystemMetrics(SM_CXSIZE)-2; size.cy=GetSystemMetrics(SM_CYSIZE)-4; pos.x=InsideRect.right-size.cx*2-4; pos.y=InsideRect.top+2; DrawButtonEdge(WndNum,&pos,&size); if(!(pWindowInfo->GetStyle()&WS_MAXIMIZEBOX)){ pos.x++; pos.y++; hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(hdc,hPen); hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(NULL_BRUSH)); Rectangle(hdc,pos.x,pos.y,pos.x+size.cx-2,pos.y+size.cy-1); MoveToEx(hdc,pos.x,pos.y+1,NULL); LineTo(hdc,pos.x+size.cx-2,pos.y+1); SelectObject(hdc,hOldPen); SelectObject(hdc,hOldBrush); DeleteObject(hPen); pos.x--; pos.y--; rgb=GetSysColor(COLOR_GRAYTEXT); } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(hdc,hPen); hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(NULL_BRUSH)); Rectangle(hdc,pos.x,pos.y,pos.x+size.cx-2,pos.y+size.cy-1); MoveToEx(hdc,pos.x,pos.y+1,NULL); LineTo(hdc,pos.x+size.cx-2,pos.y+1); SelectObject(hdc,hOldPen); SelectObject(hdc,hOldBrush); DeleteObject(hPen); //最小化ボタン size.cx=GetSystemMetrics(SM_CXSIZE)-2; size.cy=GetSystemMetrics(SM_CYSIZE)-4; pos.x=InsideRect.right-size.cx*3-4; pos.y=InsideRect.top+2; DrawButtonEdge(WndNum,&pos,&size); if(!(pWindowInfo->GetStyle()&WS_MINIMIZEBOX)){ pos.x++; pos.y++; hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(hdc,hPen); MoveToEx(hdc,pos.x+1,pos.y+size.cy-2,NULL); LineTo(hdc,pos.x+size.cy-3,pos.y+size.cy-2); MoveToEx(hdc,pos.x+1,pos.y+size.cy-3,NULL); LineTo(hdc,pos.x+size.cy-3,pos.y+size.cy-3); SelectObject(hdc,hOldPen); DeleteObject(hPen); pos.x--; pos.y--; rgb=GetSysColor(COLOR_GRAYTEXT); } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(hdc,hPen); MoveToEx(hdc,pos.x+1,pos.y+size.cy-2,NULL); LineTo(hdc,pos.x+size.cy-3,pos.y+size.cy-2); MoveToEx(hdc,pos.x+1,pos.y+size.cy-3,NULL); LineTo(hdc,pos.x+size.cy-3,pos.y+size.cy-3); SelectObject(hdc,hOldPen); DeleteObject(hPen); } } InsideRect.top+=i3; } if( pWindowInfo->HasMenu() ) { //メニューラインを3DFACEで描画 rgb=GetSysColor(COLOR_3DFACE); i=GetSystemMetrics(SM_CYMENU); hPen=CreatePen(PS_SOLID,0,rgb); hBrush=CreateSolidBrush(rgb); hOldPen=(HPEN)SelectObject(hdc,hPen); hOldBrush=(HBRUSH)SelectObject(hdc,hBrush); Rectangle(hdc, InsideRect.left,InsideRect.top-1,InsideRect.right,InsideRect.top+i); SelectObject(hdc,hOldPen); SelectObject(hdc,hOldBrush); DeleteObject(hPen); DeleteObject(hBrush); InsideRect.top+=i; } //クライアント左上ポジションを設定 MdiInfo[WndNum]->MdiRadInfo->ClientPos.x=InsideRect.left; MdiInfo[WndNum]->MdiRadInfo->ClientPos.y=InsideRect.top; //ExStyleによる縁を描画 pos.x=0; pos.y=0; size.cx=InsideRect.right-InsideRect.left; size.cy=InsideRect.bottom-InsideRect.top; DrawItemEdgeByExStyle(WndNum,pWindowInfo->GetExStyle(),&pos,&size); //スクロールバーを描画 DrawWindowScrollBar(WndNum,pWindowInfo->GetStyle(),&pos,&size); //クライアント領域のサイズを設定 MdiInfo[WndNum]->MdiRadInfo->ClientSize=size; ////////////// //背景を描画 if(pWindowInfo->GetBackgroundColor()==COLOR_3DFACE){ //3DFACE hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DFACE)); hBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE)); hOldPen=(HPEN)SelectObject(hdc,hPen); hOldBrush=(HBRUSH)SelectObject(hdc,hBrush); Rectangle(hdc,InsideRect.left,InsideRect.top,InsideRect.right,InsideRect.bottom); SelectObject(hdc,hOldPen); SelectObject(hdc,hOldBrush); DeleteObject(hPen); DeleteObject(hBrush); } else if(pWindowInfo->GetBackgroundColor()<=0){ //色指定 hPen=CreatePen(PS_SOLID,0,-pWindowInfo->GetBackgroundColor()); hBrush=CreateSolidBrush(-pWindowInfo->GetBackgroundColor()); hOldPen=(HPEN)SelectObject(hdc,hPen); hOldBrush=(HBRUSH)SelectObject(hdc,hBrush); Rectangle(hdc,InsideRect.left,InsideRect.top,InsideRect.right,InsideRect.bottom); SelectObject(hdc,hOldPen); SelectObject(hdc,hOldBrush); DeleteObject(hPen); DeleteObject(hBrush); } else if(pWindowInfo->GetBackgroundColor()>=0x1000){ //ビットマップ BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, projectInfo.resourceManager.bitmapResources ) { if( projectInfo.resourceManager.bitmapResources[pWindowInfo->GetBackgroundColor()-0x1000].idName == resourceItem.idName ) { lstrcpy(temporary,resourceItem.filepath.c_str()); lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); hImage=LoadImage(NULL,temporary,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE); hBrush=CreatePatternBrush((HBITMAP)hImage); hOldBrush=(HBRUSH)SelectObject(hdc,hBrush); SetBrushOrgEx(hdc,InsideRect.left,InsideRect.top,&pos); PatBlt(hdc, InsideRect.left, InsideRect.top, InsideRect.right-InsideRect.left, InsideRect.bottom-InsideRect.top,PATCOPY); SetBrushOrgEx(hdc,pos.x,pos.y,0); SelectObject(hdc,hOldBrush); DeleteObject(hBrush); DeleteObject(hImage); break; } } } //////////////////////////////////////////// //子ウィンドウ(ダイアログアイテム)を描画 hFont=CreateFontIndirect(&pWindowInfo->LogFont); BOOST_FOREACH( ActiveBasic::PM::ChildWindowInfo *pChildInfo, pWindowInfo->childWindowInfos ) { pos=pChildInfo->pos; size=pChildInfo->size; //ExStyleによる縁を描画 DrawItemEdgeByExStyle(WndNum,pChildInfo->GetExStyle(),&pos,&size); if(pChildInfo->Control==CT_BUTTON){ //////////////////////// // Button コントロール if((pChildInfo->GetStyle()&0x0000000F)==BS_DEFPUSHBUTTON){ //標準のボタンの場合(黒枠描画) DrawRectangleInClient(WndNum, pos.x, pos.y, pos.x+size.cx, pos.y+size.cy, RGB(0,0,0),0,0); pos.x++; pos.y++; size.cx-=2; size.cy-=2; } //ボタンの縁を描画 DrawButtonEdge(WndNum,&pos,&size); if(!(pChildInfo->GetStyle()&(BS_ICON|BS_BITMAP))){ //キャプション テキスト rect.left=pos.x+1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pos.y+1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pos.x+size.cx-2+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pos.y+size.cy-2+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; if(pChildInfo->GetStyle()&BS_MULTILINE) i4=0; else i4=DT_SINGLELINE; //ビットを考慮してBS_CENTERを最初に比較する if((pChildInfo->GetStyle()&BS_CENTER)==BS_CENTER) i2=DT_CENTER; else if(pChildInfo->GetStyle()&BS_LEFT) i2=DT_LEFT; else if(pChildInfo->GetStyle()&BS_RIGHT) i2=DT_RIGHT; else i2=DT_CENTER; //ビットを考慮してBS_VCENTERを最初に比較する if((pChildInfo->GetStyle()&BS_VCENTER)==BS_VCENTER) i3=DT_VCENTER; else if(pChildInfo->GetStyle()&BS_TOP) i3=DT_TOP; else if(pChildInfo->GetStyle()&BS_BOTTOM) i3=DT_BOTTOM; else i3=DT_VCENTER; hOldFont=(HFONT)SelectObject(hdc,hFont); if(pChildInfo->GetStyle()&WS_DISABLED){ SetTextColor(hdc,RGB(255,255,255)); rc2.left=rect.left+1; rc2.top=rect.top+1; rc2.right=rect.right+1; rc2.bottom=rect.bottom+1; DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rc2,i4|i2|i3); SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT)); } else SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT)); DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rect,i4|i2|i3); SelectObject(hdc,hOldFont); } } else if(pChildInfo->Control==CT_CHECKBOX){ ////////////////////////// // CheckBox コントロール if(pChildInfo->GetStyle()&BS_PUSHLIKE){ //ボタンの縁を描画 DrawButtonEdge(WndNum,&pos,&size); } else{ //チェックボックスを描画 size2.cx=13; size2.cy=13; if(pChildInfo->GetStyle()&BS_LEFTTEXT) pos2.x=pos.x+size.cx-size2.cx; else pos2.x=pos.x; if((pChildInfo->GetStyle()&BS_VCENTER)==BS_VCENTER|| (pChildInfo->GetStyle()&BS_VCENTER)==0) pos2.y=pos.y+(size.cy/2)-(size2.cy/2); else if(pChildInfo->GetStyle()&BS_TOP) pos2.y=pos.y+1; else if(pChildInfo->GetStyle()&BS_BOTTOM) pos2.y=pos.y+size.cy-size2.cy-1; DrawItemEdgeByExStyle(WndNum,WS_EX_CLIENTEDGE,&pos2,&size2); if(pChildInfo->GetStyle()&WS_DISABLED) rgb=GetSysColor(COLOR_3DFACE); else rgb=GetSysColor(COLOR_WINDOW); DrawRectangleInClient(WndNum,pos2.x, pos2.y, pos2.x+size2.cx, pos2.y+size2.cy, rgb,rgb,1); if(!(pChildInfo->GetStyle()&BS_LEFTTEXT)) pos.x+=17; else pos.x++; size.cx-=17; } if(!(pChildInfo->GetStyle()&(BS_ICON|BS_BITMAP))){ //キャプション テキスト rect.left=pos.x+1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pos.y+1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pos.x+size.cx-2+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pos.y+size.cy-2+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; if(pChildInfo->GetStyle()&BS_MULTILINE) i4=0; else i4=DT_SINGLELINE; //ビットを考慮してBS_CENTERを最初に比較する if((pChildInfo->GetStyle()&BS_CENTER)==BS_CENTER) i2=DT_CENTER; else if(pChildInfo->GetStyle()&BS_LEFT) i2=DT_LEFT; else if(pChildInfo->GetStyle()&BS_RIGHT) i2=DT_RIGHT; else i2=DT_LEFT; //ビットを考慮してBS_VCENTERを最初に比較する if((pChildInfo->GetStyle()&BS_VCENTER)==BS_VCENTER) i3=DT_VCENTER; else if(pChildInfo->GetStyle()&BS_TOP) i3=DT_TOP; else if(pChildInfo->GetStyle()&BS_BOTTOM) i3=DT_BOTTOM; else i3=DT_VCENTER; hOldFont=(HFONT)SelectObject(hdc,hFont); if(pChildInfo->GetStyle()&WS_DISABLED){ SetTextColor(hdc,RGB(255,255,255)); rc2.left=rect.left+1; rc2.top=rect.top+1; rc2.right=rect.right+1; rc2.bottom=rect.bottom+1; DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rc2,i4|i2|i3); SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT)); } else SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT)); DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rect,i4|i2|i3); SelectObject(hdc,hOldFont); } } else if(pChildInfo->Control==CT_COMBOBOX){ ////////////////////////// // ComboBox コントロール pos2=pos; size2.cx=size.cx; size2.cy=20; DrawItemEdgeByExStyle(WndNum,WS_EX_CLIENTEDGE,&pos2,&size2); //内部 if(pChildInfo->GetStyle()&WS_DISABLED) rgb=GetSysColor(COLOR_3DFACE); else rgb=GetSysColor(COLOR_WINDOW); DrawRectangleInClient(WndNum, pos2.x,pos2.y, pos2.x+size2.cx,pos2.y+size2.cy, rgb,rgb,1); if((pChildInfo->GetStyle()&0x000F)==CBS_SIMPLE){ pos.y+=20; size.cy-=20; DrawItemEdgeByExStyle(WndNum,WS_EX_CLIENTEDGE,&pos,&size); //内部 rgb=GetSysColor(COLOR_WINDOW); DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, rgb,rgb,1); } else{ //下ボタン pos2.x+=size2.cx-16; size2.cx=16; size2.cy=16; DrawItemEdgeByExStyle(WndNum,WS_EX_DLGMODALFRAME,&pos2,&size2); //内部 DrawRectangleInClient(WndNum, pos2.x,pos2.y, pos2.x+size2.cx,pos2.y+size2.cy, GetSysColor(COLOR_3DFACE),GetSysColor(COLOR_3DFACE),1); pos2.x--; if(pChildInfo->GetStyle()&WS_DISABLED){ hPen=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DHIGHLIGHT)); hOldPen=(HPEN)SelectObject(hdc,hPen); pos2.x++; pos2.y++; i3=pos2.x+(size2.cx/2); for(i2=3;i2>=0;i2--,i3--){ DrawLineInClient(WndNum,i3,i2+pos2.y+3,i3+((3-i2)*2)+1,i2+pos2.y+3); } SelectObject(hdc,hOldPen); DeleteObject(hPen); rgb=GetSysColor(COLOR_GRAYTEXT); pos2.x--; pos2.y--; } else rgb=GetSysColor(COLOR_BTNTEXT); hPen=CreatePen(PS_SOLID,0,rgb); hOldPen=(HPEN)SelectObject(hdc,hPen); i3=pos2.x+(size2.cx/2); for(i2=3;i2>=0;i2--,i3--){ DrawLineInClient(WndNum,i3,i2+pos2.y+3,i3+((3-i2)*2)+1,i2+pos2.y+3); } SelectObject(hdc,hOldPen); DeleteObject(hPen); } } else if(pChildInfo->Control==CT_EDIT){ ////////////////////// // Edit コントロール //内部 if(pChildInfo->GetStyle()&WS_DISABLED||pChildInfo->GetStyle()&ES_READONLY) rgb=GetSysColor(COLOR_3DFACE); else rgb=GetSysColor(COLOR_WINDOW); DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, rgb,rgb,1); //キャプション テキスト rect.left=pos.x+1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pos.y+1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pos.x+size.cx-1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pos.y+size.cy-1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; if(pChildInfo->GetStyle()&ES_MULTILINE) i4=0; else i4=DT_SINGLELINE; //ビットを考慮してES_LEFTを最後に検討する if(pChildInfo->GetStyle()&ES_CENTER) i2=DT_CENTER; else if(pChildInfo->GetStyle()&ES_RIGHT) i2=DT_RIGHT; else i2=DT_LEFT; //文字色を設定 if(pChildInfo->GetStyle()&WS_DISABLED) SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT)); else SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT)); hOldFont=(HFONT)SelectObject(hdc,hFont); DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rect,i4|i2); SelectObject(hdc,hOldFont); } else if(pChildInfo->Control==CT_GROUPBOX){ /////////////////////////////////// // グループ ボックス コントロール hOldFont=(HFONT)SelectObject(hdc,hFont); GetTextExtentPoint32(hdc,pChildInfo->GetCaption().c_str(),pChildInfo->GetCaption().size(),&size2); //枠を描画 rect.left=pos.x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pos.y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y+(size2.cy/2); rect.right=pos.x+size.cx+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pos.y+size.cy+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; DrawEdge(hdc,&rect,EDGE_ETCHED,BF_RECT); //ビットを考慮してBS_CENTERを最初に検討する if((pChildInfo->GetStyle()&BS_CENTER)==BS_CENTER){ rect.left=pos.x+(size.cx/2)-(size2.cx/2)-3; rect.right=rect.left+size2.cx+4; } else if(pChildInfo->GetStyle()&BS_RIGHT){ rect.right=pos.x+size.cx-7; rect.left=rect.right-size2.cx-4; } else{ rect.left=pos.x+7; rect.right=rect.left+size2.cx+4; } rect.top=pos.y; rect.bottom=pos.y+size2.cy; if(pWindowInfo->GetBackgroundColor()==COLOR_3DFACE) rgb=GetSysColor(COLOR_3DFACE); else rgb=-pWindowInfo->GetBackgroundColor(); DrawRectangleInClient(WndNum,rect.left,rect.top,rect.right,rect.bottom,rgb,rgb,1); if(!((pChildInfo->GetStyle()&BS_ICON)||(pChildInfo->GetStyle()&BS_BITMAP))){ rect.left+=MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top+=MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right+=MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom+=MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.left+=2; rect.right-=2; //テキストを描画 if(pChildInfo->GetStyle()&WS_DISABLED){ SetTextColor(hdc,RGB(255,255,255)); rc2.left=rect.left+1; rc2.top=rect.top+1; rc2.right=rect.right+1; rc2.bottom=rect.bottom+1; DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rc2,DT_SINGLELINE); SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT)); } else SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT)); DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rect,DT_SINGLELINE); } SelectObject(hdc,hOldFont); } else if(pChildInfo->Control==CT_HSCROLLBAR){ //////////////////////////////////// // 水平スクロールバー コントロール DrawScrollBar(WndNum,pChildInfo->GetStyle(),0,&pos,&size); } else if(pChildInfo->Control==CT_IMAGEBOX){ ///////////////////// // イメージ ボックス HDC memdc; if((pChildInfo->GetStyle()&0x0000000F)==SS_BLACKFRAME) DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(0,0,0),0,0); else if((pChildInfo->GetStyle()&0x0000000F)==SS_GRAYFRAME) DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,GetSysColor(COLOR_3DSHADOW),0,0); else if((pChildInfo->GetStyle()&0x0000000F)==SS_WHITEFRAME) DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(255,255,255),0,0); else if((pChildInfo->GetStyle()&0x0000001F)==SS_ETCHEDFRAME){ rect.left=pos.x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pos.y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pos.x+size.cx+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pos.y+size.cy+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; DrawEdge(hdc,&rect,EDGE_ETCHED,BF_RECT); } else if((pChildInfo->GetStyle()&0x0000000F)==SS_BLACKRECT) DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,GetSysColor(COLOR_3DDKSHADOW),GetSysColor(COLOR_3DDKSHADOW),1); else if((pChildInfo->GetStyle()&0x0000000F)==SS_GRAYRECT) DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,GetSysColor(COLOR_3DSHADOW),GetSysColor(COLOR_3DSHADOW),1); else if((pChildInfo->GetStyle()&0x0000000F)==SS_WHITERECT) DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(255,255,255),RGB(255,255,255),1); else if((pChildInfo->GetStyle()&0x0000000F)==SS_ICON) { if(pChildInfo->image.IsFile()) { lstrcpy(temporary,pChildInfo->image.path.c_str()); } else { bool isMatch = false; BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, projectInfo.resourceManager.iconResources ) { if( resourceItem.idName == pChildInfo->image.path ) { isMatch = true; lstrcpy(temporary,resourceItem.filepath.c_str()); break; } } if( !isMatch ) { goto NonIconImage; } } lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); hImage=LoadImage(NULL,temporary,IMAGE_ICON,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE); if(hImage){ pChildInfo->size.cx=32+(pChildInfo->size.cx-size.cx); pChildInfo->size.cy=32+(pChildInfo->size.cy-size.cy); pos=pChildInfo->pos; size=pChildInfo->size; //ExStyleによる縁を再描画 DrawItemEdgeByExStyle(WndNum,pChildInfo->GetExStyle(),&pos,&size); DrawIcon(hdc, pos.x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x, pos.y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y, (HICON)hImage); DestroyIcon((HICON)hImage); } else{ NonIconImage: DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(0,0,0),0,0); hOldFont=(HFONT)SelectObject(hdc,hFont); rect.left=pos.x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pos.y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pos.x+size.cx+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pos.y+size.cy+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT)); DrawText(hdc,"icon...",-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER); SelectObject(hdc,hOldFont); } } else if((pChildInfo->GetStyle()&0x0000000F)==SS_BITMAP){ BITMAP Bitmap; if(pChildInfo->image.IsFile()) { lstrcpy(temporary,pChildInfo->image.path.c_str()); } else{ bool isMatch = false; BOOST_FOREACH( const ActiveBasic::Common::ResourceItem &resourceItem, projectInfo.resourceManager.bitmapResources ) { if( resourceItem.idName == pChildInfo->image.path ) { lstrcpy(temporary,resourceItem.filepath.c_str()); isMatch = true; break; } } if( !isMatch ) { goto NonBitmapImage; } } lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() ); hImage=LoadImage(NULL,temporary,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE); if(hImage){ GetObject(hImage,sizeof(BITMAP),&Bitmap); pChildInfo->size.cx=Bitmap.bmWidth+(pChildInfo->size.cx-size.cx); pChildInfo->size.cy=Bitmap.bmHeight+(pChildInfo->size.cy-size.cy); pos=pChildInfo->pos; size=pChildInfo->size; //ExStyleによる縁を再描画 DrawItemEdgeByExStyle(WndNum,pChildInfo->GetExStyle(),&pos,&size); memdc=CreateCompatibleDC(hdc); SelectObject(memdc,hImage); BitBlt(hdc, pos.x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x, pos.y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y, size.cx, size.cy, memdc, 0,0, SRCCOPY); DeleteDC(memdc); DeleteObject(hImage); } else{ NonBitmapImage: DrawRectangleInClient(WndNum,pos.x,pos.y,pos.x+size.cx,pos.y+size.cy,RGB(0,0,0),0,0); hOldFont=(HFONT)SelectObject(hdc,hFont); rect.left=pos.x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pos.y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pos.x+size.cx+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pos.y+size.cy+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT)); DrawText(hdc,"bmp...",-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER); SelectObject(hdc,hOldFont); } } } else if(pChildInfo->Control==CT_LISTBOX){ ///////////////////////// // ListBox コントロール //内部 if(pChildInfo->GetStyle()&WS_DISABLED) rgb=GetSysColor(COLOR_3DFACE); else rgb=GetSysColor(COLOR_WINDOW); DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, rgb,rgb,1); if(pChildInfo->GetStyle()&LBS_DISABLENOSCROLL) DrawWindowScrollBar(WndNum,pChildInfo->GetStyle()|WS_DISABLED,&pos,&size); } else if(pChildInfo->Control==CT_LISTVIEW){ ////////////////////////// // ListView コントロール //内部 if(pChildInfo->GetStyle()&WS_DISABLED) rgb=GetSysColor(COLOR_3DFACE); else rgb=GetSysColor(COLOR_WINDOW); DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, rgb,rgb,1); if((pChildInfo->GetStyle()&LVS_REPORT)&& (!((pChildInfo->GetStyle()&LVS_LIST)==LVS_LIST))){ //レポート ビュー size.cy=16; DrawButtonEdge(WndNum,&pos,&size); } } else if(pChildInfo->Control==CT_PROGRESSBAR){ ///////////////////////////// // ProgressBar コントロール //内部 pos.x++; pos.y++; size.cx-=2; size.cy-=2; rgb=GetSysColor(COLOR_ACTIVECAPTION); if(pChildInfo->GetStyle()&PBS_SMOOTH){ if(pChildInfo->GetStyle()&PBS_VERTICAL){ pos.y+=(long)((double)size.cy*0.3); DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+(long)((double)size.cy*0.7), rgb,rgb,1); } else{ DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+(long)((double)size.cx*0.7),pos.y+size.cy, rgb,rgb,1); } } else{ if(pChildInfo->GetStyle()&PBS_VERTICAL){ pos.y+=(long)((double)size.cy*0.3); i3=(size.cx*2)/3; i2=(int)((double)size.cy*0.7); for(;i2>i3;i2-=i3+2){ DrawRectangleInClient(WndNum, pos.x,pos.y+i2-i3, pos.x+size.cx,pos.y+i2, rgb,rgb,1); } } else{ i3=(size.cy*2)/3; i4=(int)((double)size.cx*0.7); for(i2=0;i2+i3Control==CT_RADIOBUTTON){ ///////////////////////////// // RadioButton コントロール if(pChildInfo->GetStyle()&BS_PUSHLIKE){ //ボタンの縁を描画 DrawButtonEdge(WndNum,&pos,&size); } else{ //ラジオボタンを描画 size2.cx=12; size2.cy=12; if(pChildInfo->GetStyle()&BS_LEFTTEXT) pos2.x=pos.x+size.cx-size2.cx; else pos2.x=pos.x+1; if((pChildInfo->GetStyle()&BS_VCENTER)==BS_VCENTER|| (pChildInfo->GetStyle()&BS_VCENTER)==0) pos2.y=pos.y+(size.cy/2)-(size2.cy/2); else if(pChildInfo->GetStyle()&BS_TOP) pos2.y=pos.y+1; else if(pChildInfo->GetStyle()&BS_BOTTOM) pos2.y=pos.y+size.cy-size2.cy-1; hResource=LoadResource(hResInst,FindResource(hResInst,MAKEINTRESOURCE(IDB_RADIOBUTTON),RT_BITMAP)); pBitmapInfo=(BITMAPINFO *)LockResource(hResource); pByte=(BYTE *)pBitmapInfo+pBitmapInfo->bmiHeader.biSize; pByte2=(BYTE *)GlobalAlloc(GMEM_FIXED,pBitmapInfo->bmiHeader.biWidth*pBitmapInfo->bmiHeader.biHeight*3); for(i2=0,i3=0;i2bmiHeader.biWidth*pBitmapInfo->bmiHeader.biHeight;i2++,i3+=3){ rgb=RGB(pByte[i3+2],pByte[i3+1],pByte[i3]); if(rgb==RGB(255,255,0)){ if(pWindowInfo->GetBackgroundColor()==COLOR_3DFACE) rgb=GetSysColor(COLOR_3DFACE); else rgb=-pWindowInfo->GetBackgroundColor(); } //影側 else if(rgb==RGB(0,0,0)) rgb=GetSysColor(COLOR_3DSHADOW); else if(rgb==RGB(255,0,0)) rgb=GetSysColor(COLOR_3DDKSHADOW); //光源側 else if(rgb==RGB(0,0,255)) rgb=GetSysColor(COLOR_3DLIGHT); else if(rgb==RGB(0,255,0)) rgb=GetSysColor(COLOR_3DHIGHLIGHT); //内部 else if(rgb==RGB(255,255,255)){ if(pChildInfo->GetStyle()&WS_DISABLED) rgb=GetSysColor(COLOR_3DFACE); } pByte2[i3+2]=LOBYTE(LOWORD(rgb)); pByte2[i3+1]=HIBYTE(LOWORD(rgb)); pByte2[i3]=LOBYTE(HIWORD(rgb)); } SetDIBitsToDevice(hdc, pos2.x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x, pos2.y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y, pBitmapInfo->bmiHeader.biWidth, pBitmapInfo->bmiHeader.biHeight, 0,0, 0,pBitmapInfo->bmiHeader.biHeight, pByte2, pBitmapInfo, DIB_RGB_COLORS); GlobalFree(pByte2); if(!(pChildInfo->GetStyle()&BS_LEFTTEXT)) pos.x+=17; else pos.x++; size.cx-=17; } if(!(pChildInfo->GetStyle()&(BS_ICON|BS_BITMAP))){ //キャプション テキスト rect.left=pos.x+1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pos.y+1+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pos.x+size.cx-2+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pos.y+size.cy-2+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; if(pChildInfo->GetStyle()&BS_MULTILINE) i4=0; else i4=DT_SINGLELINE; //ビットを考慮してBS_CENTERを最初に比較する if((pChildInfo->GetStyle()&BS_CENTER)==BS_CENTER) i2=DT_CENTER; else if(pChildInfo->GetStyle()&BS_LEFT) i2=DT_LEFT; else if(pChildInfo->GetStyle()&BS_RIGHT) i2=DT_RIGHT; else i2=DT_LEFT; //ビットを考慮してBS_VCENTERを最初に比較する if((pChildInfo->GetStyle()&BS_VCENTER)==BS_VCENTER) i3=DT_VCENTER; else if(pChildInfo->GetStyle()&BS_TOP) i3=DT_TOP; else if(pChildInfo->GetStyle()&BS_BOTTOM) i3=DT_BOTTOM; else i3=DT_VCENTER; hOldFont=(HFONT)SelectObject(hdc,hFont); if(pChildInfo->GetStyle()&WS_DISABLED){ SetTextColor(hdc,RGB(255,255,255)); rc2.left=rect.left+1; rc2.top=rect.top+1; rc2.right=rect.right+1; rc2.bottom=rect.bottom+1; DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rc2,i4|i2|i3); SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT)); } else SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT)); DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rect,i4|i2|i3); SelectObject(hdc,hOldFont); } } else if(pChildInfo->Control==CT_STATIC){ //////////////////////// // Static コントロール //キャプション テキスト rect.left=pos.x+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.top=pos.y+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; rect.right=pos.x+size.cx+MdiInfo[WndNum]->MdiRadInfo->ClientPos.x; rect.bottom=pos.y+size.cy+MdiInfo[WndNum]->MdiRadInfo->ClientPos.y; //ビットを考慮してSS_LEFTを最後に検討する if(pChildInfo->GetStyle()&SS_CENTER) i2=DT_CENTER; else if(pChildInfo->GetStyle()&SS_RIGHT) i2=DT_RIGHT; else i2=DT_LEFT; hOldFont=(HFONT)SelectObject(hdc,hFont); if(pChildInfo->GetStyle()&WS_DISABLED){ SetTextColor(hdc,RGB(255,255,255)); rc2.left=rect.left+1; rc2.top=rect.top+1; rc2.right=rect.right+1; rc2.bottom=rect.bottom+1; DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rc2,i2); SetTextColor(hdc,GetSysColor(COLOR_GRAYTEXT)); } else SetTextColor(hdc,GetSysColor(COLOR_BTNTEXT)); //折り返すかどうか if(!(pChildInfo->GetStyle()&SS_LEFTNOWORDWRAP)){ i2|=DT_WORDBREAK; } DrawText(hdc,pChildInfo->GetCaption().c_str(),-1,&rect,i2); SelectObject(hdc,hOldFont); } else if(pChildInfo->Control==CT_TRACKBAR){ ////////////////////////// // TrackBar コントロール if(pChildInfo->GetStyle()&TBS_VERT){ pos.x+=2; size.cx-=2; if(size.cx>21) size.cx=21; pos.y+=8; size.cy-=16; rect.left=MdiInfo[WndNum]->MdiRadInfo->ClientPos.x+pos.x+(size.cx/2)-2; rect.right=MdiInfo[WndNum]->MdiRadInfo->ClientPos.x+pos.x+(size.cx/2)+2; rect.top=MdiInfo[WndNum]->MdiRadInfo->ClientPos.y+pos.y; rect.bottom=MdiInfo[WndNum]->MdiRadInfo->ClientPos.y+pos.y+size.cy; DrawEdge(hdc,&rect,EDGE_SUNKEN,BF_RECT); size.cy=size.cx/2; DrawButtonEdge(WndNum,&pos,&size); } else{ pos.x+=8; size.cx-=16; pos.y+=2; size.cy-=2; if(size.cy>21) size.cy=21; rect.left=MdiInfo[WndNum]->MdiRadInfo->ClientPos.x+pos.x; rect.right=MdiInfo[WndNum]->MdiRadInfo->ClientPos.x+pos.x+size.cx; rect.top=MdiInfo[WndNum]->MdiRadInfo->ClientPos.y+pos.y+(size.cy/2)-2; rect.bottom=MdiInfo[WndNum]->MdiRadInfo->ClientPos.y+pos.y+(size.cy/2)+2; DrawEdge(hdc,&rect,EDGE_SUNKEN,BF_RECT); size.cx=size.cy/2; DrawButtonEdge(WndNum,&pos,&size); } } else if(pChildInfo->Control==CT_TREEVIEW){ ////////////////////////// // TreeView コントロール //内部 if(pChildInfo->GetStyle()&WS_DISABLED) rgb=GetSysColor(COLOR_3DFACE); else rgb=GetSysColor(COLOR_WINDOW); DrawRectangleInClient(WndNum, pos.x,pos.y, pos.x+size.cx,pos.y+size.cy, rgb,rgb,1); } else if(pChildInfo->Control==CT_UPDOWN){ /////////////////////////////// // アップ ダウン コントロール if(pChildInfo->GetStyle()&UDS_HORZ) DrawUpDownControl(WndNum,pChildInfo->GetStyle(),0,&pos,&size); else DrawUpDownControl(WndNum,pChildInfo->GetStyle(),1,&pos,&size); } else if(pChildInfo->Control==CT_VSCROLLBAR){ //////////////////////////////////// // 垂直スクロールバー コントロール DrawScrollBar(WndNum,pChildInfo->GetStyle(),1,&pos,&size); } } DeleteObject(hFont); } void DrawRadWindow(int WndNum,const ActiveBasic::PM::WindowInfo *pWindowInfo){ HBRUSH hOldBrush; POINT pos; SetBkMode(MdiInfo[WndNum]->MdiRadInfo->hMemDC,TRANSPARENT); hOldBrush=(HBRUSH)SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,GetStockObject(WHITE_BRUSH)); PatBlt(MdiInfo[WndNum]->MdiRadInfo->hMemDC,0,0,ScreenX*2,ScreenY*2,PATCOPY); SelectObject(MdiInfo[WndNum]->MdiRadInfo->hMemDC,hOldBrush); pos.x=LEVER_THICK; pos.y=LEVER_THICK; DesigningWindow(WndNum,MdiInfo[WndNum]->MdiRadInfo->hMemDC,&pos,pWindowInfo); InvalidateRect(MdiInfo[WndNum]->MdiRadInfo->hRad,NULL,0); }