Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
6ceef76c65 | |||
71a2524338 | |||
5c2bd79687 | |||
0221ad1e7a | |||
315c6f7249 |
@ -56,6 +56,11 @@ namespace Components
|
||||
var property = data.GetType().GetProperty(headersConfig[rowIndex].propertyName);
|
||||
if (property != null)
|
||||
{
|
||||
if(property.PropertyType == typeof(DateOnly))
|
||||
{
|
||||
worksheet.Cells[rowIndex + 2, colIndex + 3].Value = property.GetValue(data).ToString();
|
||||
}
|
||||
else
|
||||
worksheet.Cells[rowIndex + 2, colIndex + 3].Value = property.GetValue(data);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Authors>ns.potapov</Authors>
|
||||
<VersionPrefix>1.0.5</VersionPrefix>
|
||||
<VersionPrefix>1.1.0</VersionPrefix>
|
||||
<Version>$(VersionPrefix)</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -36,22 +36,20 @@
|
||||
checkedListBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
checkedListBox.CheckOnClick = true;
|
||||
checkedListBox.FormattingEnabled = true;
|
||||
checkedListBox.Location = new Point(9, 8);
|
||||
checkedListBox.Margin = new Padding(3, 4, 3, 4);
|
||||
checkedListBox.Location = new Point(8, 6);
|
||||
checkedListBox.Name = "checkedListBox";
|
||||
checkedListBox.Size = new Size(509, 400);
|
||||
checkedListBox.Size = new Size(446, 292);
|
||||
checkedListBox.TabIndex = 0;
|
||||
checkedListBox.ItemCheck += checkedListBox_ItemCheck;
|
||||
//
|
||||
// UserControlCheckedList
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.Firebrick;
|
||||
Controls.Add(checkedListBox);
|
||||
Margin = new Padding(3, 4, 3, 4);
|
||||
Name = "UserControlCheckedList";
|
||||
Size = new Size(527, 415);
|
||||
Size = new Size(461, 311);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Components.Exceptions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -44,12 +45,12 @@ namespace Components
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<string> CheckedItems
|
||||
public List<string> CheckedItemss
|
||||
{
|
||||
get
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
foreach(var item in checkedListBox.CheckedItems )
|
||||
foreach (var item in checkedListBox.CheckedItems)
|
||||
{
|
||||
list.Add(item.ToString());
|
||||
}
|
||||
@ -57,9 +58,12 @@ namespace Components
|
||||
}
|
||||
set
|
||||
{
|
||||
if (checkedListBox.Items.Contains(value))
|
||||
foreach (var item in value)
|
||||
{
|
||||
checkedListBox.SetItemCheckState(checkedListBox.Items.IndexOf(value), CheckState.Checked);
|
||||
if (checkedListBox.Items.Contains(item))
|
||||
{
|
||||
checkedListBox.SetItemCheckState(checkedListBox.Items.IndexOf(item), CheckState.Checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,21 +84,25 @@ namespace Components
|
||||
checkedListBox.Items.Clear();
|
||||
}
|
||||
private void checkedListBox_ItemCheck(object sender, ItemCheckEventArgs e)
|
||||
{
|
||||
this.BeginInvoke((MethodInvoker)(
|
||||
() =>
|
||||
{
|
||||
if (checkedListBox.CheckedItems.Count > MaxCheckedItemsCount)
|
||||
{
|
||||
if (typeOfMaxChecked == Types.Exception)
|
||||
{
|
||||
MessageBox.Show("Превышено максимальное число выбранных элементов");
|
||||
checkedListBox.SetItemChecked(e.Index, false);
|
||||
throw new MaxCheckedItemsCountExceedException("Превышено максимальное число выбранных элементов");
|
||||
}
|
||||
else if (typeOfMaxChecked == Types.DeleteFirst)
|
||||
{
|
||||
checkedListBox.SetItemChecked(0, false);
|
||||
checkedListBox.SetItemCheckState(checkedListBox.Items.IndexOf(CheckedItem), CheckState.Unchecked);
|
||||
}
|
||||
|
||||
}
|
||||
_onCheckedItemChangedEvent?.Invoke(sender, e);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ namespace WinFormsApp
|
||||
list.Add("Çíàòü");
|
||||
list.Add("C#");
|
||||
userControlCheckedList.SetCheckedListBoxValues(list);
|
||||
|
||||
userControlCheckedList.CheckedItem = list[3];
|
||||
userControlCheckedList.MaxCheckedItemsCount = 3;
|
||||
userControlCheckedList.ChangeTypeOfMaxChecked(Components.Types.DeleteFirst);
|
||||
}
|
||||
|
||||
private void buttonClearList_Click(object sender, EventArgs e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user