Re: AutoShapes on User Forms

From: Jay Freedman (jay.freedman_at_verizon.net)
Date: 11/10/04


Date: Wed, 10 Nov 2004 10:39:32 -0500

Hi Al,

That code draws AutoShapes on the active document, but the original question
was about drawing them on a UserForm -- that's a whole different issue. If
you come across some reference to how to do that, please let us know!

-- 
Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org
> Hi Guys:
>
> Actually, you CAN draw autoshapes- I would have answered differently
> 48 hours ago, but after rifling though a neat, small MS Word book I
> just purchased called "Writing Word Macros" by O'Reilly, they
> dedicated a whole chapter to this issue. In fact, you can even
> animate the damn things... very cool!
>
> You have to go towards the back of the book, to appendix B: The Shape
> Object. Here is a sample code where you would draw 2 shapes, shSquare
> (a dark square) and shRect (a shaded rectangle):
>
> Dim shSquare As Shape
> Dim shRect As Shape
> Dim rng As Range
>
> Set rng = Selection.Range
> Set shSquare = ActiveDocuments.Shapes.AddShape(msoShapeRectangle, 0,
> 0, 72, 72, rng)
> Set shRect = ActiveDocuments.Shapes.AddShape(msoShapeRectangle, 0, 0,
> 144, 36, rng)
>
> shSquare.Fill.ForeColor.RGB = RGB(196, 196, 196)
> shRect.Fill.ForeColor.RGB = RGB(216, 216, 216)
>
> etc etc etc
>
> You can create shapes, and also work directly with autoshapes- they
> list over 100 MsoAutoShapeType constants that support this method.
>
> If you use the "delay" method you can then turn the autoshaps into an
> animated show.
>
> Regards,
> AL
>
>
> "JBNewsGroup" <jerrybemail-newsgroup@yahoo.com> wrote in message
> news:eOe9WaEwEHA.1308@TK2MSFTNGP09.phx.gbl...
>> Hi Jay,
>>
>> Thanks for your reply. I was assuming that one had to be tricky, but
>> you never know.  No sense re-inventing the wheel. Right now I am
>> starting to play around with drawing the shape in the document and
>> then using clipboard to cut and paste.  I did find an API for
>> drawing polygons, but, I am not sure if its worth the effort, or
>> even if it would work (have to read some more).
>>
>> Once again thanks.
>>
>> Jerry Bodoff
>>
>>
>> "Jay Freedman" <jay.freedman@verizon.net> wrote in message
>> news:eTTqdFDwEHA.1400@TK2MSFTNGP11.phx.gbl...
>>> Hi Jerry,
>>>
>>> In the absence of any positive replies, I'll stick my neck out and
>>> say no, it isn't possible. You might be able to fake something with
>>> an Image control and a batch of pre-drawn bitmaps that you read
>>> from disk.
>>>
>>> --
>>> Regards,
>>> Jay Freedman
>>> Microsoft Word MVP          FAQ: http://word.mvps.org
>>>
>>> JBNewsGroup wrote:
>>>> Hi,
>>>>
>>>> I am using WORD 2000 and I have a question about AutoShapes.
>>>>
>>>> Is it at all possible to "draw" AutoShapes on a user form?  If
>>>> API's are required to do this that is acceptable.  What I would
>>>> like to accomplish is a type of  "preview frame" to show the user
>>>> what is being drawn based on his selection of shape parameters.
>>>> At the present I only have 4 shapes; rectangle, triangle, diamond
>>>> and circle ( there may be others in the future).
>>>>
>>>> Thanks in advance for any help or tips.
>>>>
>>>> Jerry Bodoff


Relevant Pages

  • Re: Drawing on DC
    ... class Circle: public Drawing { ... It would be *called* from OnDraw, ... You should only draw when you need to draw, ... Drawing your objects on a bitmap merely renders the circle, rectangle, etc. as bits (which ...
    (microsoft.public.vc.mfc)
  • Re: Eye (MF) jab, poke, gauge, ... : how to train
    ... to perfection even... ... Each skill is variously different. ... like Drawing -vs- Painting, which is why I brought that up. ... to draw a mech robot, and her drawing will suck too. ...
    (rec.martial-arts)
  • Re: howto avoid cdc drawing done not in onPaint to be erased?
    ... i need to draw something. ... And the answer is, if you want to do a drawing, then yes, you need to store every point ... A DC holds no display information; it holds the information required to CREATE the ... cases, for durations measuable in seconds, although small hundreds of milliseconds are ...
    (microsoft.public.vc.mfc)
  • Re: Anchors and Objects
    ... Now drawing a line is no big deal. ... your main display PictureBox and once into a hidden Autoredraw PictureBox. ... PictureBox using a draw width two pixels greater than the draw width you ...
    (microsoft.public.vb.general.discussion)
  • Re: Drawing a spoke diagram?
    ... In autoshapes select the "summing junction" in the flowchart menu. ... Again draw lines matching the lines on ... Attached is a finished spoke diagram made in Word. ...
    (microsoft.public.word.drawing.graphics)