我在ActiveX控件中要实现画多个CListBox,而且要能用线将其连起来,象树形图一样,但是我总是不能画到位,要差一点点。
CRect rect;
rect.left=0;
rect.top=0;
rect.bottom=60;
rect.right=80;
CListBox* lpList1=new CListBox;
CListBox* lpList2=new CListBox;lpList1->Create(CBS_DROPDOWNLIST|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|WS_HSCROLL,rect, this, uList_id);
CPoint cPoint1,cPoint2;
cPoint1.x=(rect.right+rect.left)/2;
cPoint1.y=rect.bottom;
rect.OffsetRect(0,100);
lpList2->Create(CBS_DROPDOWNLIST|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|WS_HSCROLL,rect, this, uList_id2);
cPoint2.x=(rect.right+rect.left)/2;
cPoint2.y=rect.top;
CClientDC dc(this);
dc.MoveTo(cPoint1);
dc.LineTo(cPoint2);