mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-15 01:04:49 +08:00
R26_dev8 - First public commit
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{9702C58D-F52F-45CF-9456-9CE5AF40F5C3}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CodeWalker.WinForms</RootNamespace>
|
||||
<AssemblyName>CodeWalker.WinForms</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</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.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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MenuStripFix.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MenuStripFix.Designer.cs">
|
||||
<DependentUpon>MenuStripFix.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="PropertyGridFix.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PropertyGridFix.Designer.cs">
|
||||
<DependentUpon>PropertyGridFix.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ReadOnlyPropertyGrid.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ReadOnlyPropertyGrid.Designer.cs">
|
||||
<DependentUpon>ReadOnlyPropertyGrid.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TextBoxFix.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TextBoxFix.Designer.cs">
|
||||
<DependentUpon>TextBoxFix.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TextBoxScrollSyncFix.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TextBoxScrollSyncFix.Designer.cs">
|
||||
<DependentUpon>TextBoxScrollSyncFix.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ToolStripFix.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ToolStripFix.Designer.cs">
|
||||
<DependentUpon>ToolStripFix.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ToolStripSplitButtonFix.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ToolStripSplitButtonFix.Designer.cs">
|
||||
<DependentUpon>ToolStripSplitButtonFix.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ToolStripSpringTextBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ToolStripSpringTextBox.Designer.cs">
|
||||
<DependentUpon>ToolStripSpringTextBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TreeViewFix.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TreeViewFix.Designer.cs">
|
||||
<DependentUpon>TreeViewFix.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\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>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
partial class MenuStripFix
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
public partial class MenuStripFix : MenuStrip
|
||||
{
|
||||
public MenuStripFix()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
base.OnPaint(pe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const uint WM_LBUTTONDOWN = 0x201;
|
||||
const uint WM_LBUTTONUP = 0x202;
|
||||
|
||||
static private bool down = false;
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
//fix to properly handle the mouse down event when the form isn't currently focused...
|
||||
if (m.Msg == WM_LBUTTONUP && !down)
|
||||
{
|
||||
m.Msg = (int)WM_LBUTTONDOWN;
|
||||
base.WndProc(ref m);
|
||||
m.Msg = (int)WM_LBUTTONUP;
|
||||
}
|
||||
|
||||
if (m.Msg == WM_LBUTTONDOWN) down = true;
|
||||
if (m.Msg == WM_LBUTTONUP) down = false;
|
||||
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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("CodeWalker.WinForms")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CodeWalker.WinForms")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[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("9702c58d-f52f-45cf-9456-9ce5af40f5c3")]
|
||||
|
||||
// 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")]
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
partial class PropertyGridFix
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
public partial class PropertyGridFix : PropertyGrid
|
||||
{
|
||||
public PropertyGridFix()
|
||||
{
|
||||
InitializeComponent();
|
||||
LineColor = SystemColors.InactiveBorder; //makes it consistent across windows 10 versions........
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
base.OnPaint(pe);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
partial class ReadOnlyPropertyGrid
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
public partial class ReadOnlyPropertyGrid : PropertyGridFix
|
||||
{
|
||||
public ReadOnlyPropertyGrid()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
base.OnPaint(pe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool _readOnly = true;
|
||||
public bool ReadOnly
|
||||
{
|
||||
get { return _readOnly; }
|
||||
set
|
||||
{
|
||||
_readOnly = value;
|
||||
SetObjectAsReadOnly(SelectedObject, _readOnly);
|
||||
}
|
||||
}
|
||||
|
||||
private TypeDescriptionProvider provider = null;
|
||||
private object providedObject = null;
|
||||
|
||||
protected override void OnSelectedObjectsChanged(EventArgs e)
|
||||
{
|
||||
if (providedObject != null)
|
||||
{
|
||||
SetObjectAsReadOnly(providedObject, false);
|
||||
}
|
||||
SetObjectAsReadOnly(SelectedObject, _readOnly);
|
||||
base.OnSelectedObjectsChanged(e);
|
||||
}
|
||||
|
||||
private void SetObjectAsReadOnly(object selectedObject, bool isReadOnly)
|
||||
{
|
||||
if (SelectedObject != null)
|
||||
{
|
||||
if (isReadOnly)
|
||||
{
|
||||
provider = TypeDescriptor.AddAttributes(SelectedObject, new Attribute[] { new ReadOnlyAttribute(_readOnly) });
|
||||
providedObject = SelectedObject;
|
||||
}
|
||||
else if (provider != null)
|
||||
{
|
||||
TypeDescriptor.RemoveProvider(provider, this.SelectedObject);
|
||||
provider = null;
|
||||
providedObject = null;
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
partial class TextBoxFix
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
public partial class TextBoxFix : TextBox
|
||||
{
|
||||
public TextBoxFix()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
base.OnPaint(pe);
|
||||
}
|
||||
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
//Fix for Ctrl-A not working in multiline textboxes.
|
||||
const int WM_KEYDOWN = 0x100;
|
||||
var keyCode = (Keys)(msg.WParam.ToInt32() & Convert.ToInt32(Keys.KeyCode));
|
||||
if ((msg.Msg == WM_KEYDOWN && keyCode == Keys.A) && (ModifierKeys == Keys.Control) && Focused)
|
||||
{
|
||||
SelectAll();
|
||||
return true;
|
||||
}
|
||||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
partial class TextBoxScrollSyncFix
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
public partial class TextBoxScrollSyncFix : TextBoxFix
|
||||
{
|
||||
public TextBoxScrollSyncFix()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public const int WM_VSCROLL = 0x115;
|
||||
|
||||
List<TextBoxScrollSyncFix> peers = new List<TextBoxScrollSyncFix>();
|
||||
|
||||
public void AddPeer(TextBoxScrollSyncFix peer)
|
||||
{
|
||||
peers.Add(peer);
|
||||
}
|
||||
|
||||
private void DirectWndProc(ref Message m)
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if (m.Msg == WM_VSCROLL)
|
||||
{
|
||||
foreach (var peer in this.peers)
|
||||
{
|
||||
var peerMessage = Message.Create(peer.Handle, m.Msg, m.WParam, m.LParam);
|
||||
peer.DirectWndProc(ref peerMessage);
|
||||
}
|
||||
}
|
||||
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
partial class ToolStripFix
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
public partial class ToolStripFix : ToolStrip
|
||||
{
|
||||
public ToolStripFix()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
base.OnPaint(pe);
|
||||
}
|
||||
|
||||
|
||||
const uint WM_LBUTTONDOWN = 0x201;
|
||||
const uint WM_LBUTTONUP = 0x202;
|
||||
|
||||
static private bool down = false;
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
//fix to properly handle the mouse down event when the form isn't currently focused...
|
||||
if (m.Msg == WM_LBUTTONUP && !down)
|
||||
{
|
||||
m.Msg = (int)WM_LBUTTONDOWN;
|
||||
base.WndProc(ref m);
|
||||
m.Msg = (int)WM_LBUTTONUP;
|
||||
}
|
||||
|
||||
if (m.Msg == WM_LBUTTONDOWN) down = true;
|
||||
if (m.Msg == WM_LBUTTONUP) down = false;
|
||||
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
partial class ToolStripSplitButtonFix
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
public partial class ToolStripSplitButtonFix : ToolStripSplitButton
|
||||
{
|
||||
//this allows the ToolStripSplitButton to have a "Checked" shaded appearance.
|
||||
private bool ischecked = false;
|
||||
|
||||
/// <summary>
|
||||
/// Indictates the Checked state of the button.
|
||||
/// </summary>
|
||||
[Category("Behavior"),
|
||||
Description("Indicates whether or not the ToolStripSplitButtonFix is checked."),
|
||||
DefaultValue(false)]
|
||||
public bool Checked
|
||||
{
|
||||
get
|
||||
{
|
||||
return ischecked;
|
||||
}
|
||||
set
|
||||
{
|
||||
ischecked = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public ToolStripSplitButtonFix()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
if (ischecked)
|
||||
{
|
||||
ControlPaint.DrawBorder(e.Graphics,
|
||||
e.ClipRectangle, // To draw around the button + drop-down
|
||||
//ButtonBounds, // To draw only around the button
|
||||
SystemColors.MenuHighlight,
|
||||
ButtonBorderStyle.Solid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
partial class ToolStripSpringTextBox
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
public partial class ToolStripSpringTextBox : ToolStripTextBox
|
||||
{
|
||||
public override Size GetPreferredSize(Size constrainingSize)
|
||||
{
|
||||
// Use the default size if the text box is on the overflow menu
|
||||
// or is on a vertical ToolStrip.
|
||||
if (IsOnOverflow || Owner.Orientation == Orientation.Vertical)
|
||||
{
|
||||
return DefaultSize;
|
||||
}
|
||||
|
||||
// Declare a variable to store the total available width as
|
||||
// it is calculated, starting with the display width of the
|
||||
// owning ToolStrip.
|
||||
Int32 width = Owner.DisplayRectangle.Width;
|
||||
|
||||
// Subtract the width of the overflow button if it is displayed.
|
||||
if (Owner.OverflowButton.Visible)
|
||||
{
|
||||
width = width - Owner.OverflowButton.Width -
|
||||
Owner.OverflowButton.Margin.Horizontal;
|
||||
}
|
||||
|
||||
// Declare a variable to maintain a count of ToolStripSpringTextBox
|
||||
// items currently displayed in the owning ToolStrip.
|
||||
Int32 springBoxCount = 0;
|
||||
|
||||
foreach (ToolStripItem item in Owner.Items)
|
||||
{
|
||||
// Ignore items on the overflow menu.
|
||||
if (item.IsOnOverflow) continue;
|
||||
|
||||
if (item is ToolStripSpringTextBox)
|
||||
{
|
||||
// For ToolStripSpringTextBox items, increment the count and
|
||||
// subtract the margin width from the total available width.
|
||||
springBoxCount++;
|
||||
width -= item.Margin.Horizontal;
|
||||
}
|
||||
else if (item is ToolStripSplitButton)
|
||||
{
|
||||
width = width - 32 - item.Margin.Horizontal; //dexyfex bugfix for changing split button image...
|
||||
}
|
||||
else
|
||||
{
|
||||
// For all other items, subtract the full width from the total
|
||||
// available width.
|
||||
width = width - item.Width - item.Margin.Horizontal;
|
||||
}
|
||||
}
|
||||
|
||||
// If there are multiple ToolStripSpringTextBox items in the owning
|
||||
// ToolStrip, divide the total available width between them.
|
||||
if (springBoxCount > 1) width /= springBoxCount;
|
||||
|
||||
// If the available width is less than the default width, use the
|
||||
// default width, forcing one or more items onto the overflow menu.
|
||||
if (width < DefaultSize.Width) width = DefaultSize.Width;
|
||||
|
||||
// Retrieve the preferred size from the base class, but change the
|
||||
// width to the calculated width.
|
||||
Size size = base.GetPreferredSize(constrainingSize);
|
||||
size.Width = width;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
partial class TreeViewFix
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeWalker.WinForms
|
||||
{
|
||||
public partial class TreeViewFix : TreeView
|
||||
{
|
||||
public TreeViewFix()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
base.OnPaint(pe);
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if (m.Msg == 0x203) // double click
|
||||
{
|
||||
var localPos = PointToClient(Cursor.Position);
|
||||
var hitTestInfo = HitTest(localPos);
|
||||
if (hitTestInfo.Location == TreeViewHitTestLocations.StateImage)
|
||||
m.Result = IntPtr.Zero;
|
||||
else
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
else base.WndProc(ref m);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user