Solved

How to Create Cloud shape?

Posted on 1998-04-25
14
685 Views
Last Modified: 2008-03-17
In Vb you can create the standard Shapes  Rectangle,Square,Circle,Rounded Rectangle,Rounded Square.

How to create a  Cloud shape?
0
Comment
Question by:srinivasan042598
  • 6
  • 3
  • 2
  • +3
14 Comments
 

Expert Comment

by:shaver
ID: 1429547
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
0
 

Author Comment

by:srinivasan042598
ID: 1429548
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.
0
 
LVL 1

Expert Comment

by:dufort
ID: 1429549
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.

0
 

Author Comment

by:srinivasan042598
ID: 1429550
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
0
 
LVL 1

Expert Comment

by:lbk
ID: 1429551
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.
0
 

Author Comment

by:srinivasan042598
ID: 1429552
I am new to VB. Will it be possible to give a sample code ?

TIA

srinivasan
0
 
LVL 1

Expert Comment

by:EvanL
ID: 1429553
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!
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:srinivasan042598
ID: 1429554
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
0
 
LVL 4

Expert Comment

by:zsi
ID: 1429555
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
0
 

Author Comment

by:srinivasan042598
ID: 1429556
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.  
0
 
LVL 4

Accepted Solution

by:
zsi earned 100 total points
ID: 1429557
srinivasan,

There is no such thing as a cloud shape.  However, since you do not want to use a picture box (I assume you do not want the overhead of using an additional Windows' handle), then try one of these two methods:

Either
 1) Create (or filch) a cloud metafile and draw it to your form using the DrawMetafileEx API command and put the code in the form_paint method or
 2) Just draw the thing yourself using either the form's drawing methods or the API's drawing functions.

Either way, these are your only alternatives if you do not want to use a picturebox or some similar heavy-weight control.

zsi
0
 
LVL 4

Expert Comment

by:zsi
ID: 1429558
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
0
 
LVL 1

Expert Comment

by:dufort
ID: 1429559
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.

0
 

Author Comment

by:srinivasan042598
ID: 1429560
Mr Zsi, Thank you for your clarification,suggestion and explanation.

Mr. dufort, Thank you for help for further clarification

Kind Regards,

srinivasan
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now