PtInRegion判断一个点是不是在四边形内,代码哪里错了 - C++ Builder / Windows SDK/API
用的API函数PtInRegion判断的
float x1 = StrToFloat(Edit1->Text),y1 = StrToFloat(Edit2->Text), x2 = StrToFloat(Edit3->Text),y2 = StrToFloat(Edit4->Text), x3 = StrToFloat(Edit5->Text),y3 = StrToFloat(Edit6->Text), x4 = StrTofloat(Edit7->Text),y4 = StrToFloat(Edit8->Text), x = StrToFloat(Edit9->Text),y = StrtoFloat(Edit10->Text); POINT p[3]; p[0].x = x1; p[0].y = y1; p[1].x = x2; p[1].y = y2; p[2].x = x3; p[2].y = y3; p[3].x = x4; p[3].y = y4; HRGN hRgn = CreatePolygonRgn(p,4,ALTERNATE); bool a = PtInRegion(hRgn,x,y); ShowMessage(a);