May 13th, 2006, 09:07 PM
#1
Thread Starter
Frenzied Member
May 13th, 2006, 09:12 PM
#2
Thread Starter
Frenzied Member
Re: Splitter
well...i find an example of how to do this control in c#, in http://www.windowsforms.net/Default....dex=4&tabid=49 (Outlook 2003 Look and Feel ) ...but i cant convert it to vb.net... any help ?
thx in advance...
May 13th, 2006, 09:47 PM
#3
Re: Splitter
There are links to code converters in my signature. Most C# code is quite easily converted to VB.NET anyway. If you just look at it line by line most code is almost exactly the same. If you know a few of the syntax rules that's all you need. Most of those you can figure out for yourself too.
May 13th, 2006, 10:07 PM
#4
Thread Starter
Frenzied Member
May 13th, 2006, 11:23 PM
#5
Re: [RESOLVED] Splitter
That looks really good zuperman! Very pretty Gui, and not over the top!
May 14th, 2006, 09:29 AM
#6
Thread Starter
Frenzied Member
Re: [RESOLVED] Splitter
Originally Posted by
|2eM!x
That looks really good zuperman! Very pretty Gui, and not over the top!
thx... im doing my best...regards...
May 14th, 2006, 12:38 PM
#7
Hyperactive Member
Re: [RESOLVED] Splitter
DevComponent's DotNetBar has an excellent splitter control for VB/C# 2003/2005. Including awesome Office 2007 controls.
May 14th, 2006, 01:22 PM
#8
Thread Starter
Frenzied Member
Re: [RESOLVED] Splitter
Originally Posted by
tylerm
DevComponent's DotNetBar has an excellent splitter control for VB/C# 2003/2005. Including awesome Office 2007 controls.
$189 for a set of slow components...no thanks...
May 15th, 2006, 09:30 AM
#9
Thread Starter
Frenzied Member
Re: [RESOLVED] Splitter
sharing the code
VB Code:
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
Public Class mySplitContainer
Dim objColorTable As New ProfessionalColorTable
Dim mcolGradientStart As Color = objColorTable.OverflowButtonGradientMiddle
Dim mcolGradientEnd As Color = objColorTable.OverflowButtonGradientEnd
Property SplitterColorStart() As Color
Get
SplitterColorStart = mcolGradientStart
End Get
Set(ByVal Value As Color)
mcolGradientStart = Value
End Set
End Property
Property SplitterColorEnd() As Color
Get
SplitterColorEnd = mcolGradientEnd
End Get
Set(ByVal Value As Color)
mcolGradientEnd = Value
End Set
End Property
Private Sub mySplitContainer_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim bounds As Rectangle = sender.SplitterRectangle
Dim squares As Integer
Dim maxSquares As Integer = 9
Dim squareSize As Integer = 4
Dim boxSize As Integer = 2
Dim enuOrientation As Orientation = sender.orientation
Dim g As Graphics = e.Graphics
Dim Colorbegin As Color = mcolGradientStart
Dim Colorend As Color = mcolGradientEnd
If (bounds.Width > 0) AndAlso (bounds.Height > 0) Then
If enuOrientation = Windows.Forms.Orientation.Vertical Then
Dim b As Brush = New LinearGradientBrush(bounds, Colorbegin, Colorend, LinearGradientMode.Horizontal)
Try
g.FillRectangle(b, bounds)
Finally
CType(b, IDisposable).Dispose()
End Try
If (bounds.Height > squareSize) AndAlso (bounds.Width > squareSize) Then
squares = Math.Min((bounds.Height / squareSize), maxSquares)
Dim start As Integer = (bounds.Height - (squares * squareSize)) / 2
Dim X As Integer = bounds.X + 1
Dim dark As Brush = New SolidBrush(objColorTable.GripDark)
Dim middle As Brush = New SolidBrush(objColorTable.ToolStripBorder)
Dim light As Brush = New SolidBrush(objColorTable.ToolStripDropDownBackground)
Dim idx As Integer = 0
While idx < squares
g.FillRectangle(dark, X, start, boxSize, boxSize)
g.FillRectangle(light, X + 1, start + 1, boxSize, boxSize)
g.FillRectangle(middle, X + 1, start + 1, 1, 1)
start += squareSize
System.Math.Min(System.Threading.Interlocked.Increment(idx), idx - 1)
End While
dark.Dispose()
middle.Dispose()
light.Dispose()
End If
Else
Dim b As Brush = New LinearGradientBrush(bounds, Colorbegin, Colorend, LinearGradientMode.Vertical)
Try
g.FillRectangle(b, bounds)
Finally
CType(b, IDisposable).Dispose()
End Try
If (bounds.Width > squareSize) AndAlso (bounds.Height > squareSize) Then
squares = Math.Min((bounds.Width / squareSize), maxSquares)
Dim start As Integer = (bounds.Width - (squares * squareSize)) / 2
Dim Y As Integer = bounds.Y + 1
Dim dark As Brush = New SolidBrush(objColorTable.GripDark)
Dim middle As Brush = New SolidBrush(objColorTable.ToolStripBorder)
Dim light As Brush = New SolidBrush(objColorTable.ToolStripDropDownBackground)
Dim idx As Integer = 0
While idx < squares
g.FillRectangle(dark, start, Y, boxSize, boxSize)
g.FillRectangle(light, start + 1, Y + 1, boxSize, boxSize)
g.FillRectangle(middle, start + 1, Y + 1, 1, 1)
start += squareSize
System.Math.Min(System.Threading.Interlocked.Increment(idx), idx - 1)
End While
dark.Dispose()
middle.Dispose()
light.Dispose()
End If
End If
End If
sender.splitterwidth = 6
End Sub
End Class
regards...
May 15th, 2006, 10:02 AM
#10
Re: [RESOLVED] Splitter
Hi,
Zuperman, thanks for the sharing of this code but I've got some trouble with it! See the two lines!
Originally Posted by
zuperman
sharing the code
VB Code:
Public Class mySplitContainer
Dim objColorTable As New [COLOR=Red]ProfessionalColorTable[/COLOR]
' Have some trouble with this line: Type 'ProfessionalColorTable' is not defined.
Private Sub mySplitContainer_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles [COLOR=Red]Me.Paint[/COLOR]
' Have some trouble with this line: Keyword is not valid as an identifier.
regards...
Thanks in advance,
sparrow1
May 15th, 2006, 10:37 AM
#11
Thread Starter
Frenzied Member
Re: [RESOLVED] Splitter
partial class grrrr....
i will attach all the solution project for this component...
chang it at your will...
regards...
Attached Files
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width