Board index » delphi » how to create a selection rectangle
Roberto Nicchi
![]() Delphi Developer |
Sun, 12 Sep 2004 02:28:14 GMT
|
Roberto Nicchi
![]() Delphi Developer |
Sun, 12 Sep 2004 02:28:14 GMT
how to create a selection rectangle
Hi,
i have a form with some object that i want to select with the mouse. How is possible to create a selection rectangle ? I'm new to graphic in Delphi, an example is epreciated :) thanks -- |
Gustavo Dau
![]() Delphi Developer |
Sat, 11 Sep 2004 05:57:22 GMT
Re:how to create a selection rectangleHumm.. let's give a try. First I created a method to ajust the TRect record. What it does: if right variable is less than left variable or bottom variable is less than top, the method inverts the values (This is necessary for calling later DrawFocusRect): function AdjustRect(Rect: TRect): TRect; //If bottom is less than top //Stores Rect.Bottom in a temporary variable to exchange the values //Returns the adjust rect Add three variables inside TForm type Edit OnMouseDown event for the form. In this event we will store the procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Edit OnMouseMove event. This event will erase the last selection rectangle procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Finally, edit OnMouseUp. This method will erase the selection rectangle and procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton; //Now you have the selection the user made inside SelectionRect One final note, you must be wondering how a call to DrawFocusRect may erase If you give some more info we could help you more.. "Roberto Nicchi" <softw...@masterinformatica.net> escreveu na mensagem Quote> Hi, |
Roberto Nicch
![]() Delphi Developer |
Sun, 12 Sep 2004 15:59:27 GMT
Re:how to create a selection rectangle"Gustavo Daud" <gubad...@terra.com.br> wrote in news:3ca0ee35_2@dnews: THANKS!!! i'll examine your code soon thanks again -- |
Roberto Nicch
![]() Delphi Developer |
Mon, 13 Sep 2004 23:01:15 GMT
Re:how to create a selection rectangle"Gustavo Daud" <gubad...@terra.com.br> wrote in news:3ca0ee35_2@dnews: Quotethanks for the detailed message. -- |