Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

AutoShapes on User Forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JBNewsGroup - 30 Oct 2004 06:41 GMT
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
Jay Freedman - 01 Nov 2004 17:39 GMT
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.

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> Hi,
>
[quoted text clipped - 10 lines]
>
> Jerry Bodoff
JBNewsGroup - 01 Nov 2004 20:11 GMT
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

> Hi Jerry,
>
[quoted text clipped - 16 lines]
> >
> > Jerry Bodoff
Al Borges - 10 Nov 2004 09:06 GMT
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

> Hi Jay,
>
[quoted text clipped - 30 lines]
> > >
> > > Jerry Bodoff
Jay Freedman - 10 Nov 2004 15:39 GMT
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!

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> Hi Guys:
>
[quoted text clipped - 71 lines]
>>>>
>>>> Jerry Bodoff
Al Borges MD - 12 Nov 2004 03:01 GMT
Oh boy... the MS Word forms are great, but are pretty basic. Haven't come
across anything like that!

Al

> Hi Al,
>
[quoted text clipped - 82 lines]
> >>>>
> >>>> Jerry Bodoff
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.