jj: Add LookupGrid Control, Work in Progress!

This commit is contained in:
Jonathan Jenne 2018-10-08 16:34:25 +02:00
parent bc740898cc
commit 513ee837fb
16 changed files with 126 additions and 125 deletions

View File

@ -1,5 +1,5 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class LookupGrid Partial Class Grid
Inherits System.Windows.Forms.UserControl Inherits System.Windows.Forms.UserControl
'UserControl überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. 'UserControl überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
@ -37,7 +37,7 @@ Partial Class LookupGrid
' '
Me.Button1.Location = New System.Drawing.Point(237, 0) Me.Button1.Location = New System.Drawing.Point(237, 0)
Me.Button1.Name = "Button1" Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(56, 20) Me.Button1.Size = New System.Drawing.Size(37, 20)
Me.Button1.TabIndex = 1 Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1" Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True Me.Button1.UseVisualStyleBackColor = True

8
LookupGrid/Grid.vb Normal file
View File

@ -0,0 +1,8 @@

Public Class Grid
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
End Sub
End Class

17
LookupGrid/GridControl.vb Normal file
View File

@ -0,0 +1,17 @@
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Registrator
Public Class LookupGridControl
Inherits GridControl
Protected Overrides Function CreateDefaultView() As BaseView
Return CreateView("LookupGridView")
End Function
Protected Overrides Sub RegisterAvailableViewsCore(ByVal collection As InfoCollection)
MyBase.RegisterAvailableViewsCore(collection)
collection.Add(New GridViewInfoRegistrator())
End Sub
End Class

18
LookupGrid/GridHandler.vb Normal file
View File

@ -0,0 +1,18 @@
Imports System.Windows.Forms
Imports DevExpress.XtraGrid.Views.Grid
Public Class GridHandler
Inherits Handler.GridHandler
Public Sub New(ByVal gridView As GridView)
MyBase.New(gridView)
End Sub
Protected Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
MyBase.OnKeyDown(e)
If e.KeyData = Keys.Delete AndAlso View.State = GridState.Normal Then
View.DeleteRow(View.FocusedRowHandle)
End If
End Sub
End Class

View File

@ -3,22 +3,20 @@ Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.Base.Handler Imports DevExpress.XtraGrid.Views.Base.Handler
Imports DevExpress.XtraGrid.Registrator Imports DevExpress.XtraGrid.Registrator
Namespace LookupGrid Public Class GridViewInfoRegistrator
Public Class MyGridViewInfoRegistrator
Inherits GridInfoRegistrator Inherits GridInfoRegistrator
Public Overrides ReadOnly Property ViewName() As String Public Overrides ReadOnly Property ViewName() As String
Get Get
Return "LookupGridView" Return "GridView"
End Get End Get
End Property End Property
Public Overrides Function CreateView(ByVal grid As GridControl) As BaseView Public Overrides Function CreateView(ByVal grid As GridControl) As BaseView
Return New LookupGridView(grid) Return New LookupGridView(grid)
End Function End Function
Public Overrides Function CreateHandler(ByVal view As BaseView) As BaseViewHandler Public Overrides Function CreateHandler(ByVal view As BaseView) As BaseViewHandler
Return New LookupGridHandler(TryCast(view, LookupGridView)) Return New GridHandler(TryCast(view, LookupGridView))
End Function End Function
End Class End Class
End Namespace

View File

@ -1,4 +0,0 @@

Public Class LookupGrid
End Class

View File

@ -6,8 +6,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3DCD6D1A-C830-4241-B7E4-27430E7EA483}</ProjectGuid> <ProjectGuid>{3DCD6D1A-C830-4241-B7E4-27430E7EA483}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>LookupGrid</RootNamespace> <RootNamespace>DigitalData.Controls.LookupGrid</RootNamespace>
<AssemblyName>LookupGrid</AssemblyName> <AssemblyName>DigitalData.Controls.LookupGrid</AssemblyName>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<MyType>Windows</MyType> <MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
@ -18,7 +18,7 @@
<DefineDebug>true</DefineDebug> <DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace> <DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>LookupGrid.xml</DocumentationFile> <DocumentationFile>DigitalData.Controls.LookupGrid.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@ -27,7 +27,7 @@
<DefineTrace>true</DefineTrace> <DefineTrace>true</DefineTrace>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DocumentationFile>LookupGrid.xml</DocumentationFile> <DocumentationFile>DigitalData.Controls.LookupGrid.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@ -105,18 +105,18 @@
<Compile Include="frmLookupGrid.vb"> <Compile Include="frmLookupGrid.vb">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="LookupGrid.Designer.vb"> <Compile Include="Grid.Designer.vb">
<DependentUpon>LookupGrid.vb</DependentUpon> <DependentUpon>Grid.vb</DependentUpon>
</Compile> </Compile>
<Compile Include="LookupGrid.vb"> <Compile Include="Grid.vb">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="LookupGridHandler.vb" /> <Compile Include="GridHandler.vb" />
<Compile Include="LookupGridRegistration.vb" /> <Compile Include="GridRegistration.vb" />
<Compile Include="LookupGridView.Designer.vb"> <Compile Include="GridView.Designer.vb">
<DependentUpon>LookupGridView.vb</DependentUpon> <DependentUpon>GridView.vb</DependentUpon>
</Compile> </Compile>
<Compile Include="LookupGridView.vb"> <Compile Include="GridView.vb">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="My Project\AssemblyInfo.vb" /> <Compile Include="My Project\AssemblyInfo.vb" />
@ -134,10 +134,10 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<Compile Include="LookupGridControl.Designer.vb"> <Compile Include="GridControl.Designer.vb">
<DependentUpon>LookupGridControl.vb</DependentUpon> <DependentUpon>GridControl.vb</DependentUpon>
</Compile> </Compile>
<Compile Include="LookupGridControl.vb"> <Compile Include="GridControl.vb">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
@ -145,8 +145,8 @@
<EmbeddedResource Include="frmLookupGrid.resx"> <EmbeddedResource Include="frmLookupGrid.resx">
<DependentUpon>frmLookupGrid.vb</DependentUpon> <DependentUpon>frmLookupGrid.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="LookupGrid.resx"> <EmbeddedResource Include="Grid.resx">
<DependentUpon>LookupGrid.vb</DependentUpon> <DependentUpon>Grid.vb</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="My Project\licenses.licx" /> <EmbeddedResource Include="My Project\licenses.licx" />
<EmbeddedResource Include="My Project\Resources.resx"> <EmbeddedResource Include="My Project\Resources.resx">

View File

@ -1,18 +0,0 @@
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Registrator
Namespace LookupGrid
Public Class LookupGridControl
Inherits GridControl
Protected Overrides Function CreateDefaultView() As BaseView
Return CreateView("LookupGridView")
End Function
Protected Overrides Sub RegisterAvailableViewsCore(ByVal collection As InfoCollection)
MyBase.RegisterAvailableViewsCore(collection)
collection.Add(New MyGridViewInfoRegistrator())
End Sub
End Class
End Namespace

View File

@ -1,19 +0,0 @@
Imports System.Windows.Forms
Imports DevExpress.XtraGrid.Views.Grid
Namespace LookupGrid
Public Class LookupGridHandler
Inherits Handler.GridHandler
Public Sub New(ByVal gridView As GridView)
MyBase.New(gridView)
End Sub
Protected Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
MyBase.OnKeyDown(e)
If e.KeyData = Keys.Delete AndAlso View.State = GridState.Normal Then
View.DeleteRow(View.FocusedRowHandle)
End If
End Sub
End Class
End Namespace

View File

@ -1,10 +1,10 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' This code was generated by a tool. ' Dieser Code wurde von einem Tool generiert.
' Runtime Version:4.0.30319.42000 ' Laufzeitversion:4.0.30319.42000
' '
' Changes to this file may cause incorrect behavior and will be lost if ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' the code is regenerated. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------

View File

@ -1,60 +1,61 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' This code was generated by a tool. ' Dieser Code wurde von einem Tool generiert.
' Runtime Version:4.0.30319.42000 ' Laufzeitversion:4.0.30319.42000
' '
' Changes to this file may cause incorrect behavior and will be lost if ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' the code is regenerated. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
Option Strict On Option Strict On
Option Explicit On Option Explicit On
Imports System
Namespace My.Resources Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder 'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
'class via a tool like ResGen or Visual Studio. '-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
'To add or remove a member, edit your .ResX file then rerun ResGen 'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
'with the /str option, or rebuild your VS project. 'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
'''<summary> '''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc. ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary> '''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary> '''<summary>
''' Returns the cached ResourceManager instance used by this class. ''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
'''</summary> '''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get Get
If Object.ReferenceEquals(resourceMan, Nothing) Then If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("LookupGrid.Resources", GetType(Resources).Assembly) Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.Controls.LookupGrid.Resources", GetType(Resources).Assembly)
resourceMan = temp resourceMan = temp
End If End If
Return resourceMan Return resourceMan
End Get End Get
End Property End Property
'''<summary> '''<summary>
''' Overrides the current thread's CurrentUICulture property for all ''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' resource lookups using this strongly typed resource class. ''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
'''</summary> '''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo Friend Property Culture() As Global.System.Globalization.CultureInfo
Get Get
Return resourceCulture Return resourceCulture
End Get End Get
Set(ByVal value As Global.System.Globalization.CultureInfo) Set
resourceCulture = value resourceCulture = value
End Set End Set
End Property End Property

View File

@ -1,10 +1,10 @@
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
' <auto-generated> ' <auto-generated>
' This code was generated by a tool. ' Dieser Code wurde von einem Tool generiert.
' Runtime Version:4.0.30319.42000 ' Laufzeitversion:4.0.30319.42000
' '
' Changes to this file may cause incorrect behavior and will be lost if ' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' the code is regenerated. ' der Code erneut generiert wird.
' </auto-generated> ' </auto-generated>
'------------------------------------------------------------------------------ '------------------------------------------------------------------------------
@ -13,42 +13,42 @@ Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings) Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality" #Region "Automatische My.Settings-Speicherfunktion"
#If _MyType = "WindowsForms" Then #If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then If My.Application.SaveMySettingsOnExit Then
My.Settings.Save() My.Settings.Save()
End If End If
End Sub End Sub
#End If #End If
#End Region #End Region
Public Shared ReadOnly Property [Default]() As MySettings Public Shared ReadOnly Property [Default]() As MySettings
Get Get
#If _MyType = "WindowsForms" Then #If _MyType = "WindowsForms" Then
If Not addedHandler Then If Not addedHandler Then
SyncLock addedHandlerLockObject SyncLock addedHandlerLockObject
If Not addedHandler Then If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True addedHandler = True
End If End If
End SyncLock End SyncLock
End If End If
#End If #End If
Return defaultInstance Return defaultInstance
End Get End Get
@ -64,9 +64,9 @@ Namespace My
Friend Module MySettingsProperty Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _ <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.LookupGrid.My.MySettings Friend ReadOnly Property Settings() As Global.DigitalData.Controls.LookupGrid.My.MySettings
Get Get
Return Global.LookupGrid.My.MySettings.Default Return Global.DigitalData.Controls.LookupGrid.My.MySettings.Default
End Get End Get
End Property End Property
End Module End Module