victorlus
-
Content Count
12 -
Joined
-
Last visited
Posts posted by victorlus
-
-
19 minutos atrás, emailx45 disse:OK! Mas, ao usar "CreateRectRgn" e "CombineRgn", VOCÊ PRECISA excluir os objetos antigos "regiões" - consulte a Documentação da Microsoft!
Você não pode deixar como "velhas regiões" na memória! Apenas a nova região (o "combinado")
Meu código para você necessariamente que é o mesmo!
- apenas mude a escolha de FORMA = se você precisar de um "quadrado", mude para "Forma = stSquare"
abraço
I'm having a little trouble using
-
1 minute ago, emailx45 said:I'll try...
hug
Thank you very much my friend you will help me a lot, I am not able to do '-', 3 days ago
-
Form2 :
Form1:
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;
-
12 minutes ago, FPiette said:Você deve explicar melhor qual é o problema.
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
-
1 minute ago, FPiette said:E não poste a mesma pergunta aqui e no StackOverflow . As mesmas pessoas estão respondendo de qualquer maneira.
Do you know how to solve?
-
Just now, David Heffernan said:Por favor, não envie spam para o site com postagens duplicadas. Ao postar, não use texto muito grande.
Sorry friend it was not my intention to do this
-
-
How do I want to do more? Doesn't it work? Does anyone have the solution? -
-
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
QuoteHow do I want to do more? Doesn't it work? Does anyone have the solution? -> Image https://prnt.sc/zlp562
Quotetype 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.Left := Form2.Left - Form1.Left; Form1.Top := Form2.Top - Form1.Top; form1.Show; region1 := CreateRectRgn(0, 0, form1.Width, form1.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;
-
7 hours ago, Pat Foley said:Some clues are clienttoscreen, windows.DrawFocusRect and .boundsrect. the form's mouse X is different than the screen's X.
I tried that way not being able to measure an example?
-
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;
How to create a "HOLE" in a form and align it to HOLE in another form (Hole by Hole)
in VCL
Posted