1.通过API函数GetPixel(),获取某个点的颜色值; var PT : TPoint; C : TColor; DC : HDC; hwd : THandle; I : integer; begin GetCursorPos(PT); hwd := WindowFromPoint(PT); DC := GetDC(HWD); C := GetPixel(DC,PT.x,PT.y); // self.color := c; //设置窗体颜色 edit1.text := FORMAT($%.
为适应多语言,需要对界面控件大小.位置多动态改变,因此需要根据其Caption计算实际像素大小. 找资料未有易用现成的,遂参数其它方法,写以函数处之,代码如下: uses TypInfo; function GetTextWidth(AControl: TControl): Integer; function GetControlFont: TFont; var PropInfo: PPropInfo; begin Result := nil; PropInfo := GetPropInfo(A