Miscellaneous changes. Keep original end of line characters.

This commit is contained in:
2015-06-07 01:52:30 +02:00
parent ae8ce4a213
commit 7983598bbe
43 changed files with 4038 additions and 3839 deletions

View File

@@ -1,87 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Collections;
namespace ServerExplorer.Controls
{
[DefaultProperty("Items")]
[DefaultEvent("SelectedIndexChanged")]
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[Docking(DockingBehavior.Ask)]
public class CustomListView : ListView
{
#region Declarations
ListViewItemComparer itemComparer = new ListViewItemComparer();
#endregion
#region Properties
private bool allowSorting = false;
public bool AllowSorting
{
get { return allowSorting; }
set { allowSorting = value; }
}
#endregion
#region Control life cicle
public CustomListView()
{
ColumnClick += CustomListView_ColumnClick;
}
#endregion
#region Events
private void CustomListView_ColumnClick(object sender, ColumnClickEventArgs e)
{
if (!allowSorting) { return; }
itemComparer.SetColumn(e.Column);
ListViewItemSorter = itemComparer;
Sort();
}
#endregion
}
#region ListViewItemComparer
internal class ListViewItemComparer : IComparer
{
private int _col;
private bool _ascending;
public void SetColumn(int col)
{
_col = col;
_ascending = _col != col || !_ascending;
}
public int Compare(object x, object y)
{
var itemA = (ListViewItem) x;
var itemB = (ListViewItem) y;
if (itemA.SubItems.Count <= _col || itemB.SubItems.Count <= _col)
{
return -1;
}
return _ascending
? String.CompareOrdinal(itemA.SubItems[_col].Text, itemB.SubItems[_col].Text)
: String.CompareOrdinal(itemB.SubItems[_col].Text, itemA.SubItems[_col].Text);
}
}
#endregion
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Collections;
namespace ServerExplorer.Controls
{
[DefaultProperty("Items")]
[DefaultEvent("SelectedIndexChanged")]
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[Docking(DockingBehavior.Ask)]
public class CustomListView : ListView
{
#region Declarations
ListViewItemComparer itemComparer = new ListViewItemComparer();
#endregion
#region Properties
private bool allowSorting = false;
public bool AllowSorting
{
get { return allowSorting; }
set { allowSorting = value; }
}
#endregion
#region Control life cicle
public CustomListView()
{
ColumnClick += CustomListView_ColumnClick;
}
#endregion
#region Events
private void CustomListView_ColumnClick(object sender, ColumnClickEventArgs e)
{
if (!allowSorting) { return; }
itemComparer.SetColumn(e.Column);
ListViewItemSorter = itemComparer;
Sort();
}
#endregion
}
#region ListViewItemComparer
internal class ListViewItemComparer : IComparer
{
private int _col;
private bool _ascending;
public void SetColumn(int col)
{
_col = col;
_ascending = _col != col || !_ascending;
}
public int Compare(object x, object y)
{
var itemA = (ListViewItem) x;
var itemB = (ListViewItem) y;
if (itemA.SubItems.Count <= _col || itemB.SubItems.Count <= _col)
{
return -1;
}
return _ascending
? String.CompareOrdinal(itemA.SubItems[_col].Text, itemB.SubItems[_col].Text)
: String.CompareOrdinal(itemB.SubItems[_col].Text, itemA.SubItems[_col].Text);
}
}
#endregion
}

View File

@@ -1,39 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace ServerExplorer.Controls
{
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
public class CustomTextBox : TextBox
{
#region SetTabWidth
private const int EM_SETTABSTOPS = 0x00CB;
[DllImport("User32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr h, int msg, int wParam, int[] lParam);
public void SetTabWidth(int tabWidth)
{
SendMessage(this.Handle, EM_SETTABSTOPS, 1, new int[] { tabWidth * 4 });
}
#endregion
private int _tabWidth=8;
public int TabWidth
{
get { return _tabWidth; }
set
{
_tabWidth = value;
SetTabWidth(value);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace ServerExplorer.Controls
{
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
public class CustomTextBox : TextBox
{
#region SetTabWidth
private const int EM_SETTABSTOPS = 0x00CB;
[DllImport("User32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr h, int msg, int wParam, int[] lParam);
public void SetTabWidth(int tabWidth)
{
SendMessage(this.Handle, EM_SETTABSTOPS, 1, new int[] { tabWidth * 4 });
}
#endregion
private int _tabWidth=8;
public int TabWidth
{
get { return _tabWidth; }
set
{
_tabWidth = value;
SetTabWidth(value);
}
}
}
}

View File

@@ -1,56 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace ServerExplorer.Controls
{
public class WindowButton : Button
{
#region Properties
private Form window = null;
public Form Window
{
get { return window; }
set { window = value; }
}
private bool active = false;
public bool Active
{
get { return active; }
set
{
active = value;
//Font = active ? fntActive : fntNormal;
ForeColor = active ? Color.Black : Color.Gray;
}
}
#endregion
#region Creator
public WindowButton()
{
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
Click += WindowButton_Click;
}
#endregion
#region Events
void WindowButton_Click(object sender, EventArgs e)
{
if (window == null) { return; }
window.Activate();
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace ServerExplorer.Controls
{
public class WindowButton : Button
{
#region Properties
private Form window = null;
public Form Window
{
get { return window; }
set { window = value; }
}
private bool active = false;
public bool Active
{
get { return active; }
set
{
active = value;
//Font = active ? fntActive : fntNormal;
ForeColor = active ? Color.Black : Color.Gray;
}
}
#endregion
#region Creator
public WindowButton()
{
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
Click += WindowButton_Click;
}
#endregion
#region Events
void WindowButton_Click(object sender, EventArgs e)
{
if (window == null) { return; }
window.Activate();
}
#endregion
}
}