How to make a circle with text inside ?? then move it from one location to another, and then access it later (to delete it).
I want to make something like this
How to make a circle with text inside ?? then move it from one location to another, and then access it later (to delete it).
I want to make something like this
Your question is really very broad and you got a few nice links you should study to learn all about GDI+
drawing.
But if taken literally there is a slightly exotic alternative which puts the burdon of most chores onto the Chart
control from DataVisualization.Charting
.
You can create EllipseAnnotations
and add them to a Chart
control.
Disable the Axes
and clear the Legends
and then use code like this to add a moveable circle wit thext inside:
EllipseAnnotation ea = new EllipseAnnotation();
ea.X = 11; // put at..
ea.Y = 11; // 11% of the chart's area
ea.AllowMoving = true;
ea.BackColor = Color.BlanchedAlmond;
ea.Text = (chart1.Annotations.Count + 1) + "";
chart1.Annotations.Add(ea);
Note that there are quite a few annotation types available. which allow you to add Rectangles
, Images
, Polygons
, Lines
and pure Text
.
And another pro is that saving or loading the graphics takes only one line each, as you can serialize a Chart
out of the box!
:-)
GraphX for .NET is an advanced open-source graph layout and visualization library that supports different layout algorithms and provides many means for visual customizations It is capable of rendering large amount of vertices
To draw shapes follow here.Also you need a complete tut,you can follow here
Some insight is here:
To draw a simple shape at design time Drag the
OvalShape
orRectangleShape
control from the Visual Basic PowerPacks tab (to install, see Visual Basic Power Packs Controls)in the Toolbox to a form or container control.Drag the sizing and move handles to size and position the shape. You can also size and position the shape by changing the Size and Position properties in the Properties window To create a rectangle with rounded corners, select the CornerRadius property in the Properties window and set it to a value that is greater than 0. In the Properties window, optionally set additional properties to change the appearance of the shape.
To draw a simple shape at run time On the Project menu, click Add Reference. In the Add Reference dialog box, select
Microsoft.VisualBasic.PowerPacks.VS
, and then click OK. In the Code Editor, add an Imports or using statement at the top of the module:using Microsoft.VisualBasic.PowerPacks; Add the following code in an Event procedure: ShapeContainer canvas = new ShapeContainer(); // To draw an oval, substitute // OvalShape for RectangleShape. RectangleShape theShape = new RectangleShape(); // Set the form as the parent of the ShapeContainer. canvas.Parent = this; // Set the ShapeContainer as the parent of the Shape. theShape.Parent = canvas; // Set the size of the shape. theShape.Size = new System.Drawing.Size(200, 300); // Set the location of the shape. theShape.Location = new System.Drawing.Point(100, 100); // To draw a rounded rectangle, add the following code: theShape.CornerRadius = 12;
Customizing Shapes When you use the default settings, the OvalShape and RectangleShape controls are displayed with a solid black border that is one pixel wide and a transparent background. You can change the width, style, and color of the border by setting properties. Additional properties enable you to change the background of a shape to a solid color, a pattern, a gradient fill, or an image. Before you change the background of a shape, you should know how several of the properties interact. The
BackColor
property setting has no effect unless theBackStyle
property is set to Opaque. If theFillStyle
property is set to Solid, theFillColor
overrides theBackColor
. If theFillStyle
property is set to a pattern value such as Horizontal or Vertical, the pattern will be displayed in theFillColor
. The background will be displayed in theBackColor
, provided that theBackStyle
property is set to Opaque. In order to display a gradient fill, theFillStyle
property must be set to Solid and theFillGradientStyle
property must be set to a value other than None. Setting theBackgroundImage
property to an image overrides all other background settings.
This SO link I found is also nice here