更改版本号为V2.2.6,给美好的六月做个总结吧!~
This commit is contained in:
parent
e493e931bf
commit
52697ef27a
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,120 +0,0 @@
|
||||
<?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>
|
@ -1,203 +0,0 @@
|
||||
/******************************************************************************
|
||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||
* CopyRight (C) 2012-2020 ShenYongHua(沈永华).
|
||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@qq.com
|
||||
*
|
||||
* Blog: https://www.cnblogs.com/yhuse
|
||||
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||
* GitHub: https://github.com/yhuse/SunnyUI
|
||||
*
|
||||
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
||||
* If you use this code, please keep this note.
|
||||
* 如果您使用此代码,请保留此说明。
|
||||
******************************************************************************
|
||||
* 文件名称: UIGridColumn.cs
|
||||
* 文件说明: 表格列定义类
|
||||
* 当前版本: V2.2
|
||||
* 创建日期: 2020-04-15
|
||||
*
|
||||
* 2020-04-11: V2.2.2 增加UIGrid
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
#pragma warning disable 1591
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
public enum UIGridColumnType
|
||||
{
|
||||
Label,
|
||||
Button,
|
||||
CheckBox,
|
||||
Combobox,
|
||||
Image,
|
||||
LinkLabel,
|
||||
TextBox,
|
||||
IntTextBox,
|
||||
DoubleTextBox
|
||||
}
|
||||
|
||||
public enum UIGridColumnSizeMode
|
||||
{
|
||||
Fill,
|
||||
Fixed
|
||||
}
|
||||
|
||||
public delegate string UIGridColumnFormat(object obj);
|
||||
|
||||
[Serializable]
|
||||
public sealed class UIGridColumn : IStyleInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题名称
|
||||
/// </summary>
|
||||
public string HeaderText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题名称
|
||||
/// </summary>
|
||||
public string FooterText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标题对齐方式
|
||||
/// </summary>
|
||||
[DefaultValue(StringAlignment.Center)]
|
||||
public StringAlignment HeaderTextAlignment { get; set; } = StringAlignment.Center;
|
||||
|
||||
/// <summary>
|
||||
/// 页脚对齐方式
|
||||
/// </summary>
|
||||
[DefaultValue(StringAlignment.Center)]
|
||||
public StringAlignment FooterTextAlignment { get; set; } = StringAlignment.Center;
|
||||
|
||||
/// <summary>
|
||||
/// Fill模式,自动填充时所占比率
|
||||
/// </summary>
|
||||
[DefaultValue(100)]
|
||||
public int FillWeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列类型
|
||||
/// </summary>
|
||||
[DefaultValue(UIGridColumnType.Label)]
|
||||
public UIGridColumnType ColumnType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列宽度类型
|
||||
/// </summary>
|
||||
[DefaultValue(UIGridColumnSizeMode.Fill)]
|
||||
public UIGridColumnSizeMode SizeMode { get; set; } = UIGridColumnSizeMode.Fill;
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据名称
|
||||
/// </summary>
|
||||
public string DataPropertyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fixed模式,固定宽度
|
||||
/// </summary>
|
||||
[DefaultValue(100)]
|
||||
public int Width { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 文字对齐方式
|
||||
/// </summary>
|
||||
[DefaultValue(StringAlignment.Center)]
|
||||
public StringAlignment TextAlignment { get; set; } = StringAlignment.Center;
|
||||
|
||||
public event UIGridColumnFormat OnDataFormat;
|
||||
|
||||
/// <summary>
|
||||
/// 类型为按钮时按钮标题
|
||||
/// </summary>
|
||||
public string ButtonText { get; set; } = "Edit";
|
||||
|
||||
[DefaultValue(true)]
|
||||
public bool ReadOnly { get; set; } = true;
|
||||
|
||||
private List<object> ComboboxItems = new List<object>();
|
||||
|
||||
public List<object> GetComboboxItems()
|
||||
{
|
||||
return ComboboxItems;
|
||||
}
|
||||
|
||||
public UIGridColumn()
|
||||
{
|
||||
}
|
||||
|
||||
public UIGridColumn(string name, string headerText, string dataPropertyName,
|
||||
UIGridColumnType columnType = UIGridColumnType.Label,
|
||||
UIGridColumnSizeMode sizeMode = UIGridColumnSizeMode.Fill, int size = 100)
|
||||
{
|
||||
Name = name;
|
||||
HeaderText = headerText;
|
||||
DataPropertyName = dataPropertyName;
|
||||
ColumnType = columnType;
|
||||
SizeMode = sizeMode;
|
||||
if (sizeMode == UIGridColumnSizeMode.Fill)
|
||||
FillWeight = size;
|
||||
else
|
||||
Width = size;
|
||||
}
|
||||
|
||||
public UIGridColumn SetComboboxItems(List<object> objects)
|
||||
{
|
||||
ComboboxItems.Clear();
|
||||
foreach (object obj in objects)
|
||||
{
|
||||
ComboboxItems.Add(obj);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public string DoFormat(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (OnDataFormat == null)
|
||||
{
|
||||
return obj.ToString();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return OnDataFormat?.Invoke(obj);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return obj.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(UIStyle.Blue)]
|
||||
public UIStyle Style { get; set; } = UIStyle.Blue;
|
||||
|
||||
[DefaultValue(false)]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
|
||||
public string Version { get; } = UIGlobal.Version;
|
||||
|
||||
public string TagString { get; set; }
|
||||
|
||||
public Rectangle Bounds { get; set; }
|
||||
|
||||
[DefaultValue(2)]
|
||||
public int TextBoxDecimals { get; set; } = 2;
|
||||
|
||||
public string Guid { get; private set; } = RandomEx.RandomLong().ToString();
|
||||
}
|
||||
}
|
@ -1,604 +0,0 @@
|
||||
/******************************************************************************
|
||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||
* CopyRight (C) 2012-2020 ShenYongHua(沈永华).
|
||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@qq.com
|
||||
*
|
||||
* Blog: https://www.cnblogs.com/yhuse
|
||||
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||
* GitHub: https://github.com/yhuse/SunnyUI
|
||||
*
|
||||
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
||||
* If you use this code, please keep this note.
|
||||
* 如果您使用此代码,请保留此说明。
|
||||
******************************************************************************
|
||||
* 文件名称: UIGridColumn.cs
|
||||
* 文件说明: 表格行定义类
|
||||
* 当前版本: V2.2
|
||||
* 创建日期: 2020-04-15
|
||||
*
|
||||
* 2020-04-11: V2.2.2 增加UIGrid
|
||||
* 2020-04-25: V2.2.4 更新主题配置类
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#pragma warning disable 1591
|
||||
|
||||
// ReSharper disable All
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
[ToolboxItem(false)]
|
||||
public sealed partial class UIGridRow : UIPanel
|
||||
{
|
||||
public UIGrid Grid { get; }
|
||||
|
||||
private object data;
|
||||
public readonly List<Control> Cells = new List<Control>();
|
||||
|
||||
private bool selected;
|
||||
|
||||
public UIGridRow(UIGrid grid)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DoubleBuffered();
|
||||
|
||||
Grid = grid;
|
||||
AddCells();
|
||||
Height = grid.RowHeight;
|
||||
RadiusSides = UICornerRadiusSides.None;
|
||||
RectSides = ToolStripStatusLabelBorderSides.None;
|
||||
MouseEnter += Control_MouseEnter;
|
||||
MouseLeave += Control_MouseLeave;
|
||||
}
|
||||
|
||||
private UIGridRowState state = UIGridRowState.None;
|
||||
|
||||
public UIGridRowState State
|
||||
{
|
||||
get => state;
|
||||
set
|
||||
{
|
||||
state = value;
|
||||
FillColor = GetRowColor();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selected
|
||||
{
|
||||
get => selected;
|
||||
set
|
||||
{
|
||||
selected = value;
|
||||
if (State == UIGridRowState.None)
|
||||
{
|
||||
FillColor = GetRowColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||
{
|
||||
base.SetStyleColor(uiColor);
|
||||
if (uiColor.IsCustom()) return;
|
||||
|
||||
FillColor = GetRowColor();
|
||||
|
||||
foreach (var cell in Cells)
|
||||
{
|
||||
if (cell is IStyleInterface inCell)
|
||||
{
|
||||
inCell.Style = uiColor.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public object Data
|
||||
{
|
||||
get => data;
|
||||
set
|
||||
{
|
||||
data = value;
|
||||
UpdateData();
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearCells()
|
||||
{
|
||||
foreach (Control control in Cells)
|
||||
{
|
||||
control.Visible = false;
|
||||
control.Dispose();
|
||||
}
|
||||
|
||||
Cells.Clear();
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnSizeChanged(e);
|
||||
foreach (var cell in Cells)
|
||||
{
|
||||
UIGridColumn column = Grid.GetColumnByGuid(cell.Tag.ToString());
|
||||
cell.Bounds = column.Bounds;
|
||||
}
|
||||
}
|
||||
|
||||
private Point MousePoint;
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
MousePoint = e.Location;
|
||||
}
|
||||
|
||||
protected override void OnDoubleClick(EventArgs e)
|
||||
{
|
||||
base.OnDoubleClick(e);
|
||||
|
||||
UIGridColumn SelectedColumn = null;
|
||||
foreach (var column in Grid.Columns)
|
||||
{
|
||||
if (MousePoint.X >= column.Bounds.Left && MousePoint.Y <= column.Bounds.Right)
|
||||
{
|
||||
SelectedColumn = column;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectedColumn != null)
|
||||
{
|
||||
if (!ExistDataPropertyName(SelectedColumn.DataPropertyName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
object value = GetValue(SelectedColumn);
|
||||
if (value != null)
|
||||
{
|
||||
Grid.GridCellDoubleClick(Grid, SelectedColumn, this, data, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
foreach (var column in Grid.Columns)
|
||||
{
|
||||
if (column.ColumnType == UIGridColumnType.Label)
|
||||
{
|
||||
if (!ExistDataPropertyName(column.DataPropertyName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
object value = GetValue(column);
|
||||
string showText = column.DoFormat(value);
|
||||
|
||||
Color color = UIStyles.GetStyleColor(column.Style).PanelForeColor;
|
||||
SizeF sf = e.Graphics.MeasureString(showText, Font);
|
||||
if (column.TextAlignment == StringAlignment.Near)
|
||||
e.Graphics.DrawString(showText, Font, color, column.Bounds.X, 1 + (column.Bounds.Height - sf.Height) / 2.0f);
|
||||
if (column.TextAlignment == StringAlignment.Center)
|
||||
e.Graphics.DrawString(showText, Font, color, column.Bounds.X + (column.Bounds.Width - sf.Width) / 2.0f, 1 + (column.Bounds.Height - sf.Height) / 2.0f);
|
||||
if (column.TextAlignment == StringAlignment.Far)
|
||||
e.Graphics.DrawString(showText, Font, color, column.Bounds.Right - sf.Width - 1, 1 + (column.Bounds.Height - sf.Height) / 2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (Grid.ShowLine)
|
||||
{
|
||||
e.Graphics.DrawLine(Grid.LineColor, 0, Height - 1, Width, Height - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private object GetValue(UIGridColumn column)
|
||||
{
|
||||
object value = null;
|
||||
if (data is DataRow)
|
||||
{
|
||||
DataRow row = data as DataRow;
|
||||
value = row[column.DataPropertyName];
|
||||
}
|
||||
else
|
||||
{
|
||||
var cell = data.GetType().GetProperty(column.DataPropertyName);
|
||||
if (cell != null)
|
||||
{
|
||||
value = cell.GetValue(data, null);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private bool ExistDataPropertyName(string dataPropertyName)
|
||||
{
|
||||
if (dataPropertyName.IsNullOrEmpty()) return false;
|
||||
|
||||
if (data is DataRow)
|
||||
{
|
||||
DataRow row = data as DataRow;
|
||||
return row.Table.Columns.Contains(dataPropertyName) && row[dataPropertyName] != null &&
|
||||
row[dataPropertyName].ToString() != "";
|
||||
}
|
||||
else
|
||||
{
|
||||
var cell = data.GetType().GetProperty(dataPropertyName);
|
||||
return cell != null;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsUpdateData;
|
||||
|
||||
private void UpdateData()
|
||||
{
|
||||
IsUpdateData = true;
|
||||
foreach (var cell in Cells)
|
||||
{
|
||||
UIGridColumn column = Grid.GetColumnByGuid(cell.Tag.ToString());
|
||||
|
||||
if (!ExistDataPropertyName(column.DataPropertyName) || column.ColumnType == UIGridColumnType.Label)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
object value = GetValue(column);
|
||||
string showText = column.DoFormat(value);
|
||||
|
||||
switch (column.ColumnType)
|
||||
{
|
||||
case UIGridColumnType.CheckBox:
|
||||
UICheckBox checkBox = (UICheckBox)cell;
|
||||
if (value is int intValue)
|
||||
{
|
||||
checkBox.Checked = intValue == 1;
|
||||
}
|
||||
|
||||
if (value is bool boolValue)
|
||||
{
|
||||
checkBox.Checked = boolValue;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case UIGridColumnType.Combobox:
|
||||
UIComboBox comboBox = (UIComboBox)cell;
|
||||
List<object> items = column.GetComboboxItems();
|
||||
for (int itemIndex = 0; itemIndex < items.Count; itemIndex++)
|
||||
{
|
||||
if (value.ToString().Equals(items[itemIndex].ToString()))
|
||||
{
|
||||
comboBox.SelectedIndex = itemIndex;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case UIGridColumnType.Image:
|
||||
PictureBox picture = (PictureBox)cell;
|
||||
if (value is int imageIndex)
|
||||
{
|
||||
if (Grid.ImageList != null && imageIndex >= 0 &&
|
||||
imageIndex < Grid.ImageList.Images.Count)
|
||||
{
|
||||
picture.Image = Grid.ImageList.Images[imageIndex];
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case UIGridColumnType.LinkLabel:
|
||||
UILinkLabel linkLabel = (UILinkLabel)cell;
|
||||
linkLabel.Text = showText;
|
||||
|
||||
break;
|
||||
|
||||
case UIGridColumnType.TextBox:
|
||||
UITextBox textBox = (UITextBox)cell;
|
||||
cell.Text = showText;
|
||||
break;
|
||||
|
||||
case UIGridColumnType.IntTextBox:
|
||||
UITextBox intTextBox = (UITextBox)cell;
|
||||
intTextBox.IntValue = showText.ToInt();
|
||||
|
||||
break;
|
||||
|
||||
case UIGridColumnType.DoubleTextBox:
|
||||
UITextBox doubleTextBox = (UITextBox)cell;
|
||||
doubleTextBox.DoubleValue = showText.ToDouble();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
IsUpdateData = false;
|
||||
}
|
||||
|
||||
private void AddCells()
|
||||
{
|
||||
if (Grid.ColumnCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var column in Grid.Columns)
|
||||
{
|
||||
switch (column.ColumnType)
|
||||
{
|
||||
case UIGridColumnType.Button:
|
||||
UIButton button = new UIButton();
|
||||
button.Style = column.Style;
|
||||
button.StyleCustomMode = column.StyleCustomMode;
|
||||
button.Text = column.ButtonText;
|
||||
button.BackColor = Color.Transparent;
|
||||
button.Click += Button_Click;
|
||||
AddControl(button, column);
|
||||
break;
|
||||
|
||||
case UIGridColumnType.CheckBox:
|
||||
UICheckBox checkBox = new UICheckBox();
|
||||
checkBox.Style = column.Style;
|
||||
checkBox.StyleCustomMode = column.StyleCustomMode;
|
||||
checkBox.BackColor = Color.Transparent;
|
||||
checkBox.ReadOnly = column.ReadOnly;
|
||||
checkBox.ValueChanged += CheckBox_ValueChanged;
|
||||
AddControl(checkBox, column);
|
||||
break;
|
||||
|
||||
case UIGridColumnType.Combobox:
|
||||
UIComboBox comboBox = new UIComboBox();
|
||||
comboBox.Style = column.Style;
|
||||
comboBox.StyleCustomMode = column.StyleCustomMode;
|
||||
comboBox.BackColor = Color.Transparent;
|
||||
comboBox.DropDownStyle = UIDropDownStyle.DropDownList;
|
||||
|
||||
List<object> items = column.GetComboboxItems();
|
||||
foreach (object item in items)
|
||||
{
|
||||
comboBox.Items.Add(item);
|
||||
}
|
||||
|
||||
comboBox.SelectedIndexChanged += ComboBox_SelectedIndexChanged;
|
||||
AddControl(comboBox, column);
|
||||
break;
|
||||
|
||||
case UIGridColumnType.Image:
|
||||
PictureBox picture = new PictureBox();
|
||||
picture.BackColor = Color.Transparent;
|
||||
picture.SizeMode = PictureBoxSizeMode.CenterImage;
|
||||
AddControl(picture, column);
|
||||
break;
|
||||
|
||||
case UIGridColumnType.LinkLabel:
|
||||
UILinkLabel linkLabel = new UILinkLabel();
|
||||
linkLabel.Style = column.Style;
|
||||
linkLabel.StyleCustomMode = column.StyleCustomMode;
|
||||
linkLabel.BackColor = Color.Transparent;
|
||||
if (column.TextAlignment == StringAlignment.Near)
|
||||
linkLabel.TextAlign = ContentAlignment.MiddleLeft;
|
||||
if (column.TextAlignment == StringAlignment.Center)
|
||||
linkLabel.TextAlign = ContentAlignment.MiddleCenter;
|
||||
if (column.TextAlignment == StringAlignment.Far)
|
||||
linkLabel.TextAlign = ContentAlignment.MiddleRight;
|
||||
|
||||
linkLabel.LinkClicked += LinkLabel_LinkClicked;
|
||||
AddControl(linkLabel, column);
|
||||
break;
|
||||
|
||||
case UIGridColumnType.TextBox:
|
||||
UITextBox textBox = new UITextBox();
|
||||
textBox.Style = column.Style;
|
||||
textBox.StyleCustomMode = column.StyleCustomMode;
|
||||
textBox.BackColor = Color.Transparent;
|
||||
textBox.ReadOnly = column.ReadOnly;
|
||||
textBox.MouseLeave += TextBox_MouseLeave;
|
||||
AddControl(textBox, column);
|
||||
break;
|
||||
|
||||
case UIGridColumnType.IntTextBox:
|
||||
UITextBox intTextBox = new UITextBox();
|
||||
intTextBox.Style = column.Style;
|
||||
intTextBox.StyleCustomMode = column.StyleCustomMode;
|
||||
intTextBox.Type = UITextBox.UIEditType.Integer;
|
||||
intTextBox.BackColor = Color.Transparent;
|
||||
intTextBox.ReadOnly = column.ReadOnly;
|
||||
intTextBox.MouseLeave += IntTextBox_MouseLeave;
|
||||
AddControl(intTextBox, column);
|
||||
break;
|
||||
|
||||
case UIGridColumnType.DoubleTextBox:
|
||||
UITextBox doubleTextBox = new UITextBox();
|
||||
doubleTextBox.Style = column.Style;
|
||||
doubleTextBox.StyleCustomMode = column.StyleCustomMode;
|
||||
doubleTextBox.Type = UITextBox.UIEditType.Double;
|
||||
doubleTextBox.BackColor = Color.Transparent;
|
||||
doubleTextBox.ReadOnly = column.ReadOnly;
|
||||
doubleTextBox.MouseLeave += DoubleTextBox_MouseLeave;
|
||||
doubleTextBox.DecLength = column.TextBoxDecimals;
|
||||
AddControl(doubleTextBox, column);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckBox_ValueChanged(object sender, bool value)
|
||||
{
|
||||
if (IsUpdateData) return;
|
||||
|
||||
UICheckBox cell = (UICheckBox)sender;
|
||||
UIGridColumn column = Grid.GetColumnByGuid(cell.Tag.ToString());
|
||||
Grid.GridCellValueChange(Grid, column, this, data, cell.Checked);
|
||||
}
|
||||
|
||||
private void ComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
if (IsUpdateData) return;
|
||||
|
||||
UIComboBox cell = (UIComboBox)sender;
|
||||
UIGridColumn column = Grid.GetColumnByGuid(cell.Tag.ToString());
|
||||
Grid.GridCellValueChange(Grid, column, this, data, cell.SelectedItem);
|
||||
}
|
||||
|
||||
private void TextBox_MouseLeave(object sender, System.EventArgs e)
|
||||
{
|
||||
if (IsUpdateData) return;
|
||||
|
||||
UITextBox cell = (UITextBox)sender;
|
||||
UIGridColumn column = Grid.GetColumnByGuid(cell.Tag.ToString());
|
||||
Grid.GridCellValueChange(Grid, column, this, data, cell.Text);
|
||||
}
|
||||
|
||||
private void IntTextBox_MouseLeave(object sender, System.EventArgs e)
|
||||
{
|
||||
if (IsUpdateData) return;
|
||||
|
||||
UITextBox cell = (UITextBox)sender;
|
||||
UIGridColumn column = Grid.GetColumnByGuid(cell.Tag.ToString());
|
||||
Grid.GridCellValueChange(Grid, column, this, data, cell.IntValue);
|
||||
}
|
||||
|
||||
private void DoubleTextBox_MouseLeave(object sender, System.EventArgs e)
|
||||
{
|
||||
if (IsUpdateData) return;
|
||||
|
||||
UITextBox cell = (UITextBox)sender;
|
||||
UIGridColumn column = Grid.GetColumnByGuid(cell.Tag.ToString());
|
||||
Grid.GridCellValueChange(Grid, column, this, data, cell.DoubleValue);
|
||||
}
|
||||
|
||||
private void LinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
UILinkLabel cell = (UILinkLabel)sender;
|
||||
UIGridColumn column = Grid.GetColumnByGuid(cell.Tag.ToString());
|
||||
Grid.GridCellLinkClick(Grid, column, this, data, cell.Text);
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
UIButton cell = (UIButton)sender;
|
||||
UIGridColumn column = Grid.GetColumnByGuid(cell.Tag.ToString());
|
||||
Grid.GridCellButtonClick(Grid, column, this, data, cell.Text);
|
||||
}
|
||||
|
||||
private void Label_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
Control ctrl = ((Control)sender).Parent;
|
||||
while (ctrl != null)
|
||||
{
|
||||
if (ctrl is UIRowsLayout panel)
|
||||
{
|
||||
if (!panel.Focused)
|
||||
panel.Focus();
|
||||
break;
|
||||
}
|
||||
|
||||
ctrl = ctrl.Parent;
|
||||
}
|
||||
|
||||
Grid.SelectedRow = this;
|
||||
}
|
||||
|
||||
private void AddControl(Control control, UIGridColumn column)
|
||||
{
|
||||
Cells.Add(control);
|
||||
control.Parent = this;
|
||||
control.Bounds = column.Bounds;
|
||||
control.Margin = new Padding(1);
|
||||
control.Tag = column.Guid;
|
||||
control.Click += Label_Click;
|
||||
control.MouseEnter += Control_MouseEnter;
|
||||
control.MouseLeave += Control_MouseLeave;
|
||||
}
|
||||
|
||||
private void Control_MouseLeave(object sender, System.EventArgs e)
|
||||
{
|
||||
FillColor = GetRowColor();
|
||||
}
|
||||
|
||||
private void Control_MouseEnter(object sender, System.EventArgs e)
|
||||
{
|
||||
if (State == UIGridRowState.None)
|
||||
{
|
||||
FillColor = Grid.RowSelectedColor;
|
||||
}
|
||||
}
|
||||
|
||||
private int rowIndex;
|
||||
|
||||
public int RowIndex
|
||||
{
|
||||
get => rowIndex;
|
||||
set
|
||||
{
|
||||
rowIndex = value;
|
||||
FillColor = GetRowColor();
|
||||
}
|
||||
}
|
||||
|
||||
private Color GetRowColor()
|
||||
{
|
||||
switch (State)
|
||||
{
|
||||
case UIGridRowState.Info:
|
||||
return UIStyles.Gray.GridSelectedColor;
|
||||
|
||||
case UIGridRowState.Success:
|
||||
return UIStyles.Green.GridSelectedColor;
|
||||
|
||||
case UIGridRowState.Warning:
|
||||
return UIStyles.Orange.GridSelectedColor;
|
||||
|
||||
case UIGridRowState.Error:
|
||||
return UIStyles.Red.GridSelectedColor;
|
||||
|
||||
case UIGridRowState.None:
|
||||
default:
|
||||
if (Selected)
|
||||
{
|
||||
return Grid.RowSelectedColor;
|
||||
}
|
||||
|
||||
if (Grid.Stripe)
|
||||
{
|
||||
return rowIndex.IsEven() ? Grid.StripeEvenColor : Grid.StripeOddColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color.White;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// UIGridRow
|
||||
//
|
||||
this.Name = "UIGridRow";
|
||||
this.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
|
||||
this.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
|
||||
this.Size = new System.Drawing.Size(543, 32);
|
||||
this.Click += new System.EventHandler(this.Label_Click);
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
}
|
||||
|
||||
public enum UIGridRowState
|
||||
{
|
||||
None,
|
||||
Info,
|
||||
Success,
|
||||
Warning,
|
||||
Error
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?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>
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.2.5.0")]
|
||||
[assembly: AssemblyFileVersion("2.2.5.0")]
|
||||
[assembly: AssemblyVersion("2.2.6.0")]
|
||||
[assembly: AssemblyFileVersion("2.2.6.0")]
|
2
SunnyUI/Properties/Resources.Designer.cs
generated
2
SunnyUI/Properties/Resources.Designer.cs
generated
@ -200,7 +200,7 @@ namespace Sunny.UI.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 V2.2.5 的本地化字符串。
|
||||
/// 查找类似 V2.2.6 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string Version {
|
||||
get {
|
||||
|
@ -162,8 +162,7 @@
|
||||
<value>..\Resources\notifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Version" xml:space="preserve">
|
||||
<value>V2.2.5</value>
|
||||
<comment>更新主题风格类</comment>
|
||||
<value>V2.2.6</value>
|
||||
</data>
|
||||
<data name="wind" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\wind.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
|
@ -149,13 +149,6 @@
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\UIGlobal.cs" />
|
||||
<Compile Include="Controls\UIGrid.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\UIGridColumn.cs" />
|
||||
<Compile Include="Controls\UIGridRow.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\UIDoubleUpDown.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@ -520,12 +513,6 @@
|
||||
<EmbeddedResource Include="Controls\UIComboBox.resx">
|
||||
<DependentUpon>UIComboBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\UIGrid.resx">
|
||||
<DependentUpon>UIGrid.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\UIGridRow.resx">
|
||||
<DependentUpon>UIGridRow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\UIDoubleUpDown.resx">
|
||||
<DependentUpon>UIDoubleUpDown.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
Loading…
x
Reference in New Issue
Block a user