473,659 Members | 2,582 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cant find UserControl in toolbox

JR
Hi,

i found a user control on the net see code below
it is part of VSEssential but I like the coolProgressBar . Zo I want to use
it into my program and I always get the error that it can't find the control
or the control isn't into the toolbar

Who has an idee

Jan

'----------------start code--------------------------------

Imports System.Manageme nt

Imports System.Drawing

Imports System.Drawing. Drawing2D

Imports System.Drawing. Imaging

Imports System.Drawing. Text

Public Class CoolProgressbar

Inherits System.Windows. Forms.Panel

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() call

Me.Font = New System.Drawing. Font("Arial", 10.0!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))

End Sub

'UserControl overrides dispose to clean up the component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()

'

'CoolProgressba r

'

Me.Name = "CoolProgressba r"

End Sub

#End Region

#Region " Fillstyle Enumeration "

'enumeration for fillstyles

Public Enum fillstyle

Solid = 0

Gradient = 1

End Enum

#End Region

#Region " Declare Variables & Default Values "

Private m_value As Integer = 0

Private m_maximum As Integer = 100

Private m_fillstyle As LinearGradientM ode = LinearGradientM ode.Vertical

Private m_fill1 As Color = Color.Red

Private m_fill2 As Color = Color.Black

Private m_border As Color = SystemColors.Co ntrolDark

Private m_borderwidth As Integer = 1

Private m_showpercent As Boolean = True

Private m_showborder As Boolean = True

Private m_TextColor As Color = Color.White

Private m_ShadowColor As Color = Color.Black

Private m_aText As String = ""

Private m_bText As String = ""

Private m_backfillstyle As LinearGradientM ode =
LinearGradientM ode.Horizontal

Private m_backfill1 As Color = SystemColors.Co ntrolLight

Private m_backfill2 As Color = SystemColors.Co ntrolDark

#End Region

#Region " Public Properties "

Public Property Gradient_BackFi ll_2() As Color

Get

Return m_backfill2

End Get

Set(ByVal Value As Color)

m_backfill2 = Value

Invalidate()

End Set

End Property

Public Property Gradient_BackFi ll_1() As Color

Get

Return m_backfill1

End Get

Set(ByVal Value As Color)

m_backfill1 = Value

Invalidate()

End Set

End Property

Public Property BackFill() As LinearGradientM ode

Get

Return m_backfillstyle

End Get

Set(ByVal Value As LinearGradientM ode)

m_backfillstyle = Value

Invalidate()

End Set

End Property

Public Property BeforeText() As String

Get

Return m_bText

End Get

Set(ByVal Value As String)

m_bText = Value

Invalidate()

End Set

End Property

Public Property AfterText() As String

Get

Return m_aText

End Get

Set(ByVal Value As String)

m_aText = Value

Invalidate()

End Set

End Property

Public Property ShadowColor() As Color

Get

Return m_ShadowColor

End Get

Set(ByVal Value As Color)

m_ShadowColor = Value

Invalidate()

End Set

End Property

Public Property TextColor() As Color

Get

Return m_TextColor

End Get

Set(ByVal Value As Color)

m_TextColor = Value

Invalidate()

End Set

End Property

Public Property Borderwidth() As Integer

Get

Return m_borderwidth

End Get

Set(ByVal Value As Integer)

m_borderwidth = Value

Invalidate()

End Set

End Property

Public Property Border() As Color

Get

Return m_border

End Get

Set(ByVal Value As Color)

m_border = Value

Invalidate()

End Set

End Property

Public Property Showborder() As Boolean

Get

Return m_showborder

End Get

Set(ByVal Value As Boolean)

m_showborder = Value

Invalidate()

End Set

End Property

Public Property ShowPercent() As Boolean

Get

Return m_showpercent

End Get

Set(ByVal Value As Boolean)

m_showpercent = Value

Invalidate()

End Set

End Property

Public Property Gradient_Fill_2 () As Color

Get

Return m_fill2

End Get

Set(ByVal Value As Color)

m_fill2 = Value

Invalidate()

End Set

End Property

Public Property Gradient_Fill_1 () As Color

Get

Return m_fill1

End Get

Set(ByVal Value As Color)

m_fill1 = Value

Invalidate()

End Set

End Property

Public Property Fill() As LinearGradientM ode

Get

Return m_fillstyle

End Get

Set(ByVal Value As LinearGradientM ode)

m_fillstyle = Value

Invalidate()

End Set

End Property

Public Property Maximum() As Integer

Get

Return m_maximum

End Get

Set(ByVal Value As Integer)

If Me.Value > Value Then Value = Me.Value

If Value < 1 Then Value = 1

m_maximum = Value

Invalidate()

End Set

End Property

Public Property Value() As Integer

Get

Return m_value

End Get

Set(ByVal Value As Integer)

If Value > Me.Maximum Then Value = Me.Maximum

m_value = Value

Invalidate()

End Set

End Property

#End Region

Public Sub Increment()

If Value < Maximum Then Value += 1

End Sub

Private Function ComputeAreaFill () As Rectangle

If Value > 0 Then

Return New Rectangle(0, 0, Width * Value / Maximum, Height)

Else

Return New Rectangle(0, 0, 1, Height)

End If

End Function

Private Function ComputeTotalAre a(ByVal iOffset As Integer) As Rectangle

Return New Rectangle(0, 0, Width - iOffset, Height - iOffset)

End Function

Private Sub DrawFillComplet e(ByVal e As Graphics)

Dim rect As Rectangle = ComputeAreaFill ()

Dim SBrush As SolidBrush = New SolidBrush(Grad ient_Fill_1)

Dim LBrush As LinearGradientB rush = New LinearGradientB rush(rect, m_fill1,
m_fill2, Fill)

Dim BBrush As LinearGradientB rush = New LinearGradientB rush(rect,
m_backfill1, m_backfill2, BackFill)

'draw the background

e.FillRectangle (BBrush, 0, 0, Me.Width, Me.Height)

If Value > 0 Then

'draw the actual progress state

e.FillRectangle (LBrush, rect)

End If

'draw the border if the user wants it

If m_showborder = True Then

e.DrawRectangle (New Pen(m_border, m_borderwidth), ComputeTotalAre a(1))

End If

SBrush.Dispose( )

LBrush.Dispose( )

BBrush.Dispose( )

End Sub

Protected Overrides Sub OnPaint(ByVal e As
System.Windows. Forms.PaintEven tArgs)

MyBase.OnPaint( e)

DrawFillComplet e(e.Graphics)

If ShowPercent Then DrawPercentText (e.Graphics)

End Sub

Private Sub DrawPercentText (ByVal e As Graphics)

Dim sDisplayText As String

Dim TextPercent As Integer

If Value > 0 Then

TextPercent = Math.Round(Valu e / Maximum * 100)

sDisplayText = CStr(TextPercen t)

Else

TextPercent = 0

sDisplayText = CStr(TextPercen t)

End If

sDisplayText = sDisplayText & "%"

If m_bText <> "" Then sDisplayText = m_bText & " " & sDisplayText

If m_aText <> "" Then sDisplayText = sDisplayText & " " & m_aText

Dim strsize As SizeF = e.MeasureString (sDisplayText, Font)

Dim OffsetY As Integer

Select Case Me.BorderStyle

Case BorderStyle.Fix ed3D : OffsetY = 3

Case Else : OffsetY = 0

End Select

'draw the text

e.DrawString(sD isplayText, Font, New SolidBrush(m_Sh adowColor), ((Width -
strsize.Width) / 2), ((Height - strsize.Height) / 2 - OffsetY))

e.DrawString(sD isplayText, Font, New SolidBrush(m_Te xtColor), ((Width -
strsize.Width) / 2) - 1, ((Height - strsize.Height) / 2 - OffsetY) - 1)

End Sub

End Class


Nov 21 '05 #1
0 1811

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2700
by: Barney | last post by:
I created a usercontrol for my winForm (its a grid that will be used on multiple forms), now how can i add the usercontrol to the form(s)? thx
4
2144
by: steve bull | last post by:
I have created a UserControl and added it to my toolbox. It appears in the toolbox with the icon I created for it. The problem is that when I drag the control onto a form no code is generated. If I manually add the code for creating the control to the form everything works fine. I have created other controls w/o problems and cannot see anything I am doing different in this case. Does anyone have any idea what I could be doing wrong? ...
2
5953
by: Noozer | last post by:
This is a stupid question, I know, but I can't figure it out... Someone please embarass me. I have a solution that has a number of usercontrols included. When I add a usercontrol project to the solution the control does not automatically appear in the "My User Controls" toobox. I'm going to the FILE menu and choosing "Add Project -> Add Existing Project" Eventually, after several builds, etc. the control appears in the toolbox,
1
1159
by: Dennis | last post by:
I start a new project (Windows UserControl Library) and Name it "TestControl". I then open the vb code module and change the class name from UserControl1 to "TestControl" and the inheirits to a panel. I then build the solution. I start a new project (Windows Application) and go to the ToolBox UserControl tab, I right click on User Control tab then select Browse and select the TestControl.dll. In the ToolBox UserControl Tab, the name...
0
8428
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8751
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.