Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ElementHost in Winforms to fix #4 and #15 #167

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,778 changes: 2,778 additions & 0 deletions EverythingToolbar.Deskband/CSDeskBand.cs

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions EverythingToolbar.Deskband/Deskband.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace EverythingToolbar.Deskband
{
[ComVisible(true)]
[Guid("FB17B6DA-E3D7-4D17-9E43-3416988372A9")]
[CSDeskBand.CSDeskBandRegistration(Name = "Everything Toolbar WinForms", ShowDeskBand = false)]
public class Deskband : CSDeskBand.CSDeskBandWin
{
private static Control control;

public Deskband()
{
Options.MinHorizontalSize = new Size(18, 30);
control = new ToolbarControlHost(this);
}

protected override Control Control => control;
}
}
92 changes: 92 additions & 0 deletions EverythingToolbar.Deskband/EverythingToolbar.Deskband.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{336FFF40-4328-4451-80EB-67D46DCC7255}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EverythingToolbar.Deskband</RootNamespace>
<AssemblyName>EverythingToolbar.Deskband</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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;DESKBAND_WINFORMS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>EverythingToolbar.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Deskband.cs" />
<Compile Include="CSDeskBand.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ToolbarControlHost.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ToolbarControlHost.Designer.cs">
<DependentUpon>ToolbarControlHost.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EverythingToolbar\EverythingToolbar.csproj">
<Project>{c8bb766a-d7bc-47f5-a0e7-d3225dd1f469}</Project>
<Name>EverythingToolbar</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="EverythingToolbar.pfx" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ToolbarControlHost.resx">
<DependentUpon>ToolbarControlHost.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>taskkill /f /im explorer.exe 2&gt;nul &amp;set errorlevel=0
xcopy $(ProjectDir)Everything64.dll $(ProjectDir)$(OutDir) /c /i /r /y
xcopy $(ProjectDir)..\README.md $(ProjectDir)$(OutDir) /c /i /r /y
xcopy $(ProjectDir)..\LICENSE $(ProjectDir)$(OutDir) /c /i /r /y
Exit 0</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>powershell start-process %25windir%25\explorer.exe
Exit 0</PostBuildEvent>
</PropertyGroup>
</Project>
36 changes: 36 additions & 0 deletions EverythingToolbar.Deskband/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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("EverythingToolbar.Deskband")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EverythingToolbar.Deskband")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[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("336fff40-4328-4451-80eb-67d46dcc7255")]

// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
47 changes: 47 additions & 0 deletions EverythingToolbar.Deskband/ToolbarControlHost.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions EverythingToolbar.Deskband/ToolbarControlHost.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Windows.Forms;
using System.Windows.Forms.Integration;

namespace EverythingToolbar.Deskband
{
public partial class ToolbarControlHost : UserControl
{
public ToolbarControlHost(CSDeskBand.CSDeskBandWin w)
{
InitializeComponent();
//this.BackColor = Color.LimeGreen;
//this.TransparencyKey = Color.LimeGreen;
ElementHost host = new ElementHost
{
Dock = DockStyle.Fill,
BackColorTransparent = true,
Child = new ToolbarControl()
};
Controls.Add(host);
}

protected override void OnPaintBackground(PaintEventArgs e) { }
}
}
120 changes: 120 additions & 0 deletions EverythingToolbar.Deskband/ToolbarControlHost.resx
Original file line number Diff line number Diff line change
@@ -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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
14 changes: 14 additions & 0 deletions EverythingToolbar.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EverythingToolbar.Debug", "
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "EverythingToolbar.Installer", "EverythingToolbar.Installer\EverythingToolbar.Installer.wixproj", "{3A32975A-714F-408F-828A-04F5119EC1AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EverythingToolbar.Deskband", "EverythingToolbar.Deskband\EverythingToolbar.Deskband.csproj", "{336FFF40-4328-4451-80EB-67D46DCC7255}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -51,6 +53,18 @@ Global
{3A32975A-714F-408F-828A-04F5119EC1AB}.Release|x64.ActiveCfg = Release|x86
{3A32975A-714F-408F-828A-04F5119EC1AB}.Release|x86.ActiveCfg = Release|x86
{3A32975A-714F-408F-828A-04F5119EC1AB}.Release|x86.Build.0 = Release|x86
{336FFF40-4328-4451-80EB-67D46DCC7255}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Debug|Any CPU.Build.0 = Debug|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Debug|x64.ActiveCfg = Debug|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Debug|x64.Build.0 = Debug|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Debug|x86.ActiveCfg = Debug|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Debug|x86.Build.0 = Debug|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Release|Any CPU.ActiveCfg = Release|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Release|Any CPU.Build.0 = Release|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Release|x64.ActiveCfg = Release|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Release|x64.Build.0 = Release|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Release|x86.ActiveCfg = Release|Any CPU
{336FFF40-4328-4451-80EB-67D46DCC7255}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion EverythingToolbar/EverythingToolbar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<Compile Include="Converters\ResourceLoaderToMenuItemsConverter.cs" />
<Compile Include="Converters\SearchTermToIsOpenedConverter.cs" />
<Compile Include="Converters\DoubleToVisibilityConverter.cs" />
<Compile Include="CSDeskBand.cs" />
<Compile Include="Data\Filter.cs" />
<Compile Include="EverythingSearch.cs" />
<Compile Include="Data\Rule.cs" />
Expand Down Expand Up @@ -319,7 +320,6 @@
<SubType>Designer</SubType>
</Page>
<Compile Include="Deskband.cs" />
<Compile Include="CSDeskBand.cs" />
<Compile Include="Data\SearchResult.cs" />
<Compile Include="Converters\HighlightedTextConverter.cs" />
<Compile Include="Properties\Settings.cs" />
Expand Down