Link to home
Start Free TrialLog in
Avatar of srinivasan042598
srinivasan042598

asked on

How to Create Cloud shape?

In Vb you can create the standard Shapes  Rectangle,Square,Circle,Rounded Rectangle,Rounded Square.

How to create a  Cloud shape?
Avatar of shaver
shaver

Here is how to show a cloud shape on a VB Form:

Open up the program Paint.  (This program should be under the accessories portion of the Start menu)

In Paint draw a cloud (or any other shape you want to create) and save it as cloud.bmp.

Next, in VB double click the picture box control.  Show the proporties box of the picture box you created.  Under "Picture" goto the directory of cloud.bmp.  Now there is a cloud in the picture box.

If you have any questions at all, feel free to ask.
Regards,
Luke
Avatar of srinivasan042598

ASKER

My question is not inserting picture. I would like to have a cloud shape similar to the standard shapes like  Rectangle,Square,Circle,Rounded Rectangle,Rounded Square.
Do you want your cloud to be drawn at any size? To be any color (fill & outline)? To be filled or outlined depending on a parameter? To be a simple procedure taking a PictureBox as one of its parameters, or to be an ExtendedPictureBox new class?

Depending on your answer, there are different options available.

Please give me more information, and I will help you.

Yes, I would like to draw any size,color like standard shape.
I consider  Cloud also as shape(or object.) i.e., it is rectangle with arcs (not straight line).
Is my assemption correct?  Is it possible?
If you could help me giving some code to construct the shape, I would be grateful.

TIA

srinivasan
You might want to consider writing a user control with appropriate properties, then draw the cloud using Line, Circle, etc methods of the custom control and setting it's backstyle property to transparent.
I am new to VB. Will it be possible to give a sample code ?

TIA

srinivasan
The best way to draw a cloud in VB without using any other drawing program is to draw 7-10 ovals and circles of the same color and fill and position them all together.  A cloud is nothing more than a bunch of circular shapes.  Try it - it works!
I would like have a cloud object not to draw cloud.
Mr.  lbk suggestion is OK. Since I am new to VB, I would really appreciate if some gives me some code.

Even  if  some one suggest some other shape/object
(i.e. Triangle) is also welcome
Since you are new and do not want to go through the hassle of drawing a cloud (which can get rather complex), I suggest this:

Find a clipart object (it's file format should be .wmf) and load it into a picture box.  You can then manipulate the picture box anyway that you want with regards to size.  The clipart format (properly known as Windows Meta File) is especially good for resizing.  There are many (free) resources on the Net for cliparts.  Just take a look through Yahoo.

Hope this helps!

zsi
As I previously stated , I am not interested  in manupulating  picture box. I would like to have a cloud shape similar to the standard shapes like  Rectangle,Square,Circle,Rounded Rectangle,Rounded Square.  
ASKER CERTIFIED SOLUTION
Avatar of zsi
zsi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It occurred to me that you might not understand what the stock VB shapes are.

Simply put, they are macros that get called each time the VB form is painted.  While it may seem as if they are controls, they aren't.  They do not have handles, have no events or methods, and do not permanently use up any Windows resources.  Because of this, they are what is referred to as a light-weight control.

Each time VB paints or redraws your form, it simply draws a circle, or sqaure, or whatever else is defined by that shape control.  However, they do not support user-defined shapes.
The reason for this is that VB simply executes the drawing commands based on the parameters that you set on the shape.

Hopefully, this explanation will help you to understand what the shape 'control' is and, if you want something different, why you have to do it yourself.

zsi
The meta-file thing seems a good idea. A user could draw a scaled meta-file anywhere. It's scalable and transparent.

By the way, this means that your cloud shape would be "static" (no color change, no shape change). But who's patient enough to design an object that takes nodes and draws a "custom" cloud afterwards? For that, you would need an entire nodes-editing tool. And filling it is out of the question. Far too complicated.

What about stating that a cloud is a set of filled circles? Simply design an object keeping an array of circles data and the color, and call this object for repainting.

Mr Zsi, Thank you for your clarification,suggestion and explanation.

Mr. dufort, Thank you for help for further clarification

Kind Regards,

srinivasan