can we have some other shapes of text boxes? or even of labels?
I want to write in curve mode or zigzag type format?
Is there any property or sth by which i can get this?
7 1399
no there is no such property . Try use some third party control if you can find.
what do you mean by third party control?
This is only very basic and I have pathced it together from a few googles so you can probably get something better but - -
-
Public Class Form1
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
Dim test As New fancytext
-
test.Multiline = True
-
test.Text = vbCrLf & " Oval textbox! "
-
Dim p As Graphicspath = New GraphicsPath
-
Dim reg As Region
-
Dim sf As New StringFormat
-
p.AddEllipse(10, 0, 80, 50) '
-
reg = New Region(p)
-
Me.Controls.Add(test)
-
test.Region = reg
-
test.Location = New System.Drawing.Point(30, 30)
-
-
End Sub
-
-
Public Class fancytext
-
Inherits RichTextBox
-
-
End Class
-
End Class
-
-
-
and just out of curiosity here is some code to create 2x oval buttons, it took a bit of time to work out how to get them to handle a click though :)
it was quite a bit of playing to get these to work and the textbox is quite awkward as the code I have above means that if you actually try to type into it you cannot see any text that is entered outside the boundarys so as sugested you are probably better finding a control that had been written by somebody else and then you can just add it to you project in the same way as an ordinary textbox -
-
Imports System.Drawing.Drawing2D
-
Imports System
-
Imports System.Drawing.Text
-
Imports System.Drawing
-
Public Class Form1
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
Dim test As New fancytext("Test")
-
Dim test2 As New fancytext("Test2")
-
' test.Multiline = True
-
Dim p As GraphicsPath = New GraphicsPath
-
Dim reg As Region
-
Dim sf As New StringFormat
-
p.AddEllipse(5, 20, 80, 50) '
-
reg = New Region(p)
-
-
Me.Controls.Add(test)
-
test.Text = vbCrLf & "Click me!"
-
test.Location = New System.Drawing.Point(20, 20)
-
test.Size = New System.Drawing.Size(90, 80)
-
test.Region = reg
-
-
Me.Controls.Add(test2)
-
test2.Text = vbCrLf & "Click me!"
-
test2.Location = New System.Drawing.Point(100, 20)
-
test2.Size = New System.Drawing.Size(90, 80)
-
test2.Region = reg
-
-
End Sub
-
-
-
Public Class fancytext
-
Inherits Button
-
-
Private BName As String
-
-
Public Sub New(ByVal nam As String)
-
BName = nam
-
End Sub
-
-
Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
-
MyBase.OnClick(e)
-
MsgBox(BName)
-
-
-
End Sub
-
-
End Class
-
-
-
End Class
-
-
,yeah yeah I know.. I just realised that I didn't really need to create a new class and could have just changed the region on an existing control <:)
I will leave the code there though as it could probably be amended fairly easily to actually create a control with the preset shape
this code amends an existing label but I had to change the label to not use auto size -
-
Imports System.Drawing.Drawing2D
-
Imports System
-
Imports System.Drawing.Text
-
Imports System.Drawing
-
Public Class Form1
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
-
-
-
Dim p As GraphicsPath = New GraphicsPath
-
Dim reg As Region
-
p.AddEllipse(0, 0, 90, 50) '
-
reg = New Region(p)
-
Label1.Region = reg
-
Label1.Text = "test"
-
Label1.BackColor = Color.Azure
-
Label1.Size = New System.Drawing.Size(100, 60)
-
Label1.AutoSize = False
-
Label1.TextAlign = ContentAlignment.MiddleCenter
-
-
-
End Sub
-
-
lol, gonna have to thank you as I have found a few interesting things trying to answer this.
for a star shaped button - -
-
Imports System.Drawing.Drawing2D
-
'
-
Public Class Form1
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
Dim xPoints As Integer() = {55, 67, 109, 73, 83, 55, 27, 37, 1, 43}
-
Dim yPoints As Integer() = {0, 36, 36, 54, 96, 72, 96, 54, 36, 36}
-
Dim brush As SolidBrush = New SolidBrush(Color.DarkMagenta)
-
-
-
Dim p As GraphicsPath = New GraphicsPath
-
Dim reg As Region
-
For i = 0 To 8 Step 2
-
p.AddLine(xPoints(i), yPoints(i), xPoints(i + 1), yPoints(i + 1))
-
Next
-
-
-
reg = New Region(p)
-
Button1.Image = Nothing
-
-
Button1.Region = reg
-
Button1.Text = " Click "
-
Button1.BackColor = Color.Azure
-
Button1.Size = New System.Drawing.Size(110, 105)
-
Button1.AutoSize = False
-
-
Button1.TextAlign = ContentAlignment.MiddleCenter
-
-
-
-
End Sub
-
-
-
End Class
-
-
what do you mean by third party control?
you need to use componenets from vendors other than MS.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mf_sina |
last post by:
Hi all!
I have worked eith vb 6 and used custom shapes such as
circle,elipse,Rectangle and ...
But these shapes are not in vb .net?
How can i get them?
Best wishes...
|
by: Mats-Lennart Hansson |
last post by:
Hi,
I'm creating some user controls that are in different shapes. When doing
this I use this.region to set the shape that I want and then I use
graphics.DrawRectangle (or whatever shape I have) to...
|
by: Crirus |
last post by:
There are some classes to reproduce geometrical shapes like circles or
squares? as there is rectangle
--
Cheers,
Crirus
------------------------------
If work were a good thing, the boss...
|
by: Andreas Schubert |
last post by:
Hello newsgroup,
I am pretty new to .NET and need some advise on
how to approach to the following:
I have to create an application with a drawing surface, where some
predefined shapes...
|
by: excelthoughts |
last post by:
Hi,
In VBA, you can select shapes and control them using
Selection.ShapeRange. There is no equivalent in C#.
See...
|
by: Kristian Frost |
last post by:
Hi,
I'm trying to add, as you might guess, mouseclick listeners to the shapes
I am drawing using the GDI+ commands in a similar sort of way as could be
done with the old VB "shapes".
Problem is,...
|
by: alwayssmiling |
last post by:
Hi,
Im drawing some shapes on the image surface (i.e when im displaying the image ) with the help of graphics. Since i want to move thsese shapes from one place to other place in the...
|
by: weird0 |
last post by:
i have successfully emebedded visio drawing tool in my application.
Infinite number of shapes can be added to the drawing.
How can i write double click event handler for the the shapes added
to...
|
by: Sunny |
last post by:
Hi I have a div called shape on my page.
When I try to get its length using javascript in IE, everything works
fine.
But When I try it in Firefox it has element has no properties.
Here is the...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |