Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to Create Cloud shape?

Posted on 1998-04-25
14
698 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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
 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

792 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