1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
LRESULT CALLBACK VisProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
switch(msg)
{
case WM_CREATE:
{
break;
}
case WM_PAINT:
{
hdc=BeginPaint(hwnd,&ps);
map<int,set<int>>::iterator l=wf.dag.layers.end();
double layerNum=0;
COLORREF col=RGB(22,28,218);
for (map<int,set<int>>::iterator p=wf.dag.layers.begin();p!=l;++p)
{
double nodeNum=0;
set<int>::iterator l2=(p->second).end();
for (set<int>::iterator p2=(p->second).begin();p2!=l2;++p2)
{
int size=min(wf.dag.hunit,wf.dag.vunit);
HBRUSH brush=CreateSolidBrush(col);
LOGBRUSH blog;
HPEN pen=ExtCreatePen (PS_GEOMETRIC,1,&blog,0,0);
blog.lbColor=col;
blog.lbStyle=BS_SOLID;
blog.lbHatch=0;
SelectObject(hdc,pen);
int hNum=(nodeNum+.5)*wf.dag.hunit;
int vNum=(layerNum+.5)*wf.dag.vunit;
Ellipse(hdc,hNum-size,vNum-size,hNum+size,vNum+size);
}
++layerNum;
}
}
case WM_SIZE:
{
//TO DO!!!
break;
}
default:
{
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}
return 0;
}
|