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()> _
Partial Class LookupGrid
Partial Class Grid
Inherits System.Windows.Forms.UserControl
'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.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.Text = "Button1"
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.Registrator
Namespace LookupGrid
Public Class MyGridViewInfoRegistrator
Public Class GridViewInfoRegistrator
Inherits GridInfoRegistrator
Public Overrides ReadOnly Property ViewName() As String
Get
Return "LookupGridView"
Return "GridView"
End Get
End Property
Public Overrides Function CreateView(ByVal grid As GridControl) As BaseView
Return New LookupGridView(grid)
End Function
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 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>
<ProjectGuid>{3DCD6D1A-C830-4241-B7E4-27430E7EA483}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>LookupGrid</RootNamespace>
<AssemblyName>LookupGrid</AssemblyName>
<RootNamespace>DigitalData.Controls.LookupGrid</RootNamespace>
<AssemblyName>DigitalData.Controls.LookupGrid</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
@ -18,7 +18,7 @@
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<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>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@ -27,7 +27,7 @@
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<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>
</PropertyGroup>
<PropertyGroup>
@ -105,18 +105,18 @@
<Compile Include="frmLookupGrid.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="LookupGrid.Designer.vb">
<DependentUpon>LookupGrid.vb</DependentUpon>
<Compile Include="Grid.Designer.vb">
<DependentUpon>Grid.vb</DependentUpon>
</Compile>
<Compile Include="LookupGrid.vb">
<Compile Include="Grid.vb">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="LookupGridHandler.vb" />
<Compile Include="LookupGridRegistration.vb" />
<Compile Include="LookupGridView.Designer.vb">
<DependentUpon>LookupGridView.vb</DependentUpon>
<Compile Include="GridHandler.vb" />
<Compile Include="GridRegistration.vb" />
<Compile Include="GridView.Designer.vb">
<DependentUpon>GridView.vb</DependentUpon>
</Compile>
<Compile Include="LookupGridView.vb">
<Compile Include="GridView.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
@ -134,10 +134,10 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="LookupGridControl.Designer.vb">
<DependentUpon>LookupGridControl.vb</DependentUpon>
<Compile Include="GridControl.Designer.vb">
<DependentUpon>GridControl.vb</DependentUpon>
</Compile>
<Compile Include="LookupGridControl.vb">
<Compile Include="GridControl.vb">
<SubType>Component</SubType>
</Compile>
</ItemGroup>
@ -145,8 +145,8 @@
<EmbeddedResource Include="frmLookupGrid.resx">
<DependentUpon>frmLookupGrid.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LookupGrid.resx">
<DependentUpon>LookupGrid.vb</DependentUpon>
<EmbeddedResource Include="Grid.resx">
<DependentUpon>Grid.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\licenses.licx" />
<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>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------

View File

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

View File

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