Commit for development environment setup

This commit is contained in:
2023-06-19 16:12:33 -04:00
parent be72063a3c
commit bbce2ad0a6
2209 changed files with 1171775 additions and 625 deletions

View File

@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "Demo\Demo.csproj", "{A6BD962C-CAD5-400E-A8E2-0EF03B3CA8A4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropDownPanel", "DropDownPanel\DropDownPanel.csproj", "{34ADDF19-CBBA-4A11-BC99-D141BA2D29EC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A6BD962C-CAD5-400E-A8E2-0EF03B3CA8A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6BD962C-CAD5-400E-A8E2-0EF03B3CA8A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6BD962C-CAD5-400E-A8E2-0EF03B3CA8A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6BD962C-CAD5-400E-A8E2-0EF03B3CA8A4}.Release|Any CPU.Build.0 = Release|Any CPU
{34ADDF19-CBBA-4A11-BC99-D141BA2D29EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34ADDF19-CBBA-4A11-BC99-D141BA2D29EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34ADDF19-CBBA-4A11-BC99-D141BA2D29EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34ADDF19-CBBA-4A11-BC99-D141BA2D29EC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,91 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A6BD962C-CAD5-400E-A8E2-0EF03B3CA8A4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Demo</RootNamespace>
<AssemblyName>Demo</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DerivedTreeCombo.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="DropDownNode.cs" />
<Compile Include="DropDownTree.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<SubType>Designer</SubType>
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DropDownPanel\DropDownPanel.csproj">
<Project>{34ADDF19-CBBA-4A11-BC99-D141BA2D29EC}</Project>
<Name>DropDownPanel</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,53 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using AT.STO.UI.Win;
namespace Demo
{
internal class DerivedTreeCombo : DropDownPanel
{
#region Constructor / Destructor
public DerivedTreeCombo() : base()
{
// The base class's property must be set because
// this derived implementation hides the setter.
base.DropDownControl = new DropDownTree();
this.DropDownControl.BorderStyle = BorderStyle.None;
}
#endregion
#region Public Properties
/// <summary>
/// Returns the DateRangePicker, that is displayed in the dropdown.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new DropDownTree DropDownControl // new is on purpose to change the property's data type and to hide the setter.
{
get
{
if (base.DropDownControl != null)
{
return base.DropDownControl as DropDownTree;
}
return null;
}
}
public new DropDownNode Value
{
get
{
if (this.DropDownControl != null)
{
return this.DropDownControl.Value as DropDownNode;
}
return null;
}
set { base.Value = value; }
}
#endregion
}
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Windows.Forms;
using AT.STO.UI.Win;
namespace Demo
{
internal class DropDownNode : TreeNode, ILookupItem<long>
{
#region Private Variable Declarations
private long _id = 0;
#endregion
#region Constructor / Destructor
/// <summary>
/// Default constructor.
/// </summary>
public DropDownNode() : base()
{
}
/// <summary>
/// /// <summary>
/// Some constructors initializing the node with Id.
/// </summary>
/// </summary>
/// <param name="Id"></param>
/// <param name="Text"></param>
public DropDownNode(long Id, string Text) : base(Text)
{
_id = Id;
}
public DropDownNode(long Id, string Text, DropDownNode[] Children) : base(Text, Children)
{
_id = Id;
}
public DropDownNode(long Id, string Text, int ImageIndex, int SelectedImageIndex) : base(Text, ImageIndex, SelectedImageIndex)
{
_id = Id;
}
public DropDownNode(long Id, string Text, int ImageIndex, int SelectedImageIndex, DropDownNode[] Children) : base(Text, ImageIndex, SelectedImageIndex, Children)
{
_id = Id;
}
#endregion
#region Public Methods
public override string ToString()
{
return this.GetType().Name + " (Id=" + Id.ToString() + ", Name=" + Text + ")";
}
#endregion
#region ILookupItem<long> Implementation
public long Id
{
get { return _id; }
}
public new string Text
{
get { return base.Text; }
}
#endregion
}
}

View File

@@ -0,0 +1,86 @@
using System;
using System.Windows.Forms;
using AT.STO.UI.Win;
namespace Demo
{
internal class DropDownTree : TreeView, IDropDownAware
{
#region DropDownTree
public DropDownTree()
{
}
#endregion
#region TreeView Events
/// <summary>
/// Allow keeping track of the editing process.
/// </summary>
/// <param name="e"></param>
protected override void OnAfterSelect(TreeViewEventArgs e)
{
base.OnAfterSelect(e);
if (ValueChanged != null)
{
ValueChanged(this, new DropDownValueChangedEventArgs(e.Node));
}
}
/// <summary>
/// A double click on a node counts as finish editing.
/// </summary>
/// <param name="e"></param>
protected override void OnDoubleClick(EventArgs e)
{
base.OnDoubleClick(e);
TreeNode node = HitTest(PointToClient(Cursor.Position)).Node;
if ((FinishEditing != null) && (node != null))
{
FinishEditing(this, new DropDownValueChangedEventArgs(node));
}
}
/// <summary>
/// ENNTER counts as finish editing, ESC as cancel (null is returned).
/// </summary>
/// <param name="e"></param>
protected override void OnKeyUp(KeyEventArgs e)
{
base.OnKeyUp(e);
if (FinishEditing != null)
{
switch (e.KeyCode)
{
case Keys.Enter:
FinishEditing(this, new DropDownValueChangedEventArgs(Value));
break;
case Keys.Escape:
FinishEditing(this, new DropDownValueChangedEventArgs(null));
break;
}
}
}
#endregion
#region IDropDownAware Implementation
public event DropDownValueChangedEventHandler FinishEditing;
public event DropDownValueChangedEventHandler ValueChanged;
public object Value
{
get { return base.SelectedNode; }
set
{
if (value is DropDownNode)
{
base.SelectedNode = value as DropDownNode;
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,114 @@
namespace Demo
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.onTheFlyBox = new System.Windows.Forms.GroupBox();
this.treePanel = new AT.STO.UI.Win.DropDownPanel();
this.txtMsg = new System.Windows.Forms.TextBox();
this.derivedPanel = new System.Windows.Forms.GroupBox();
this.derivedTreeCombo = new Demo.DerivedTreeCombo();
this.onTheFlyBox.SuspendLayout();
this.derivedPanel.SuspendLayout();
this.SuspendLayout();
//
// onTheFlyBox
//
this.onTheFlyBox.Controls.Add(this.treePanel);
this.onTheFlyBox.Location = new System.Drawing.Point(12, 12);
this.onTheFlyBox.Name = "onTheFlyBox";
this.onTheFlyBox.Size = new System.Drawing.Size(171, 71);
this.onTheFlyBox.TabIndex = 1;
this.onTheFlyBox.TabStop = false;
this.onTheFlyBox.Text = "create control on the fly";
//
// treePanel
//
this.treePanel.Location = new System.Drawing.Point(21, 31);
this.treePanel.Name = "treePanel";
this.treePanel.Size = new System.Drawing.Size(124, 21);
this.treePanel.TabIndex = 1;
//
// txtMsg
//
this.txtMsg.AcceptsReturn = true;
this.txtMsg.Anchor = ((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtMsg.Location = new System.Drawing.Point(3, 175);
this.txtMsg.Multiline = true;
this.txtMsg.Name = "txtMsg";
this.txtMsg.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtMsg.Size = new System.Drawing.Size(464, 152);
this.txtMsg.TabIndex = 2;
//
// derivedPanel
//
this.derivedPanel.Controls.Add(this.derivedTreeCombo);
this.derivedPanel.Location = new System.Drawing.Point(12, 89);
this.derivedPanel.Name = "derivedPanel";
this.derivedPanel.Size = new System.Drawing.Size(171, 71);
this.derivedPanel.TabIndex = 4;
this.derivedPanel.TabStop = false;
this.derivedPanel.Text = "derived control";
//
// derivedTreeCombo
//
this.derivedTreeCombo.Location = new System.Drawing.Point(21, 31);
this.derivedTreeCombo.Name = "derivedTreeCombo";
this.derivedTreeCombo.Size = new System.Drawing.Size(124, 21);
this.derivedTreeCombo.TabIndex = 4;
this.derivedTreeCombo.Value = null;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(467, 331);
this.Controls.Add(this.derivedPanel);
this.Controls.Add(this.txtMsg);
this.Controls.Add(this.onTheFlyBox);
this.Name = "MainForm";
this.Text = "Main";
this.onTheFlyBox.ResumeLayout(false);
this.derivedPanel.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox onTheFlyBox;
private AT.STO.UI.Win.DropDownPanel treePanel;
private System.Windows.Forms.TextBox txtMsg;
private System.Windows.Forms.GroupBox derivedPanel;
private DerivedTreeCombo derivedTreeCombo;
}
}

View File

@@ -0,0 +1,110 @@
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using AT.STO.UI.Win;
namespace Demo
{
public partial class MainForm : Form
{
#region Constructor / Destructor
public MainForm()
{
InitializeComponent();
}
#endregion
#region Form Events
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
InitializeDerived();
InitializePanel();
}
#endregion
#region Event Handler
private void DropDown_FinishEditing(object sender, DropDownValueChangedEventArgs e)
{
LogEvent((sender as Control).Name + ".FinishEditing", e.Value);
}
private void DropDown_ValueChanged(object sender, DropDownValueChangedEventArgs e)
{
LogEvent((sender as Control).Name + ".ValueChanged", e.Value);
}
#endregion
#region Private Methods
/// <summary>
/// Populates a given DropDownTree.
/// </summary>
/// <param name="Tree"></param>
private void CreateNodes(DropDownTree Tree)
{
DropDownNode root = new DropDownNode(1, "1");
Tree.Nodes.Clear();
Tree.Nodes.Add(root);
for (int i = 1; i <= 20; i++)
{
DropDownNode node = new DropDownNode(i * 1000, "1." + i.ToString("00"));
root.Nodes.Add(node);
for (int j = 1; j <= 2; j++)
{
node.Nodes.Add(new DropDownNode((i * 1000) + (j * 10), "1." + i.ToString("00") + "." + j.ToString()));
}
}
root.Expand();
}
private DropDownTree CreateTree()
{
DropDownTree tree = new DropDownTree();
tree.BorderStyle = BorderStyle.None; // border is drawn by the DropDownForm.
tree.Size = new Size(200, 300); // the DropDownPanel will be sized to make the tree fit.
CreateNodes(tree);
return tree;
}
/// <summary>
/// Create and initialize the DerivedTreeCombo.
/// </summary>
private void InitializeDerived()
{
derivedTreeCombo.DropDownControl.Size = new Size(200, 300);
CreateNodes(derivedTreeCombo.DropDownControl);
derivedTreeCombo.FinishEditing += new DropDownValueChangedEventHandler(DropDown_FinishEditing);
derivedTreeCombo.ValueChanged += new DropDownValueChangedEventHandler(DropDown_ValueChanged);
}
/// <summary>
/// Create and initialize the DropDownTree.
/// </summary>
/// <returns></returns>
private void InitializePanel()
{
treePanel.DropDownControl = CreateTree(); // make the DropDownTree the DropDownPanels control to display.
treePanel.FinishEditing += new DropDownValueChangedEventHandler(DropDown_FinishEditing);
treePanel.ValueChanged += new DropDownValueChangedEventHandler(DropDown_ValueChanged);
}
private void LogEvent(string Event, object Value)
{
if (txtMsg.Lines.Length > 20)
{
txtMsg.Clear();
}
txtMsg.AppendText(Event + ": " + ((Value == null) ? "user canceled" : Value.ToString()) + "\r\n");
}
#endregion
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace Demo
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Demo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Demo")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f6481bce-6b99-4def-b7d9-f811792f5e73")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Demo.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Demo.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Demo.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings) (global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,61 @@
namespace AT.STO.UI.Win
{
partial class DropDownPanel
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.combo = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// combo
//
this.combo.DropDownHeight = 1;
this.combo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.combo.FormattingEnabled = true;
this.combo.IntegralHeight = false;
this.combo.Location = new System.Drawing.Point(0, 0);
this.combo.Name = "combo";
this.combo.Size = new System.Drawing.Size(86, 21);
this.combo.TabIndex = 0;
this.combo.DropDown += new System.EventHandler(this.Combo_DropDown);
//
// DropDownPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.combo);
this.Name = "DropDownPanel";
this.Size = new System.Drawing.Size(105, 32);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox combo;
}
}

View File

@@ -0,0 +1,287 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace AT.STO.UI.Win
{
/// <summary>
/// Control that allows any other control that implements IDropDownAware to be displayed
/// in it's own combo-like dropdown area. This Control tries to mimic the standard ComboBox
/// as accurately as possible.
/// </summary>
public partial class DropDownPanel : UserControl, IDropDownAware
{
#region Private Variable Declarations
private IDropDownAware _dropDownControl = null;
private DropDownWindowHelper _dropDownHelper = null;
private Form _owner = null;
#endregion
#region Constructor / Destructor
/// <summary>
/// Default constructor
/// </summary>
public DropDownPanel()
{
InitializeComponent();
_dropDownHelper = new DropDownWindowHelper();
_dropDownHelper.DropDownClosed += new DropDownClosedEventHandler(DropDownHelper_DropDownClosed);
_dropDownHelper.DropDownCancel += new DropDownCancelEventHandler(DropDownHelper_DropDownCancel);
combo.DisplayMember = "Text";
combo.ValueMember = "Id";
}
#endregion
#region Control Events
/// <summary>
/// The owning form is set within this event, wich is required to
/// force the owning form not to loose focus when the dropdown is
/// being displayed. Inherited controls should provide the PopupControl
/// within an overridden implementation of this event.
/// </summary>
/// <param name="e"></param>
protected override void OnHandleCreated(EventArgs e)
{
_owner = this.FindForm();
_dropDownHelper.ReleaseHandle();
if (_owner != null)
{
_dropDownHelper.AssignHandle(_owner.Handle);
}
}
/// <summary>
/// Make sure that the overall control's height is exactly the height
/// of the internal ComboBox and that the ComboBox's widt is exactly the
/// width of the control.
/// </summary>
/// <param name="e"></param>
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
combo.Location = new Point(0, 0);
combo.Width = this.ClientRectangle.Width;
this.Height = combo.Height;
}
#endregion
#region Event Handler
/// <summary>
/// We make our DropDownForm host the choosen control and show it instead
/// of the dropdown portion of the ComboBox.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Combo_DropDown(object sender, EventArgs e)
{
if (!_dropDownHelper.DropDownShowing)
{
DropDownForm dropDown = new DropDownForm(_dropDownControl);
dropDown.FinishEditing += new DropDownValueChangedEventHandler(DropDown_FinishEditing);
dropDown.ValueChanged += new DropDownValueChangedEventHandler(DropDown_ValueChanged);
combo.DroppedDown = false;
_dropDownHelper.ShowDropDown(_owner, dropDown, GetDropDownPosition(dropDown));
}
else
{
_dropDownHelper.CloseDropDown();
this.Focus();
}
}
private void DropDownHelper_DropDownClosed(object sender, DropDownClosedEventArgs e)
{
IDropDownAware dropDown = (e.DropDown as IDropDownAware);
if ((dropDown != null) && (dropDown.Value != null))
{
dropDown.FinishEditing -= new DropDownValueChangedEventHandler(DropDown_FinishEditing);
dropDown.ValueChanged -= new DropDownValueChangedEventHandler(DropDown_ValueChanged);
}
combo.DroppedDown = false;
}
private void DropDownHelper_DropDownCancel(object sender, DropDownCancelEventArgs e)
{
if (this.Bounds.Contains(Parent.PointToClient(e.CursorLocation)))
{
e.Cancel = true;
}
else
{
IDropDownAware dropDown = (e.DropDown as IDropDownAware);
if (dropDown != null)
{
dropDown.FinishEditing -= new DropDownValueChangedEventHandler(DropDown_FinishEditing);
dropDown.ValueChanged -= new DropDownValueChangedEventHandler(DropDown_ValueChanged);
}
}
}
private void DropDown_FinishEditing(object sender, DropDownValueChangedEventArgs e)
{
if (e.Value != null)
{
SetValue<long>(e.Value as ILookupItem<long>);
}
if (this.FinishEditing != null)
{
this.FinishEditing(this, e);
}
_dropDownControl.FinishEditing -= new DropDownValueChangedEventHandler(DropDown_FinishEditing);
_dropDownControl.ValueChanged -= new DropDownValueChangedEventHandler(DropDown_ValueChanged);
_dropDownHelper.CloseDropDown();
}
private void DropDown_ValueChanged(object sender, DropDownValueChangedEventArgs e)
{
if (this.ValueChanged != null)
{
this.ValueChanged(this, e);
}
}
#endregion
#region Public Properties
/// <summary>
/// Get or set the control (has to implement IDropDownAware) that is to
/// be displayed as the dropdown portion of the combobox.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IDropDownAware DropDownControl
{
get { return _dropDownControl; }
set
{
_dropDownControl = value;
this.Controls.Add(_dropDownControl as Control);
}
}
#endregion
#region Public Methods
public override string ToString()
{
return this.Name;
}
#endregion
#region Private Methods
/// <summary>
/// Calculate an acceptable position of the DropDownForm even in a
/// multi screen environment.
/// </summary>
/// <param name="DropDown"></param>
/// <returns></returns>
private Point GetDropDownPosition(DropDownForm DropDown)
{
Point lt = Parent.PointToScreen(new Point(Left, Top));
Point rb = Parent.PointToScreen(new Point(Right, Bottom));
Rectangle screen = Screen.FromControl(this).Bounds;
Point point = new Point();
if (((lt.X + DropDown.Width) > (screen.X + screen.Width)) && ((rb.X - DropDown.Width) >= screen.X))
{
point.X = rb.X - DropDown.Width;
if ((point.X + DropDown.Width) > (screen.X + screen.Width))
{
point.X = ((screen.X + screen.Width) - DropDown.Width);
}
}
else
{
point.X = lt.X;
if (point.X < screen.X)
{
point.X = screen.X;
}
}
if (((rb.Y + DropDown.Height) > (screen.Y + screen.Height)) && ((lt.Y - DropDown.Height) >= screen.Y))
{
point.Y = lt.Y - DropDown.Height;
if (point.Y < screen.Y)
{
point.Y = screen.Y;
}
}
else
{
point.Y = rb.Y;
if ((point.Y + DropDown.Height) > (screen.Y + screen.Height))
{
point.Y = ((screen.Y + screen.Height) - DropDown.Height);
}
}
return point;
}
/// <summary>
/// In this implementation we don't the user to edit the ComboBox
/// directly, so we add the new value to the item collection after
/// clearing it first.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="Value"></param>
private void SetValue<T>(ILookupItem<T> Value) where T: struct
{
if (DropDownControl != null)
{
ILookupItem<T>[] arr = new ILookupItem<T>[0];
combo.DataSource = arr;
if ((Value != null) && (Value is ILookupItem<long>))
{
DropDownControl.Value = Value;
arr = new ILookupItem<T>[1]{(ILookupItem<T>) Value};
combo.DataSource = arr;
combo.SelectedIndex = 0;
combo.Focus();
}
else
{
DropDownControl.Value = null;
}
}
}
#endregion
#region IDropDownAware Implementation
/// <summary>
/// Fired either on OK, Cancel or a click outside the control to indicate
/// that the user has finished editing.
/// </summary>
public event DropDownValueChangedEventHandler FinishEditing;
/// <summary>
/// Fired on any change of the controls's value during the editing process.
/// </summary>
public event DropDownValueChangedEventHandler ValueChanged;
/// <summary>
/// Gets or sets the controls' value.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public object Value
{
get { return _dropDownControl.Value; }
set { SetValue<long>(value as ILookupItem<long>); }
}
#endregion
}
}

View File

@@ -0,0 +1,73 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{34ADDF19-CBBA-4A11-BC99-D141BA2D29EC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DropDownPanel</RootNamespace>
<AssemblyName>DropDownPanel</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Forms\DropDownForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\DropDownForm.designer.cs">
<DependentUpon>DropDownForm.cs</DependentUpon>
</Compile>
<Compile Include="Controls\DropDownPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\DropDownPanel.Designer.cs">
<DependentUpon>DropDownPanel.cs</DependentUpon>
</Compile>
<Compile Include="Helper\DropDownWindowHelper.cs" />
<Compile Include="Helper\DropDownMessageFilter.cs" />
<Compile Include="Events\Events.cs" />
<Compile Include="Interfaces\IDropDownAware.cs" />
<Compile Include="Interfaces\ILookupItem.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Unmanaged\UIApiCalls.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Forms\DropDownForm.resx">
<DependentUpon>DropDownForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="combo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@@ -0,0 +1,154 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace AT.STO.UI.Win
{
/// <summary>
/// Represents the method which responds to a <see cref="DropDownCancel"/> event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public delegate void DropDownCancelEventHandler(object sender, DropDownCancelEventArgs e);
/// <summary>
/// Represents the method which responds to a <see cref="DropDownClosed"/> event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public delegate void DropDownClosedEventHandler(object sender, DropDownClosedEventArgs e);
/// <summary>
///
/// </summary>
/// <param name="sender">The object firing the event.</param>
/// <param name="e"></param>
public delegate void DropDownValueChangedEventHandler(object sender, DropDownValueChangedEventArgs e);
/// <summary>
/// Arguments to a <see cref="DropDownCancelEvent"/>. Provides a
/// reference to the popup form that is to be closed and
/// allows the operation to be cancelled.
///
/// Thousand thanks to Steve McMahon:
/// http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/Popup_Form_Demonstration.asp
/// </summary>
public class DropDownCancelEventArgs : EventArgs
{
#region Private Variable Declarations
private bool _cancel = false;
private Point _cursorLocation;
private Form _dropDown = null;
#endregion
#region Constructor / Destructor
/// <summary>
/// Constructs a new instance of this class.
/// </summary>
/// <param name="DropDown">The popup form</param>
/// <param name="CursorLocation">The mouse location, if any, where the
/// mouse event that would cancel the popup occured.</param>
public DropDownCancelEventArgs(Form DropDown, Point CursorLocation)
{
_dropDown = DropDown;
_cursorLocation = CursorLocation;
_cancel = false;
}
#endregion
#region Public Properties
/// <summary>
///
/// </summary>
public bool Cancel
{
get { return _cancel; }
set { _cancel = value; }
}
/// <summary>
///
/// </summary>
public Point CursorLocation
{
get { return _cursorLocation; }
}
/// <summary>
///
/// </summary>
public Form DropDown
{
get { return _dropDown; }
}
#endregion
}
/// <summary>
/// Contains event information for a <see cref="DropDownClosed"/> event.
///
/// Thousand thanks to Steve McMahon:
/// http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/Popup_Form_Demonstration.asp
/// </summary>
public class DropDownClosedEventArgs : EventArgs
{
#region Private Variable Declarations
private Form _dropDown = null;
#endregion
#region Constructor / Destructor
/// <summary>
/// Constructs a new instance of this class for the specified
/// popup form.
/// </summary>
/// <param name="DropDown">DropDown Form which is being closed.</param>
public DropDownClosedEventArgs(Form DropDown)
{
_dropDown = DropDown;
}
#endregion
#region Public Properties
/// <summary>
/// Gets the dropdown form which is being closed.
/// </summary>
public Form DropDown
{
get { return _dropDown; }
}
#endregion
}
/// <summary>
/// Contains event information for DropDownValueChangedEventHandler.
/// </summary>
public class DropDownValueChangedEventArgs : EventArgs
{
#region Private Variable Declarations
private object _value = null;
#endregion
#region Constructor / Destructor
/// <summary>
/// Default Constructor
/// </summary>
public DropDownValueChangedEventArgs()
{
}
/// <summary>
/// Initialization with the control's value.
/// </summary>
/// <param name="Value"></param>
public DropDownValueChangedEventArgs(object Value)
{
_value = Value;
}
#endregion
#region Public Properties
/// <summary>
/// Gets or sets the control's value.
/// </summary>
public object Value
{
get { return _value; }
set { _value = value; }
}
#endregion
}
}

View File

@@ -0,0 +1,116 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace AT.STO.UI.Win
{
/// <summary>
/// The form that pops up instead of the dropdown portion of the
/// DropDownPanel's combobox. It containes the actual control to
/// display.
/// </summary>
internal partial class DropDownForm : Form, IDropDownAware
{
#region Private Variable Declaration
private IDropDownAware _control = null;
#endregion
#region Constructor / Destructor
/// <summary>
/// Default Constructor
/// </summary>
public DropDownForm()
{
InitializeComponent();
}
/// <summary>
/// Constructor to initialize the for with the control to display.
/// </summary>
/// <param name="Ctrl">The control to display.</param>
public DropDownForm(IDropDownAware Ctrl) : this()
{
if (Ctrl != null)
{
_control = Ctrl;
InitializeControl(_control as Control);
}
}
#endregion
#region Form Events
protected override void OnClosing(CancelEventArgs e)
{
this.Controls.Remove(_control as Control);
base.OnClosing(e);
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
_control.FinishEditing += new DropDownValueChangedEventHandler(Ctrl_FinishEditing);
_control.ValueChanged += new DropDownValueChangedEventHandler(Ctrl_ValueChanged);
}
#endregion
#region Event Handler
private void Ctrl_FinishEditing(object sender, DropDownValueChangedEventArgs e)
{
if (this.FinishEditing != null)
{
this.FinishEditing(this, e);
}
_control.FinishEditing -= new DropDownValueChangedEventHandler(Ctrl_FinishEditing);
_control.ValueChanged -= new DropDownValueChangedEventHandler(Ctrl_ValueChanged);
}
private void Ctrl_ValueChanged(object sender, DropDownValueChangedEventArgs e)
{
if (this.ValueChanged != null)
{
this.ValueChanged(this, e);
}
}
#endregion
#region IDropDownAware Implementation
/// <summary>
/// Fired either on OK, Cancel or a click outside the control to indicate
/// that the user has finished editing.
/// </summary>
public event DropDownValueChangedEventHandler FinishEditing;
/// <summary>
/// Fired on any change of the controls's value during the editing process.
/// </summary>
public event DropDownValueChangedEventHandler ValueChanged;
/// <summary>
/// Gets or sets the controls' value.
/// </summary>
public object Value
{
get { return _control.Value; }
set { _control.Value = value; }
}
#endregion
#region Private Methods
private void InitializeControl(Control Ctrl)
{
Size size = Ctrl.Size;
Size inner = this.ClientRectangle.Size;
Size outer = this.Size;
int gap = outer.Width - inner.Width;
size.Width += gap;
size.Height += gap;
this.Size = size;
this.Controls.Add(Ctrl);
Ctrl.Location = new Point(0, 0);
Ctrl.Visible = true;
Ctrl.Invalidate();
}
#endregion
}
}

View File

@@ -0,0 +1,52 @@
namespace AT.STO.UI.Win
{
partial class DropDownForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// DropDownForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Window;
this.ClientSize = new System.Drawing.Size(226, 211);
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DropDownForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.ResumeLayout(false);
}
#endregion
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,110 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace AT.STO.UI.Win
{
/// <summary>
/// A Message Loop filter which detect mouse events whilst the popup form is shown
/// and notifies the owning <see cref="PopupWindowHelper"/> class when a mouse
/// click outside the popup occurs.
///
/// Thousand thanks to Steve McMahon:
/// http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/Popup_Form_Demonstration.asp
/// </summary>
internal class DropDownMessageFilter : IMessageFilter
{
#region Private Constants
private const int WM_LBUTTONDOWN = 0x201;
private const int WM_RBUTTONDOWN = 0x204;
private const int WM_MBUTTONDOWN = 0x207;
private const int WM_NCLBUTTONDOWN = 0x0A1;
private const int WM_NCRBUTTONDOWN = 0x0A4;
private const int WM_NCMBUTTONDOWN = 0x0A7;
#endregion
#region Private Variable Declarations
private Form _dropDown = null;
private DropDownWindowHelper _owner = null;
#endregion
#region Event Declarations
public event DropDownCancelEventHandler DropDownCancel;
#endregion
#region Constructor / Destructor
/// <summary>
/// Constructs a new instance of this class and sets the owning
/// object.
/// </summary>
/// <param name="Owner">The <see cref="DropDownWindowHelper"/> object
/// which owns this class.</param>
public DropDownMessageFilter(DropDownWindowHelper Owner)
{
_owner = Owner;
}
#endregion
#region Public Properties
/// <summary>
/// Gets/sets the dropdown form which is being displayed.
/// </summary>
public Form DropDown
{
get { return _dropDown; }
set { _dropDown = value; }
}
#endregion
#region Private Methods
private void OnMouseDown()
{
Point cursorPos = Cursor.Position; // Get the cursor location
if (!_dropDown.Bounds.Contains(cursorPos)) // Check if it is within the popup form
{
OnDropDownCancel(new DropDownCancelEventArgs(_dropDown, cursorPos)); // If not, then call to see if it should be closed
}
}
#endregion
#region DropDownCancelEvent Implementation
protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
{
if (this.DropDownCancel != null)
{
this.DropDownCancel(this, e);
}
if (!e.Cancel)
{
_owner.CloseDropDown();
_dropDown = null; // Clear reference for GC
}
}
#endregion
#region IMessageFilter Implementation
/// <summary>
/// Checks the message loop for mouse messages whilst the popup
/// window is displayed. If one is detected the position is
/// checked to see if it is outside the form, and the owner
/// is notified if so.
/// </summary>
/// <param name="m">Windows Message about to be processed by the
/// message loop</param>
/// <returns><c>true</c> to filter the message, <c>false</c> otherwise.
/// This implementation always returns <c>false</c>.</returns>
public bool PreFilterMessage(ref Message m)
{
if (_dropDown != null)
{
switch (m.Msg)
{
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_NCLBUTTONDOWN:
case WM_NCRBUTTONDOWN:
case WM_NCMBUTTONDOWN: OnMouseDown(); break;
}
}
return false;
}
#endregion
}
}

View File

@@ -0,0 +1,203 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace AT.STO.UI.Win
{
/// <summary>
/// A class to assist in creating popup windows like Combo Box drop-downs and Menus.
/// This class includes functionality to keep the title bar of the popup owner form
/// active whilst the popup is displayed, and to automatically cancel the popup
/// whenever the user clicks outside the popup window or shifts focus to another
/// application.
///
/// Thousand thanks to Steve McMahon:
/// http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/Popup_Form_Demonstration.asp
/// </summary>
internal class DropDownWindowHelper : NativeWindow
{
#region Private Variable Declarations
private EventHandler DropDownClosedHandler = null;
private Form _dropDown = null;
private bool _dropDownShowing = false;
private DropDownMessageFilter _filter = null;
private Form _owner = null;
private bool _skipClose = false;
#endregion
#region Event Declarations
public event DropDownCancelEventHandler DropDownCancel;
public event DropDownClosedEventHandler DropDownClosed;
#endregion
#region Constructor / Destructor
/// <summary>
/// Default constructor.
/// </summary>
/// <remarks>Use the <see cref="System.Windows.Forms.NativeWindow.AssignHandle"/>
/// method to attach this class to the form you want to show popups from.</remarks>
public DropDownWindowHelper()
{
_filter = new DropDownMessageFilter(this);
_filter.DropDownCancel += new DropDownCancelEventHandler(Popup_Cancel);
}
#endregion
#region Event Handler
private void Popup_Cancel(object sender, DropDownCancelEventArgs e)
{
OnDropDownCancel(e);
}
/// <summary>
/// Responds to the <see cref="System.Windows.Forms.Form.Closed"/>
/// event from the popup form.
/// </summary>
/// <param name="sender">Popup form that has been closed.</param>
/// <param name="e">Not used.</param>
private void Popup_Closed(object sender, EventArgs e)
{
CloseDropDown();
}
/// <summary>
/// Subclasses the owning form's existing Window Procedure to enables the
/// title bar to remain active when a popup is show, and to detect if
/// the user clicks onto another application whilst the popup is visible.
/// </summary>
/// <param name="m">Window Procedure Message</param>
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (DropDownShowing)
{
if (m.Msg == UIApiCalls.WM_NCACTIVATE)
{
if (((int)m.WParam) == 0) // Check if the title bar will made inactive:
{ // Note it's no good to try and consume this message; if you try to do that you'll end up with windows
UIApiCalls.SendMessage(this.Handle, UIApiCalls.WM_NCACTIVATE, 1, IntPtr.Zero); // If so reactivate it.
}
}
else if (m.Msg == UIApiCalls.WM_ACTIVATEAPP)
{
if ((int)m.WParam == 0) // Check if the application is being deactivated.
{
CloseDropDown(); // It is so cancel the popup:
UIApiCalls.PostMessage(this.Handle, UIApiCalls.WM_NCACTIVATE, 0, IntPtr.Zero); // And put the title bar into the inactive state:
}
}
}
}
#endregion
#region Public Methods
/// <summary>
/// Shows the specified Form as a popup window, keeping the
/// Owner's title bar active and preparing to cancel the popup
/// should the user click anywhere outside the popup window.
/// <para>Typical code to use this message is as follows:</para>
/// <code>
/// frmPopup popup = new frmPopup();
/// Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom));
/// popupHelper.ShowPopup(this, popup, location);
/// </code>
/// <para>Put as much initialisation code as possible
/// into the popup form's constructor, rather than the <see cref="System.Windows.Forms.Load"/>
/// event as this will improve visual appearance.</para>
/// </summary>
/// <param name="Owner">Main form which owns the popup</param>
/// <param name="Popup">Window to show as a popup</param>
/// <param name="v">Location relative to the screen to show the popup at.</param>
public void ShowDropDown(Form Owner, Form DropDown, Point Location)
{
_owner = Owner;
_dropDown = DropDown;
Application.AddMessageFilter(_filter); // Start checking for the popup being cancelled
DropDown.StartPosition = FormStartPosition.Manual; // Set the location of the popup form:
DropDown.Location = Location;
Owner.AddOwnedForm(DropDown); // Make it owned by the window that's displaying it:
DropDownClosedHandler = new EventHandler(Popup_Closed); // Respond to the Closed event in case the popup is closed by its own internal means
DropDown.Closed += DropDownClosedHandler;
_dropDownShowing = true; // Show the popup:
DropDown.Show();
DropDown.Activate();
// A little bit of fun. We've shown the popup, but because we've kept the main window's
// title bar in focus the tab sequence isn't quite right. This can be fixed by sending a tab,
// but that on its own would shift focus to the second control in the form. So send a tab,
// followed by a reverse-tab.
UIApiCalls.keybd_event((byte) Keys.Tab, 0, 0, 0);
UIApiCalls.keybd_event((byte) Keys.Tab, 0, UIApiCalls.KEYEVENTF_KEYUP, 0);
UIApiCalls.keybd_event((byte) Keys.ShiftKey, 0, 0, 0);
UIApiCalls.keybd_event((byte) Keys.Tab, 0, 0, 0);
UIApiCalls.keybd_event((byte) Keys.Tab, 0, UIApiCalls.KEYEVENTF_KEYUP, 0);
UIApiCalls.keybd_event((byte) Keys.ShiftKey, 0, UIApiCalls.KEYEVENTF_KEYUP, 0);
_filter.DropDown = DropDown; // Start filtering for mouse clicks outside the popup
}
/// <summary>
/// Called when the popup is being hidden.
/// </summary>
public void CloseDropDown()
{
if (DropDownShowing)
{
if (!_skipClose)
{
OnPDropDownClosed(new DropDownClosedEventArgs(_dropDown));
}
_skipClose = false;
_owner.RemoveOwnedForm(_dropDown); // Make sure the popup is closed and we've cleaned up:
_dropDownShowing = false;
_dropDown.Closed -= DropDownClosedHandler;
DropDownClosedHandler = null;
_dropDown.Close();
Application.RemoveMessageFilter(_filter); // No longer need to filter for clicks outside the popup.
// If we did something from the popup which shifted focus to a new form, like showing another popup
// or dialog, then Windows won't know how to bring the original owner back to the foreground, so
// force it here:
_owner.Activate();
_dropDown = null; // Null out references for GC
_owner = null;
}
}
#endregion
#region Public Properties
/// <summary>
/// Indicator weither the DropDown is showing.
/// </summary>
public bool DropDownShowing
{
get { return _dropDownShowing; }
}
#endregion
#region Event Implementation
protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
{
if (this.DropDownCancel != null)
{
this.DropDownCancel(this, e);
if (!e.Cancel)
{
_skipClose = true;
}
}
}
protected virtual void OnPDropDownClosed(DropDownClosedEventArgs e)
{
if (this.DropDownClosed != null)
{
this.DropDownClosed(this, e);
}
}
#endregion
}
}

View File

@@ -0,0 +1,30 @@
using System;
namespace AT.STO.UI.Win
{
/// <summary>
/// Standard interface that has to be implemented by control's that
/// should be diplayed in the dropdown area of the DropDownPanel.
/// </summary>
public interface IDropDownAware
{
#region Event Declarations
/// <summary>
/// Fired either on OK, Cancel or a click outside the control to indicate
/// that the user has finished editing.
/// </summary>
event DropDownValueChangedEventHandler FinishEditing;
/// <summary>
/// Fired on any change of the controls's value during the editing process.
/// </summary>
event DropDownValueChangedEventHandler ValueChanged;
#endregion
#region Public Properties
/// <summary>
/// Gets or sets the controls' value.
/// </summary>
object Value { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,10 @@
using System;
namespace AT.STO.UI.Win
{
public interface ILookupItem<T> where T: struct
{
T Id { get; }
string Text { get; }
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DropDownPanel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DropDownPanel")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d59d03fc-b0ff-4210-867d-cfa4cef1728c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,25 @@
using System;
using System.Runtime.InteropServices;
namespace AT.STO.UI.Win
{
public static class UIApiCalls
{
#region Public Constants
public const int WM_ACTIVATE = 0x006;
public const int WM_ACTIVATEAPP = 0x01C;
public const int WM_NCACTIVATE = 0x086;
public const int KEYEVENTF_KEYUP = 0x0002;
#endregion
#region Public Static API Calls
[DllImport("user32", CharSet = CharSet.Auto)]
public extern static int SendMessage(IntPtr handle, int msg, int wParam, IntPtr lParam);
[DllImport("user32", CharSet = CharSet.Auto)]
public extern static int PostMessage(IntPtr handle, int msg, int wParam, IntPtr lParam);
[DllImport("user32")]
public extern static void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
#endregion
}
}