August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!
On a form, place a TPanel. Set its Left to 50; Set its Top to 50; Set its BorderStyle = bsSingle Set BorderWidth to 1 // (this doesn't actually matter, it can also be 0). //Paint onto the forms canvas by putting a TButton with this OnClick event: procedure TForm1.Button1Click(Sender: TObject); var C : TCanvas; MyHDC : HDC; begin C := TCanvas.Create; with C do try MyHDC := GetWindowDC(self.handle); try Handle := MyHDC; Brush.Style := bsSolid; Pen.Width := 8; Rectangle(Rect(10,10,100,100)); finally ReleaseDC(self.handle, MyHDC); end; finally Free; end; //NOW REPAINT THE PANEL Panel1.Repaint; //NOW REPAINT THE FORM self.repaint; end; //THE SOLUTION: panel1.BorderStyle := bsNone; panel1.BorderStyle := bsSingle;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.