Jump to content

victorlus

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I did not get a solution could show how it solved I'm having trouble using CreateRectRgn sorry i'm using google translator
  2. Thank you very much my friend you will help me a lot, I am not able to do '-', 3 days ago
  3. Form2 : https://imgur.com/a/IfsTxeu Form1: https://imgur.com/1mzTI66 I'm trying to align, form 2, together with form 1, with the same hole in the same size, without moving the shape of the form, only height and width Obs : If I don't use the mouse event it works normally Code: type TForm2 = class(TForm) procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Image1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); private { Private declarations } var x1, y1, x2, y2: Integer; ptnd: Boolean; AnchorX, AnchorY, CurX, CurY: Integer; protected public { Public declarations } end; var Form2: TForm2; X1frmFormMainShapeLeft: Integer; Y1frmFormMainShapeTop: Integer; implementation const vH: Byte = 10; vV: Byte = 30; procedure TForm2.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin x1 := x + vH; y1 := y + vV; ptnd := True; AnchorX := X; CurX := X; AnchorY := Y; CurY := Y; end; procedure TForm2.Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin Caption := 'x1: ' + IntToStr(x1) + '; y1 ' + IntToStr(y1) + '; x2 ' + IntToStr(x2) + '; y2 ' + IntToStr(y2) + ';'; if ptnd then begin Canvas.Pen.Mode := pmNot; Canvas.Pen.Width := 8; Canvas.Brush.Style := bsClear; Canvas.Rectangle(AnchorX, AnchorY, CurX, CurY); CurX := X; CurY := Y; Canvas.Rectangle(AnchorX, AnchorY, CurX, CurY); end; end; procedure TForm2.Image1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var lMyOffsetTop : integer; lMyOffsetLeft: integer; begin x2 := x + vH; y2 := y + vV; lMyOffsetTop := 11; // você precisa calcular os valores verticais da margem (área não cliente) lMyOffsetLeft := 11; // calcula os valores horizontais da margem (área não cliente) begin Shape1.Top := Y; Shape1.Left := X; Shape1.Width := x1 - x2; Shape1.Height := y1 - y2; Form1.Shape1.Top := 40; Form1.Shape1.Left := 40; Form1.Shape1.Width := x1 - x2; Form1.Shape1.Height := y1 - y2; Y1frmFormMainShapeTop := ClientToScreen(Point(0, 0)).Y + Shape1.Top - (Self.Height - Self.ClientHeight) + lMyOffsetTop; X1frmFormMainShapeLeft := ClientToScreen(Point(0, 0)).X + Shape1.Left - (Self.Width - Self.ClientWidth) + lMyOffsetLeft; Form1.Left := X1frmFormMainShapeLeft - form1.Shape1.Left; Form1.Top := Y1frmFormMainShapeTop - form1.Shape1.Top; Form1.Show; if ptnd then begin end; ptnd := False; Canvas.Pen.Mode := pmNot; Canvas.Brush.Style := bsClear; Canvas.Rectangle(AnchorX, AnchorY, CurX, CurY); end; end;
  4. victorlus

    (Hole) align hole inside the panel form 1

    Yes what I wanted to do was the hole in the form2 and the form1 to align with the hole of the form2 inside a panel
  5. victorlus

    (Hole) align hole inside the panel form 1

    Do you know how to solve?
  6. victorlus

    (Hole) align hole inside the panel form 1

    Sorry friend it was not my intention to do this
  7. victorlus

    (Hole) align hole inside the panel form 1

    How do I want to do more? Doesn't it work? Does anyone have the solution? -> https://prnt.sc/zlp562
  8. victorlus

    (Hole) align hole inside the panel form 1

    How do I want to do more? Doesn't it work? Does anyone have the solution? -
  9. I'm trying to make a hole in the form 2 align the hole of the form 2 inside the form 1 inside the panel someone can help me in this solution. Here is a printout of the error can someone help me with this How do I want to do more? Doesn't it work? Does anyone have the solution? -> Image https://prnt.sc/zlp562 
  10. victorlus

    CreateRectRgn Someone knows how to solve ?

    I tried that way not being able to measure an example?
  11. Hello everyone Well, I have a question, I hope you can help me, Next, I have 2 forms Form2, Form1 Form2 cuts the screen well What I wanted to do was when you cut out form 2, open form 1, cut it and move it over the cut of shape 2 if possible, cut form 2 is inside panel 1 of form Image -> Error Matched form1 type TForm2 = class(TForm) procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Image1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); private { Private declarations } var x1, y1, x2, y2: Integer; ptnd: Boolean; AnchorX, AnchorY, CurX, CurY: Integer; public { Public declarations } end; var Form2: TForm2; implementation const vH: Byte = 10; vV: Byte = 30; procedure TForm2.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin x1 := x + vH; y1 := y + vV; ptnd := True; AnchorX := X; CurX := X; AnchorY := Y; CurY := Y; end; procedure TForm2.Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin Caption := 'x1: ' + IntToStr(x1) + '; y1 ' + IntToStr(y1) + '; x2 ' + IntToStr(x2) + '; y2 ' + IntToStr(y2) + ';'; if ptnd then begin Canvas.Pen.Mode := pmNot; Canvas.Pen.Width := 2; Canvas.Brush.Style := bsClear; Canvas.Rectangle(AnchorX, AnchorY, CurX, CurY); CurX := X; CurY := Y; Canvas.Rectangle(AnchorX, AnchorY, CurX, CurY); end; end; procedure TForm2.Image1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var region1, region2, rg2, rg1: hrgn; RECT : TRECT; begin x2 := x + vH; y2 := y + vV; //if Shift = [ssCtrl] then begin region1 := CreateRectRgn(0, 0, Self.Width, Self.Height); region2 := CreateRectRgn(x1, y1, x2, y2); CombineRgn(region1, region1, region2, RGN_DIFF); SetWindowRgn(Handle, region1, True); getwindowrect(form1.Panel1.Handle,rect); form1.Top := Round((x1 + y1)/2); Form1.Left := Round((x2 + y2)/2); form1.Show; region1 := CreateRectRgn(0, 0, self.Width, self.Height); region2 := CreateRectRgn(x1, y1, x2, y2); CombineRgn(region1, region1, region2, RGN_DIFF); SetWindowRgn(form1.Handle, region1, True); end; if ptnd then begin ptnd := False; Canvas.Pen.Mode := pmNot; Canvas.Brush.Style := bsClear; Canvas.Rectangle(AnchorX, AnchorY, CurX, CurY); end; end;
×