首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

获取RGB有关问题

2013-09-05 
获取RGB问题varh :Hwndpt: TPointc: TColorr:trectD :integerbeginIf CheckBox4.Checked thenbeginh:

获取RGB问题
var
  h :Hwnd;
  pt: TPoint;
  c: TColor;
  r:trect;
  D :integer;
begin
    If CheckBox4.Checked then
    begin
     h:=FindWindow(Nil,'nn');
      if h <> 0 then
      begin
     GetWindowRect(h,r);//得到窗口的左上角坐标
    D:= GetDC(h);
     pt.X :=  135;
     pt.Y :=48;
     c := GetPixel(D, pt.X, pt.Y);
   Self.Color := c;
     Label1.Caption := Format('#%.6x', [c]);
这个代码为什么有另一个窗口挡在前面了就得不到指定窗口的RGB了我得怎改才可以得到指宁窗口指宁坐标的RGB啊
[解决办法]
GetDC 用法问题, 查一下资料吧, 应该是最小化, 被遮挡后, GetDC获取不到用户区了

热点排行