如题

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);begin
       with Canvas do
       begin
         Rectangle(100,100,300,300);
         Rectangle(150,150,250,250);
         Brush.Color := clRed;
         FillRect(rect(150,150,250,250));
       end;
    end;
      

  2.   

    先创建出HRGH的区域,再用CombineRgn获取环带的区域,之后填充:var a, b, c: HRGN;
        hbr: HBRUSH;
    begin
      //  Canvas.Rectangle(100,200,400,400);
      //  Canvas.RoundRect(120,220,300,350,100,100);
      hbr := CreateSolidBrush(clRed);
      a:=CreateRectRgn(100,200,400,400);
      b:=CreateRoundRectRgn(120,220,300,350,100,100);
      c:=CreateRectRgn(0,0,1,1);
      CombineRgn(c, a, b, RGN_DIFF);
      FillRgn(Canvas.Handle,c, hbr);
    end;