Board index » delphi » create shapes at runtime
George Myers
![]() Delphi Developer |
Mon, 18 Feb 2002 03:00:00 GMT
|
George Myers
![]() Delphi Developer |
Mon, 18 Feb 2002 03:00:00 GMT
create shapes at runtime
Shapes have useful features which I would like to take advantage of by
creating them at run time rather than in the designer. Seems possible but I cannot get one to display on the Form These do not work. Any suggestions would be appreciated. TIA |
Bradford C. Mille
![]() Delphi Developer |
Mon, 18 Feb 2002 03:00:00 GMT
Re:create shapes at runtimeAfter you create them, you need to set their Parent property or they will not show up. Set their Parent to the object that contains them. |
Albert
![]() Delphi Developer |
Mon, 18 Feb 2002 03:00:00 GMT
Re:create shapes at runtimeSorry for some reason the reply went as a question. Here is the correct way to design shapes at runtime. with TShape.Create(Self) do begin Name:='name here'; Align:=alNone; Left:=10; */ make your own Top:=10; */ make your own Width:=100; Height:=100; Shape:=stRectangle; Brush.Style:=bssolid; Brush.Color:=clRed; Pen.Color:=clRed; Visible:=true; Enabled:=true; Parent:=Form1; end; Make notice of */ as comment. double / will make a wierd note from the above example you can modify your component. QuoteGeorge Myers <geo...@thoughtshare.com> wrote in message Quote> Shapes have useful features which I would like to take advantage of by |
Ada Lovelac
![]() Delphi Developer |
Tue, 19 Feb 2002 03:00:00 GMT
Re:create shapes at runtimeUse Myshape.parent:= self; Quote
Share what you know. Learn what you don't. |
Eddie Shipma
![]() Delphi Developer |
Tue, 19 Feb 2002 03:00:00 GMT
Re:create shapes at runtimeAlberto, if you place a space between the "//" and the comment, OE will not give you the wierd note... Left:=10; // make your own QuoteAlberto <chap...@bellsouth.net> wrote in message Quote> Sorry for some reason the reply went as a question. |
George Myer
![]() Delphi Developer |
Wed, 06 Mar 2002 03:00:00 GMT
Re:create shapes at runtimeThanks! Hopefully you have another suggestion... I have tried a number of things. Ideally what I want to do is suppress painting at the component level during My most desperate act was to try and intercept the WM_PAINT in the procedure TWebDeskForm.WndProc(var Message: TMessage); if Message.Msg = WM_PAINT then QuoteAlberto wrote: |
Renate Scha
![]() Delphi Developer |
Wed, 06 Mar 2002 03:00:00 GMT
Re:create shapes at runtimeOn September 18 1999, you wrote: Quote> but now after putting a few doublebuffered property of your form to true. Renate |
George Myer
![]() Delphi Developer |
Wed, 06 Mar 2002 03:00:00 GMT
Re:create shapes at runtimesounds encouraging... but would appreciate if you could elaborate - cannot find such property (in D3). QuoteRenate Schaaf wrote: |
Renate Scha
![]() Delphi Developer |
Wed, 06 Mar 2002 03:00:00 GMT
Re:create shapes at runtimeOn September 18 1999, you wrote: Quote> sounds encouraging... but would appreciate if you could elaborate - D3. Maybe someone else can give you a hint. You can try and add [csOpaque] to the *form's* controlstyle, too. Also, setting autoscroll to false, if that's an option. And using "setbounds" for the shapes rather than setting individual width and height. Referring to your original message, rather than overriding the WndProc procedure TForm1.Paint; Maybe some of this helps. Renate |
Marius Bunesc
![]() Delphi Developer |
Fri, 05 Apr 2002 03:00:00 GMT
Re:create shapes at runtimeHi! Please HELP!!!!!! A have to do a program which is very much like the M$ Paintbrush. I have done all the functions but one. On the Select Button, the program has to give the user the opportunity to select a rect and drag it somewhere else. The former place of the rect has to remain blanc. I didn't yet manage to implement this functionality. All the drawing is done on the Canvas of a TImage. The shapes(rect, filledrect, roundrect, etc ) are done on the MouseMove event by calling a procedure DrawShape. Something like this: procedure TFormPaintBrush.DrawShape(TopLeft, BottomRight: TPoint; AMode: I would sincerely appreciate if somebody could help me with the SELECT/Drag&Drop |
Maynard Philbroo
![]() Delphi Developer |
Fri, 05 Apr 2002 03:00:00 GMT
Re:create shapes at runtimeWhat i do to make things simple is to dynamicly create a Timage and copy the rect information to it then move the Timage as the mouse moves to a new location.. this way the information under it will stay valid. Var Drag:Timage; Begin Drag := Timage.Create(Application); Drag.Width := ? Drag.Hieght := ? Drag.Parent := MyMasterTimage ect.... Drag.Canvas.CopyRect(................. -- Now just position the Image where you want on the screen using the Left,Top of the Image.. QuoteMarius Bunescu wrote: |
Earl F. Glyn
![]() Delphi Developer |
Fri, 05 Apr 2002 03:00:00 GMT
Re:create shapes at runtimeQuoteMarius Bunescu <mar...@crinsoft.ro> wrote in message Quote> On the Select Button, the program has to give the user the opportunity to 1. You need to have a rectangle selection tool that just You will want to make an in-memory TBitmap 2. Once this selection rectangle is in place, a MouseDown ___ Earl F. Glynn E-Mail: EarlGl...@att.net efg's Computer Lab: http://www.efg2.com/Lab |
2. Displaying a shape created at runtime on a form
3. drag/drop runtime created labels on runtime created pagecontrol
4. HELP: How to Resize Shapes at Runtime
5. newbie- adding shape component at runtime?
7. Creating a lookup/calculated field at runtime on a runtime TTable
8. Creating a button at runtime on a runtime form