MFC->How to create different-shaped buttons in runtime?
-
problem: i need different-shaped buttons to be placed in client area in runtime. for example: rightclick in client area opens context menu with options: round button triangle button by clicking on one of the above appropriate button shoud be drawn in client area. this button (like all others created this way) should have all standard properties of a button (CButton) my experiment: i've tried with SetWindowRgn but id doesn't work then i used "common" CreateWindow with BUTTON as parametar and got a nice round button but my program wouldn't accept any further rightclicks (no context menu) this is my method wich creates squared flat button (i could create many buttons) void CpaintView::OnFalseCircle() { CPoint point; GetCursorPos(&point); ScreenToClient(&point); CButton *cir = new CButton(); cir->Create("tri",BS_FLAT, CRect(point,CPoint (point.x+20,point.y+20)),AfxGetMainWnd(),1); cir->ShowWindow(SW_SHOWNORMAL); } and non-working method wich creates one circle and stucks void CpaintView::OnCircle() { CPoint point; GetCursorPos(&point); ScreenToClient(&point); CRect rect(point, CPoint(point.x+50, point.y+50)); CRgn rgn; Circle *cr = new Circle(); rgn.CreateEllipticRgnIndirect(rect); SetWindowRgn(rgn,true); CreateWindow("BUTTON","",WS_CHILD | WS_VISIBLE, point.x-10,point.y- 10,70, 70, *this,(HMENU)101,0,0); } thanks