Line and Shape Controls For Visual Basic Just Released

Published 13 August 07 04:52 PM

The VB Team just released an updated version of the Visual Basic Power Packs on the VB Developer Center that includes a new set of controls for Visual Studio 2005 that allow you to draw lines, rectangle and oval shapes on your Windows Forms. These controls encapsulate many of the graphics methods that are contained in the System.Drawing namespace. This enables you to draw lines and shapes in a single step without having to create graphics objects, pens, and brushes. Complex graphics techniques such as gradient fills can be accomplished by just setting some properties. 

I don't know about you but I've been really looking forward to this release! 

Enjoy!

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# MSDN Blog Postings » Line and Shape Controls For Visual Basic Just Released said on August 13, 2007 9:15 PM:

PingBack from http://msdnrss.thecoderblogs.com/2007/08/13/line-and-shape-controls-for-visual-basic-just-released/

# Jumbalia said on August 18, 2007 2:37 AM:

These shapes are great!  I have already redesigned my current application. I love the rounded corners!

Thanks VB Team.

Hey does anyone know how to make a label tansparent, through the gradient fill?

Thanks!

# Dvsriram said on December 21, 2007 1:39 AM:

Hi ,

        I liked the powerpacks but i amnot able to use the shape controls like  the other controls (in system.windows.forms ), when i am creating an instance of shape control and adding it to the picture box it is raising exception

"Value of type'Microsoft.VisualBasic.PowerPacks.RectangleShape' cannot be converted to 'System.Windows.Forms.Control'.

I want to use those controls like label,Tb,Checkbox and i want to add to the picturebox control .Is there any other way to create line,Rectangle ,oval and add to the picturebox .I reallly want these things in my application

# Beth Massi said on January 2, 2008 9:37 PM:

Hi Dvsriram,

You can't add the shapes to a picturebox control, instead use a panel and set the backgroundimage and then add the shape container and shapes to that. For instance,

'-----------------------------

Sub Setup()

       'setup the panel

       Dim p As New System.Windows.Forms.Panel

       p.BackgroundImage = My.Resources.MyPicture

       p.BackgroundImageLayout = ImageLayout.Stretch

       p.Dock = DockStyle.Fill

       'setup shape container

       Dim sContainer As New Microsoft.VisualBasic.PowerPacks.ShapeContainer

       sContainer.Dock = DockStyle.Fill

       'setup shapes

       Dim l As New Microsoft.VisualBasic.PowerPacks.LineShape

       Dim o As New Microsoft.VisualBasic.PowerPacks.OvalShape

       Dim r As New Microsoft.VisualBasic.PowerPacks.RectangleShape

       'setup line

       l.X1 = 100

       l.X2 = 500

       l.Y1 = 100

       l.Y2 = 500

       'setup oval

       o.Size = New System.Drawing.Size(500, 500)

       r.Location = New System.Drawing.Point(200, 200)

       o.BorderColor = Color.Blue

       'setup rectangle

       r.Size = New System.Drawing.Size(400, 400)

       r.Location = New System.Drawing.Point(100, 100)

       r.BorderColor = Color.Red

       'add shapes to shape container

       sContainer.Shapes.Add(l)

       sContainer.Shapes.Add(o)

       sContainer.Shapes.Add(r)

       'add shape container to the panel

       p.Controls.Add(sContainer)

       'add the panel to the form

       Me.Controls.Add(p)

   End Sub

'-----------------------------

Cheers,

-Beth

# D.V.Sriram said on January 10, 2008 12:19 AM:

Thanks For giving the information ,

I am creating panels at runtime on clicking a particular panel .Now i am able to create the control s , lineShape,RectangleShape ,OvalShape on panel (At runtime )which is generated at runtime .

Now i have to do these things ::

I used for this class for Control (Type ) selection & resizing from

www.codeproject.com/KB/miscctrl/CSPickBoxSample1.aspx?df=100&forumid=23756&exp=0&select=1033576

while creating a control as PickBox.WireControl(ControlName) .It taking care of Control(Type)(TextBox,etc ) selection& resizing .

Now ,I need for moving and resizing controls (labels/textboxes/checkboxes/etc) and

shape controls (LineShape ,RectangleShape, OvalShape which are from

powerpacks.dll ) which i  place on the Panel which are generated at runtime .

Is there any Class for creating Control Selection and Resizing Handles  which accepts any typeof controls which are present on the panel at runtime ??????

I want to show the selection if user presses the control and able to resize

those controls with resizing handles for Any Typeof control . ????? Line i want only 2 SizingHandles  at end points like that .

' If i release the mouse button after resizing it has to update the size or

location of that control  same like in vs2005 design time environment but

here at runtime .

plzzz ,

# D.V.Sriram said on January 10, 2008 5:40 AM:

I want a user to select & rezise a control at runtime using some grab handles on panel (also generated at runtime ) . Here i am having different controls that's the problem if i have normal control no problem .but here 4 Different controls RectangleShape,OvalShape,LineShape,Control (TextBox,....)

THis is main meaning .Please do this favour for giving a nice thing .

THanks & Regards

Sriram

# sabzpooshan@yahoo.com said on June 22, 2008 2:42 AM:

Dear Beth Massi

The Power Pack elements like line or rectangle has constructor of Integer but I wanna single data type constructor. What do you offer for it.

Another question is:How can I make a class that create line and rectangle objects(or component)

Thanks a lot for your attention

Sabzpooshan

Leave a Comment

(required) 
(optional)
(required) 

About Beth Massi

Beth is an Online Content and Community Program Manager on the Visual Studio Community Team responsible for producing content for business application developers and driving community features onto MSDN Developer Centers (http://msdn.com/). She also produces content on her blog (http://blogs.msdn.com/bethmassi), Channel 9 (http://channel9.msdn.com/), and a variety of other developer sites. As a Visual Basic community champion and a long-time member of the Microsoft community she also helps with the San Francisco East Bay .NET user group and is a frequent speaker at various software development events. Before Microsoft, she was a Senior Architect at a health care software product company and a Microsoft Solutions Architect MVP. Over the last decade she has worked on distributed applications and frameworks, web and Windows-based applications using Microsoft development tools in a variety of businesses. She loves teaching, hiking, mountain biking, and modifying cars.

This Blog

Syndication

Page view tracker