动态创建的组件选择问题
HDC hDC2;
TCanvas *lpCanvas = new TCanvas;
lpCanvas-> Handle = hDC2;
lpCanvas-> Brush-> Style = bsClear;
lpCanvas-> Brush-> Color=clBlack;
lpCanvas-> Font-> Color = clFuchsia;
lpCanvas-> Pen-> Color=clGray;
lpCanvas-> CleanupInstance();
for(int i =0;i <=15;i++)
{
lpCanvas-> Pen-> Color=clFuchsia;
lpCanvas-> Brush-> Color= clGray;
lpCanvas-> Rectangle(6,101,40,140);
lpCanvas-> Font-> Color = clNavy;
}
delete lpCanvas;
动态创建了 15个 矩形.
问我该怎么来选择某个矩形
例如,我选择第一个矩形,,用鼠标双击这个矩形,跳出个panel来,
双击第3个矩形,跳出panel来.
是用user32里的 SelectObject函数吗?
帮忙解决一下
[解决办法]
是从属于某个WinControl的,最好别直接new,通过new一个WinControl来获得一个新的TCanvas