DotNet 4.8.1 build of DotNetBar
@@ -0,0 +1,38 @@
|
||||
using System.Collections;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.SuperGrid.TextMarkup
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents block layout manager responsible for sizing the content blocks.
|
||||
/// </summary>
|
||||
public abstract class BlockLayoutManager
|
||||
{
|
||||
private Graphics _Graphics;
|
||||
|
||||
/// <summary>
|
||||
/// Resizes the content block and sets it's Bounds property to reflect new size.
|
||||
/// </summary>
|
||||
/// <param name="block">Content block to resize.</param>
|
||||
/// <param name="availableSize">Content size available for the block in the given line.</param>
|
||||
public abstract void Layout(IBlock block, Size availableSize);
|
||||
|
||||
/// <summary>
|
||||
/// Performs layout finalization
|
||||
/// </summary>
|
||||
/// <param name="containerBounds"></param>
|
||||
/// <param name="blocksBounds"></param>
|
||||
/// <param name="lines"></param>
|
||||
/// <returns></returns>
|
||||
public abstract Rectangle FinalizeLayout(Rectangle containerBounds, Rectangle blocksBounds, ArrayList lines);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the graphics object used by layout manager.
|
||||
/// </summary>
|
||||
public Graphics Graphics
|
||||
{
|
||||
get {return _Graphics;}
|
||||
set {_Graphics = value;}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
namespace DevComponents.SuperGrid.TextMarkup
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies orientation of content.
|
||||
/// </summary>
|
||||
public enum eContentOrientation
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates Horizontal orientation of the content.
|
||||
/// </summary>
|
||||
Horizontal,
|
||||
/// <summary>
|
||||
/// Indicates Vertical orientation of the content.
|
||||
/// </summary>
|
||||
Vertical
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies content horizontal alignment.
|
||||
/// </summary>
|
||||
public enum eContentAlignment
|
||||
{
|
||||
/// <summary>
|
||||
/// Content is left aligned.UI
|
||||
/// </summary>
|
||||
Left,
|
||||
/// <summary>
|
||||
/// Content is right aligned.
|
||||
/// </summary>
|
||||
Right,
|
||||
/// <summary>
|
||||
/// Content is centered.
|
||||
/// </summary>
|
||||
Center
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies content vertical alignment.
|
||||
/// </summary>
|
||||
public enum eContentVerticalAlignment
|
||||
{
|
||||
/// <summary>
|
||||
/// Content is top aligned.
|
||||
/// </summary>
|
||||
Top,
|
||||
/// <summary>
|
||||
/// Content is bottom aligned.
|
||||
/// </summary>
|
||||
Bottom,
|
||||
/// <summary>
|
||||
/// Content is in the middle.
|
||||
/// </summary>
|
||||
Middle
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.SuperGrid.TextMarkup
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a content block interface.
|
||||
/// </summary>
|
||||
public interface IBlock
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the bounds of the content block.
|
||||
/// </summary>
|
||||
Rectangle Bounds {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether content block is visible.
|
||||
/// </summary>
|
||||
bool Visible {get;set;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace DevComponents.SuperGrid.TextMarkup
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a extended content block interface for advanced layout information.
|
||||
/// </summary>
|
||||
public interface IBlockExtended : IBlock
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets whether element is block level element.
|
||||
/// </summary>
|
||||
bool IsBlockElement { get;}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether new line is required after the element.
|
||||
/// </summary>
|
||||
bool IsNewLineAfterElement { get;}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether element can be on new line.
|
||||
/// </summary>
|
||||
bool CanStartNewLine { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.SuperGrid.TextMarkup
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents interface for block layout.
|
||||
/// </summary>
|
||||
public interface IContentLayout
|
||||
{
|
||||
/// <summary>
|
||||
/// Performs layout of the content block.
|
||||
/// </summary>
|
||||
/// <param name="containerBounds">Container bounds to layout content blocks in.</param>
|
||||
/// <param name="contentBlocks">Content blocks to layout.</param>
|
||||
/// <param name="blockLayout">Block layout manager that resizes the content blocks.</param>
|
||||
/// <returns>The bounds of the content blocks within the container bounds.</returns>
|
||||
Rectangle Layout(Rectangle containerBounds, IBlock[] contentBlocks, BlockLayoutManager blockLayout);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,709 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.SuperGrid.TextMarkup
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the serial content layout manager that arranges content blocks in series next to each other.
|
||||
/// </summary>
|
||||
public class SerialContentLayoutManager:IContentLayout
|
||||
{
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when X, Y position of next block is calcualted.
|
||||
/// </summary>
|
||||
public event LayoutManagerPositionEventHandler NextPosition;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs before new block is layed out.
|
||||
/// </summary>
|
||||
public event LayoutManagerLayoutEventHandler BeforeNewBlockLayout;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Variables
|
||||
|
||||
private int _BlockSpacing;
|
||||
private bool _FitContainerOversize;
|
||||
private bool _FitContainer;
|
||||
private bool _VerticalFitContainerWidth;
|
||||
private bool _HorizontalFitContainerHeight;
|
||||
private bool _EvenHeight;
|
||||
private bool _MultiLine;
|
||||
private bool _RightToLeft;
|
||||
private bool _OversizeDistribute;
|
||||
|
||||
private eContentAlignment _ContentAlignment = eContentAlignment.Left;
|
||||
private eContentOrientation _ContentOrientation = eContentOrientation.Horizontal;
|
||||
private eContentVerticalAlignment _ContentVerticalAlignment = eContentVerticalAlignment.Middle;
|
||||
private eContentVerticalAlignment _BlockLineAlignment = eContentVerticalAlignment.Middle;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IContentLayout Members
|
||||
|
||||
/// <summary>
|
||||
/// Performs layout of the content block.
|
||||
/// </summary>
|
||||
/// <param name="containerBounds">Container bounds to layout content blocks in.</param>
|
||||
/// <param name="contentBlocks">Content blocks to layout.</param>
|
||||
/// <param name="blockLayout">Block layout manager that resizes the content blocks.</param>
|
||||
/// <returns>The bounds of the content blocks within the container bounds.</returns>
|
||||
public virtual Rectangle Layout(Rectangle containerBounds, IBlock[] contentBlocks, BlockLayoutManager blockLayout)
|
||||
{
|
||||
Rectangle blocksBounds = Rectangle.Empty;
|
||||
Point position = containerBounds.Location;
|
||||
ArrayList lines = new ArrayList();
|
||||
lines.Add(new BlockLineInfo());
|
||||
BlockLineInfo currentLine = lines[0] as BlockLineInfo;
|
||||
bool switchToNewLine = false;
|
||||
int visibleIndex = 0;
|
||||
|
||||
foreach (IBlock block in contentBlocks)
|
||||
{
|
||||
if (!block.Visible)
|
||||
{
|
||||
block.Bounds = Rectangle.Empty;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (BeforeNewBlockLayout != null)
|
||||
{
|
||||
LayoutManagerLayoutEventArgs e = new
|
||||
LayoutManagerLayoutEventArgs(block, position, visibleIndex);
|
||||
|
||||
BeforeNewBlockLayout(this, e);
|
||||
|
||||
position = e.CurrentPosition;
|
||||
|
||||
if (e.CancelLayout)
|
||||
continue;
|
||||
}
|
||||
visibleIndex++;
|
||||
|
||||
Size availableSize = containerBounds.Size;
|
||||
bool isBlockElement = false;
|
||||
bool isNewLineTriggger = false;
|
||||
bool canStartOnNewLine;
|
||||
|
||||
if (block is IBlockExtended)
|
||||
{
|
||||
IBlockExtended ex = block as IBlockExtended;
|
||||
|
||||
isBlockElement = ex.IsBlockElement;
|
||||
isNewLineTriggger = ex.IsNewLineAfterElement;
|
||||
canStartOnNewLine = ex.CanStartNewLine;
|
||||
}
|
||||
else
|
||||
canStartOnNewLine = true;
|
||||
|
||||
if (!isBlockElement)
|
||||
{
|
||||
if (_ContentOrientation == eContentOrientation.Horizontal)
|
||||
availableSize.Width = (containerBounds.Right - position.X);
|
||||
else
|
||||
availableSize.Height = (containerBounds.Bottom - position.Y);
|
||||
}
|
||||
|
||||
// Resize the content block
|
||||
|
||||
blockLayout.Layout(block, availableSize);
|
||||
|
||||
if (_MultiLine && currentLine.Blocks.Count > 0)
|
||||
{
|
||||
if (_ContentOrientation == eContentOrientation.Horizontal &&
|
||||
position.X + block.Bounds.Width > containerBounds.Right && canStartOnNewLine || isBlockElement ||
|
||||
switchToNewLine)
|
||||
{
|
||||
position.X = containerBounds.X;
|
||||
position.Y += (currentLine.LineSize.Height + _BlockSpacing);
|
||||
|
||||
currentLine = new BlockLineInfo();
|
||||
|
||||
currentLine.Line = lines.Count;
|
||||
|
||||
lines.Add(currentLine);
|
||||
}
|
||||
else if (_ContentOrientation == eContentOrientation.Vertical &&
|
||||
position.Y + block.Bounds.Height > containerBounds.Bottom && canStartOnNewLine || isBlockElement ||
|
||||
switchToNewLine)
|
||||
{
|
||||
position.Y = containerBounds.Y;
|
||||
position.X += (currentLine.LineSize.Width + _BlockSpacing);
|
||||
|
||||
currentLine = new BlockLineInfo();
|
||||
|
||||
currentLine.Line = lines.Count;
|
||||
|
||||
lines.Add(currentLine);
|
||||
}
|
||||
}
|
||||
|
||||
if (_ContentOrientation == eContentOrientation.Horizontal)
|
||||
{
|
||||
if (block.Bounds.Height > currentLine.LineSize.Height)
|
||||
currentLine.LineSize.Height = block.Bounds.Height;
|
||||
|
||||
currentLine.LineSize.Width = position.X + block.Bounds.Width - containerBounds.X;
|
||||
}
|
||||
else if (_ContentOrientation == eContentOrientation.Vertical)
|
||||
{
|
||||
if (block.Bounds.Width > currentLine.LineSize.Width)
|
||||
currentLine.LineSize.Width = block.Bounds.Width;
|
||||
|
||||
currentLine.LineSize.Height = position.Y + block.Bounds.Height - containerBounds.Y;
|
||||
}
|
||||
|
||||
currentLine.Blocks.Add(block);
|
||||
|
||||
if (block.Visible)
|
||||
currentLine.VisibleItemsCount++;
|
||||
|
||||
block.Bounds = new Rectangle(position, block.Bounds.Size);
|
||||
|
||||
if (blocksBounds.IsEmpty)
|
||||
blocksBounds = block.Bounds;
|
||||
else
|
||||
blocksBounds = Rectangle.Union(blocksBounds, block.Bounds);
|
||||
|
||||
switchToNewLine = isBlockElement | isNewLineTriggger;
|
||||
|
||||
position = GetNextPosition(block, position);
|
||||
}
|
||||
|
||||
blocksBounds = AlignResizeBlocks(containerBounds, blocksBounds, lines);
|
||||
|
||||
if (_RightToLeft)
|
||||
blocksBounds = MirrorContent(containerBounds, blocksBounds, contentBlocks);
|
||||
|
||||
blocksBounds = blockLayout.FinalizeLayout(containerBounds, blocksBounds, lines);
|
||||
|
||||
return blocksBounds;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internals
|
||||
|
||||
private struct SizeExtended
|
||||
{
|
||||
public int Width;
|
||||
public int Height;
|
||||
public float WidthReduction;
|
||||
public float HeightReduction;
|
||||
public bool UseAbsoluteWidth;
|
||||
}
|
||||
|
||||
private Rectangle AlignResizeBlocks(Rectangle containerBounds,Rectangle blocksBounds,ArrayList lines)
|
||||
{
|
||||
Rectangle newBounds=Rectangle.Empty;
|
||||
|
||||
if(containerBounds.IsEmpty || blocksBounds.IsEmpty || ((BlockLineInfo)lines[0]).Blocks.Count==0)
|
||||
return newBounds;
|
||||
|
||||
if (_ContentAlignment == eContentAlignment.Left && _ContentVerticalAlignment == eContentVerticalAlignment.Top &&
|
||||
!_FitContainer && !_FitContainerOversize && !_EvenHeight && _BlockLineAlignment == eContentVerticalAlignment.Top)
|
||||
return blocksBounds;
|
||||
|
||||
Point[] offset=new Point[lines.Count];
|
||||
SizeExtended[] sizeOffset = new SizeExtended[lines.Count];
|
||||
foreach(BlockLineInfo lineInfo in lines)
|
||||
{
|
||||
if (_ContentOrientation == eContentOrientation.Horizontal)
|
||||
{
|
||||
if (_FitContainer && containerBounds.Width > lineInfo.LineSize.Width ||
|
||||
_FitContainerOversize && lineInfo.LineSize.Width > containerBounds.Width)
|
||||
{
|
||||
if (_OversizeDistribute && containerBounds.Width < lineInfo.LineSize.Width * .75)
|
||||
{
|
||||
sizeOffset[lineInfo.Line].Width = (int)Math.Floor((float)(containerBounds.Width - lineInfo.VisibleItemsCount * _BlockSpacing) / (float)lineInfo.VisibleItemsCount);
|
||||
sizeOffset[lineInfo.Line].UseAbsoluteWidth = true;
|
||||
}
|
||||
else
|
||||
sizeOffset[lineInfo.Line].Width = ((containerBounds.Width - lineInfo.VisibleItemsCount * _BlockSpacing) - lineInfo.LineSize.Width) / lineInfo.VisibleItemsCount;
|
||||
sizeOffset[lineInfo.Line].WidthReduction = (float)(containerBounds.Width - lineInfo.VisibleItemsCount * _BlockSpacing) / (float)lineInfo.LineSize.Width;
|
||||
blocksBounds.Width = containerBounds.Width;
|
||||
}
|
||||
|
||||
if (_HorizontalFitContainerHeight && containerBounds.Height > blocksBounds.Height)
|
||||
sizeOffset[lineInfo.Line].Height = (containerBounds.Height - lineInfo.LineSize.Height) / lines.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_FitContainer && containerBounds.Height > lineInfo.LineSize.Height ||
|
||||
_FitContainerOversize && lineInfo.LineSize.Height > containerBounds.Height)
|
||||
{
|
||||
if (_OversizeDistribute && containerBounds.Width < lineInfo.LineSize.Width*.75)
|
||||
{
|
||||
sizeOffset[lineInfo.Line].Height = (int)
|
||||
Math.Floor((float) (containerBounds.Height - lineInfo.VisibleItemsCount*_BlockSpacing)/
|
||||
(float) lineInfo.VisibleItemsCount);
|
||||
|
||||
sizeOffset[lineInfo.Line].UseAbsoluteWidth = true;
|
||||
}
|
||||
else
|
||||
sizeOffset[lineInfo.Line].Height = ((containerBounds.Height -
|
||||
lineInfo.VisibleItemsCount*_BlockSpacing) -
|
||||
lineInfo.LineSize.Height)/lineInfo.VisibleItemsCount;
|
||||
sizeOffset[lineInfo.Line].HeightReduction =
|
||||
(float) (containerBounds.Height - lineInfo.VisibleItemsCount*_BlockSpacing)/
|
||||
(float) lineInfo.LineSize.Height;
|
||||
blocksBounds.Height = containerBounds.Height;
|
||||
}
|
||||
|
||||
if (_VerticalFitContainerWidth && containerBounds.Width > blocksBounds.Width)
|
||||
sizeOffset[lineInfo.Line].Width = (containerBounds.Width - lineInfo.LineSize.Width)/lines.Count;
|
||||
}
|
||||
|
||||
|
||||
if (_ContentOrientation == eContentOrientation.Horizontal && !_FitContainer)
|
||||
{
|
||||
if (containerBounds.Width > blocksBounds.Width && _FitContainerOversize || !_FitContainerOversize)
|
||||
{
|
||||
switch (_ContentAlignment)
|
||||
{
|
||||
case eContentAlignment.Right:
|
||||
if (containerBounds.Width > lineInfo.LineSize.Width)
|
||||
offset[lineInfo.Line].X = containerBounds.Width - lineInfo.LineSize.Width;
|
||||
break;
|
||||
|
||||
case eContentAlignment.Center:
|
||||
if (containerBounds.Width > lineInfo.LineSize.Width)
|
||||
offset[lineInfo.Line].X = (containerBounds.Width - lineInfo.LineSize.Width)/2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_ContentOrientation == eContentOrientation.Vertical && !_FitContainer)
|
||||
{
|
||||
if (containerBounds.Height > blocksBounds.Height && _FitContainerOversize || !_FitContainerOversize)
|
||||
{
|
||||
switch (_ContentVerticalAlignment)
|
||||
{
|
||||
case eContentVerticalAlignment.Bottom:
|
||||
if (containerBounds.Height > lineInfo.LineSize.Height)
|
||||
offset[lineInfo.Line].Y = containerBounds.Height - lineInfo.LineSize.Height;
|
||||
break;
|
||||
|
||||
case eContentVerticalAlignment.Middle:
|
||||
if (containerBounds.Height > lineInfo.LineSize.Height)
|
||||
offset[lineInfo.Line].Y = (containerBounds.Height - lineInfo.LineSize.Height)/2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_VerticalFitContainerWidth && containerBounds.Width > blocksBounds.Width && _ContentOrientation==eContentOrientation.Vertical)
|
||||
blocksBounds.Width = containerBounds.Width;
|
||||
|
||||
else if(_HorizontalFitContainerHeight && containerBounds.Height>blocksBounds.Height && _ContentOrientation==eContentOrientation.Horizontal)
|
||||
blocksBounds.Height = containerBounds.Height;
|
||||
|
||||
if(_ContentOrientation==eContentOrientation.Horizontal)
|
||||
{
|
||||
foreach(BlockLineInfo lineInfo in lines)
|
||||
{
|
||||
foreach (IBlock block in lineInfo.Blocks)
|
||||
{
|
||||
if (!block.Visible)
|
||||
continue;
|
||||
|
||||
Rectangle r = block.Bounds;
|
||||
|
||||
if (_EvenHeight && lineInfo.LineSize.Height > 0)
|
||||
r.Height = lineInfo.LineSize.Height;
|
||||
|
||||
r.Offset(offset[lineInfo.Line]);
|
||||
|
||||
if (_ContentVerticalAlignment == eContentVerticalAlignment.Middle)
|
||||
{
|
||||
// Takes care of offset rounding error when both content is vertically centered and blocks in line are centered
|
||||
|
||||
if (_BlockLineAlignment == eContentVerticalAlignment.Middle)
|
||||
r.Offset(0,
|
||||
((containerBounds.Height - blocksBounds.Height) +
|
||||
(lineInfo.LineSize.Height - r.Height))/2);
|
||||
else
|
||||
r.Offset(0, (containerBounds.Height - blocksBounds.Height)/2);
|
||||
|
||||
// Line alignment of the block
|
||||
|
||||
if (_BlockLineAlignment == eContentVerticalAlignment.Bottom)
|
||||
r.Offset(0, lineInfo.LineSize.Height - r.Height);
|
||||
}
|
||||
else if (_ContentVerticalAlignment == eContentVerticalAlignment.Bottom)
|
||||
r.Offset(0, containerBounds.Height - blocksBounds.Height);
|
||||
|
||||
// To avoid rounding offset errors when dividing this is split see upper part
|
||||
|
||||
if (_ContentVerticalAlignment != eContentVerticalAlignment.Middle)
|
||||
{
|
||||
// Line alignment of the block
|
||||
|
||||
if (_BlockLineAlignment == eContentVerticalAlignment.Middle)
|
||||
r.Offset(0, (lineInfo.LineSize.Height - r.Height)/2);
|
||||
|
||||
else if (_BlockLineAlignment == eContentVerticalAlignment.Bottom)
|
||||
r.Offset(0, lineInfo.LineSize.Height - r.Height);
|
||||
}
|
||||
|
||||
if (sizeOffset[lineInfo.Line].Width != 0)
|
||||
{
|
||||
if (_OversizeDistribute)
|
||||
{
|
||||
int nw = sizeOffset[lineInfo.Line].UseAbsoluteWidth
|
||||
? sizeOffset[lineInfo.Line].Width
|
||||
: (int) Math.Floor(r.Width*sizeOffset[lineInfo.Line].WidthReduction);
|
||||
|
||||
offset[lineInfo.Line].X += nw - r.Width;
|
||||
|
||||
r.Width = nw;
|
||||
}
|
||||
else
|
||||
{
|
||||
r.Width += sizeOffset[lineInfo.Line].Width;
|
||||
offset[lineInfo.Line].X += sizeOffset[lineInfo.Line].Width;
|
||||
}
|
||||
}
|
||||
|
||||
r.Height += sizeOffset[lineInfo.Line].Height;
|
||||
|
||||
block.Bounds = r;
|
||||
|
||||
if (newBounds.IsEmpty)
|
||||
newBounds = block.Bounds;
|
||||
else
|
||||
newBounds = Rectangle.Union(newBounds, block.Bounds);
|
||||
}
|
||||
|
||||
// Adjust for left-over size adjustment for odd difference
|
||||
// between container width and the total block width
|
||||
|
||||
if (!_OversizeDistribute && sizeOffset[lineInfo.Line].Width != 0 &&
|
||||
containerBounds.Width - (lineInfo.LineSize.Width + sizeOffset[lineInfo.Line].Width * lineInfo.Blocks.Count) != 0)
|
||||
{
|
||||
Rectangle r = ((IBlock) lineInfo.Blocks[lineInfo.Blocks.Count - 1]).Bounds;
|
||||
|
||||
r.Width += containerBounds.Width -
|
||||
(lineInfo.LineSize.Width + sizeOffset[lineInfo.Line].Width*lineInfo.Blocks.Count);
|
||||
|
||||
((IBlock) lineInfo.Blocks[lineInfo.Blocks.Count - 1]).Bounds = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(BlockLineInfo lineInfo in lines)
|
||||
{
|
||||
foreach(IBlock block in lineInfo.Blocks)
|
||||
{
|
||||
if(!block.Visible)
|
||||
continue;
|
||||
|
||||
Rectangle r=block.Bounds;
|
||||
|
||||
if(_EvenHeight && lineInfo.LineSize.Width>0)
|
||||
r.Width=lineInfo.LineSize.Width;
|
||||
|
||||
r.Offset(offset[lineInfo.Line]);
|
||||
|
||||
if(_ContentAlignment==eContentAlignment.Center)
|
||||
r.Offset(((containerBounds.Width-blocksBounds.Width)+(lineInfo.LineSize.Width-r.Width))/2,0); //r.Offset((containerBounds.Width-blocksBounds.Width)/2+(lineInfo.LineSize.Width-r.Width)/2,0);
|
||||
else if(_ContentAlignment==eContentAlignment.Right)
|
||||
|
||||
r.Offset((containerBounds.Width-blocksBounds.Width)+lineInfo.LineSize.Width-r.Width,0);
|
||||
r.Width+=sizeOffset[lineInfo.Line].Width;
|
||||
|
||||
if(sizeOffset[lineInfo.Line].Height!=0)
|
||||
{
|
||||
if (_OversizeDistribute)
|
||||
{
|
||||
int nw = sizeOffset[lineInfo.Line].UseAbsoluteWidth
|
||||
? sizeOffset[lineInfo.Line].Height : (int)Math.Floor(r.Height * sizeOffset[lineInfo.Line].HeightReduction);
|
||||
|
||||
offset[lineInfo.Line].Y += nw - r.Height;
|
||||
r.Height = nw;
|
||||
}
|
||||
else
|
||||
{
|
||||
r.Height += sizeOffset[lineInfo.Line].Height;
|
||||
offset[lineInfo.Line].Y += sizeOffset[lineInfo.Line].Height;
|
||||
}
|
||||
}
|
||||
|
||||
block.Bounds=r;
|
||||
|
||||
if(newBounds.IsEmpty)
|
||||
newBounds=block.Bounds;
|
||||
else
|
||||
newBounds=Rectangle.Union(newBounds,block.Bounds);
|
||||
}
|
||||
|
||||
if (!_OversizeDistribute && sizeOffset[lineInfo.Line].Height != 0 && containerBounds.Height - (lineInfo.LineSize.Height + sizeOffset[lineInfo.Line].Height * lineInfo.Blocks.Count) != 0)
|
||||
{
|
||||
Rectangle r=((IBlock)lineInfo.Blocks[lineInfo.Blocks.Count-1]).Bounds;
|
||||
r.Height+=containerBounds.Height-(lineInfo.LineSize.Height+sizeOffset[lineInfo.Line].Height*lineInfo.Blocks.Count);
|
||||
((IBlock)lineInfo.Blocks[lineInfo.Blocks.Count-1]).Bounds=r;
|
||||
}
|
||||
}
|
||||
}
|
||||
return newBounds;
|
||||
}
|
||||
|
||||
private Point GetNextPosition(IBlock block, Point position)
|
||||
{
|
||||
if (NextPosition != null)
|
||||
{
|
||||
LayoutManagerPositionEventArgs e = new LayoutManagerPositionEventArgs();
|
||||
|
||||
e.Block = block;
|
||||
e.CurrentPosition = position;
|
||||
|
||||
NextPosition(this, e);
|
||||
|
||||
if (e.Cancel)
|
||||
return e.NextPosition;
|
||||
}
|
||||
|
||||
if(_ContentOrientation==eContentOrientation.Horizontal)
|
||||
position.X+=block.Bounds.Width+_BlockSpacing;
|
||||
else
|
||||
position.Y+=block.Bounds.Height+_BlockSpacing;
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
internal class BlockLineInfo
|
||||
{
|
||||
public ArrayList Blocks=new ArrayList();
|
||||
public Size LineSize = Size.Empty;
|
||||
public int Line;
|
||||
public int VisibleItemsCount;
|
||||
}
|
||||
|
||||
private Rectangle MirrorContent(Rectangle containerBounds, Rectangle blockBounds, IBlock[] contentBlocks)
|
||||
{
|
||||
if (blockBounds.Width < containerBounds.Width)
|
||||
blockBounds.X = containerBounds.Right - ((blockBounds.X - containerBounds.X) + blockBounds.Width);
|
||||
|
||||
else if (blockBounds.Width > containerBounds.Width)
|
||||
containerBounds.Width = blockBounds.Width;
|
||||
|
||||
foreach (IBlock block in contentBlocks)
|
||||
{
|
||||
if (!block.Visible)
|
||||
continue;
|
||||
|
||||
Rectangle r = block.Bounds;
|
||||
|
||||
block.Bounds = new Rectangle(containerBounds.Right -
|
||||
((r.X - containerBounds.X) + r.Width), r.Y, r.Width, r.Height);
|
||||
}
|
||||
|
||||
return blockBounds;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Gets or sets the spacing in pixels between content blocks. Default value is 0.
|
||||
/// </summary>
|
||||
public virtual int BlockSpacing
|
||||
{
|
||||
get {return _BlockSpacing;}
|
||||
set {_BlockSpacing=value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether content blocks are forced to fit the container bounds if they
|
||||
/// occupy more space than it is available by container. Default value is false.
|
||||
/// </summary>
|
||||
public virtual bool FitContainerOversize
|
||||
{
|
||||
get {return _FitContainerOversize;}
|
||||
set {_FitContainerOversize=value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether content blocks are resized to fit the container bound if they
|
||||
/// occupy less space than it is available by container. Default value is false.
|
||||
/// </summary>
|
||||
public virtual bool FitContainer
|
||||
{
|
||||
get {return _FitContainer;}
|
||||
set {_FitContainer=value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether content blocks are resized (Width) to fit container bounds if they
|
||||
/// occupy less space than the actual container width. Applies to the Vertical orientation only. Default value is false.
|
||||
/// </summary>
|
||||
public virtual bool VerticalFitContainerWidth
|
||||
{
|
||||
get { return _VerticalFitContainerWidth; }
|
||||
set { _VerticalFitContainerWidth = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether content blocks are resized (Height) to fit container bounds if they
|
||||
/// occupy less space than the actual container height. Applies to the Horizontal orientation only. Default value is false.
|
||||
/// </summary>
|
||||
public virtual bool HorizontalFitContainerHeight
|
||||
{
|
||||
get { return _HorizontalFitContainerHeight; }
|
||||
set { _HorizontalFitContainerHeight = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the content orientation. Default value is Horizontal.
|
||||
/// </summary>
|
||||
public virtual eContentOrientation ContentOrientation
|
||||
{
|
||||
get {return _ContentOrientation;}
|
||||
set {_ContentOrientation=value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the content vertical alignment. Default value is Middle.
|
||||
/// </summary>
|
||||
public virtual eContentVerticalAlignment ContentVerticalAlignment
|
||||
{
|
||||
get {return _ContentVerticalAlignment;}
|
||||
set {_ContentVerticalAlignment=value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the block line vertical alignment. Default value is Middle.
|
||||
/// </summary>
|
||||
public virtual eContentVerticalAlignment BlockLineAlignment
|
||||
{
|
||||
get { return _BlockLineAlignment; }
|
||||
set { _BlockLineAlignment = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the content horizontal alignment. Default value is Left.
|
||||
/// </summary>
|
||||
public virtual eContentAlignment ContentAlignment
|
||||
{
|
||||
get {return _ContentAlignment;}
|
||||
set {_ContentAlignment=value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether all content blocks are resized so they have same height which is height of the tallest content block. Default value is false.
|
||||
/// </summary>
|
||||
public virtual bool EvenHeight
|
||||
{
|
||||
get {return _EvenHeight;}
|
||||
set {_EvenHeight=value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether oversized blocks are resized based on the percentage reduction instead of based on equal pixel distribution. Default value is false.
|
||||
/// </summary>
|
||||
public virtual bool OversizeDistribute
|
||||
{
|
||||
get { return _OversizeDistribute; }
|
||||
set { _OversizeDistribute = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether content is wrapped into new line if it exceeds the width of the container.
|
||||
/// </summary>
|
||||
public bool MultiLine
|
||||
{
|
||||
get {return _MultiLine;}
|
||||
set {_MultiLine=value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether layout is right-to-left.
|
||||
/// </summary>
|
||||
public bool RightToLeft
|
||||
{
|
||||
get { return _RightToLeft; }
|
||||
set { _RightToLeft = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents event arguments for SerialContentLayoutManager.NextPosition event.
|
||||
/// </summary>
|
||||
public class LayoutManagerPositionEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the block that is layed out.
|
||||
/// </summary>
|
||||
public IBlock Block;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current block position.
|
||||
/// </summary>
|
||||
public Point CurrentPosition = Point.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the calculated next block position.
|
||||
/// </summary>
|
||||
public Point NextPosition = Point.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Cancels default position calculation.
|
||||
/// </summary>
|
||||
public bool Cancel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents event arguments for the SerialContentLayoutManager layout events.
|
||||
/// </summary>
|
||||
public class LayoutManagerLayoutEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the reference block object.
|
||||
/// </summary>
|
||||
public IBlock Block;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the position block will assume.
|
||||
/// </summary>
|
||||
public Point CurrentPosition = Point.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Cancel the layout of the block, applies only to BeforeXXX layout event.
|
||||
/// </summary>
|
||||
public bool CancelLayout;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visibility index of the block.
|
||||
/// </summary>
|
||||
public int BlockVisibleIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the class and initializes it with default values.
|
||||
/// </summary>
|
||||
public LayoutManagerLayoutEventArgs(IBlock block, Point currentPosition, int visibleIndex)
|
||||
{
|
||||
this.Block = block;
|
||||
this.CurrentPosition = currentPosition;
|
||||
this.BlockVisibleIndex = visibleIndex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for SerialContentLayoutManager.NextPosition event.
|
||||
/// </summary>
|
||||
public delegate void LayoutManagerPositionEventHandler(object sender, LayoutManagerPositionEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for the SerialContentLayoutManager layout events.
|
||||
/// </summary>
|
||||
public delegate void LayoutManagerLayoutEventHandler(object sender, LayoutManagerLayoutEventArgs e);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides helpers when working with colors.
|
||||
/// </summary>
|
||||
internal static class ColorHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts hex string to Color type.
|
||||
/// </summary>
|
||||
/// <param name="rgbHex">Hexadecimal color representation.</param>
|
||||
/// <returns>Reference to Color object.</returns>
|
||||
public static Color GetColor(string rgbHex)
|
||||
{
|
||||
if (string.IsNullOrEmpty(rgbHex))
|
||||
return Color.Empty;
|
||||
|
||||
if (rgbHex.Length == 8)
|
||||
return Color.FromArgb(Convert.ToInt32(rgbHex.Substring(0, 2), 16),
|
||||
Convert.ToInt32(rgbHex.Substring(2, 2), 16),
|
||||
Convert.ToInt32(rgbHex.Substring(4, 2), 16),
|
||||
Convert.ToInt32(rgbHex.Substring(6, 2), 16));
|
||||
|
||||
return Color.FromArgb(Convert.ToInt32(rgbHex.Substring(0, 2), 16),
|
||||
Convert.ToInt32(rgbHex.Substring(2, 2), 16),
|
||||
Convert.ToInt32(rgbHex.Substring(4, 2), 16));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts hex string to Color type.
|
||||
/// </summary>
|
||||
/// <param name="rgb">Color representation as 32-bit RGB value.</param>
|
||||
/// <returns>Reference to Color object.</returns>
|
||||
public static Color GetColor(int rgb)
|
||||
{
|
||||
if (rgb == -1)
|
||||
return Color.Empty;
|
||||
|
||||
return Color.FromArgb((rgb & 0xFF0000) >> 16, (rgb & 0xFF00) >> 8, rgb & 0xFF);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts hex string to Color type.
|
||||
/// </summary>
|
||||
/// <param name="alpha">Alpha component for color.</param>
|
||||
/// <param name="rgb">Color representation as 32-bit RGB value.</param>
|
||||
/// <returns>Reference to Color object.</returns>
|
||||
public static Color GetColor(int alpha, int rgb)
|
||||
{
|
||||
if (rgb == -1)
|
||||
return Color.Empty;
|
||||
|
||||
return Color.FromArgb(alpha, (rgb & 0xFF0000) >> 16, (rgb & 0xFF00) >> 8, rgb & 0xFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// ConvertValue
|
||||
///</summary>
|
||||
static public class ConvertValue
|
||||
{
|
||||
///<summary>
|
||||
/// ConvertTo
|
||||
///</summary>
|
||||
///<param name="o"></param>
|
||||
///<param name="type"></param>
|
||||
///<returns></returns>
|
||||
static public object ConvertTo(object o, Type type)
|
||||
{
|
||||
if (o == null || o is DBNull)
|
||||
return (o);
|
||||
|
||||
if (o.GetType() == type)
|
||||
return (o);
|
||||
|
||||
if (type == typeof (decimal))
|
||||
return (Convert.ToDecimal(o));
|
||||
|
||||
if (type == typeof (double))
|
||||
return (Convert.ToDouble(o));
|
||||
|
||||
if (type == typeof (Int16))
|
||||
return (Convert.ToInt16(o));
|
||||
|
||||
if (type == typeof (Int32))
|
||||
return (Convert.ToInt32(o));
|
||||
|
||||
if (type == typeof (Int64))
|
||||
return (Convert.ToInt64(o));
|
||||
|
||||
if (type == typeof (Single))
|
||||
return (Convert.ToSingle(o));
|
||||
|
||||
if (type == typeof (UInt16))
|
||||
return (Convert.ToUInt16(o));
|
||||
|
||||
if (type == typeof (UInt32))
|
||||
return (Convert.ToUInt32(o));
|
||||
|
||||
if (type == typeof (UInt64))
|
||||
return (Convert.ToUInt64(o));
|
||||
|
||||
if (type == typeof(sbyte))
|
||||
return (Convert.ToSByte(o));
|
||||
|
||||
if (type == typeof(byte))
|
||||
return (Convert.ToByte(o));
|
||||
|
||||
if (type == typeof(bool))
|
||||
return (Convert.ToBoolean(o));
|
||||
|
||||
if (type == typeof(char))
|
||||
return (Convert.ToChar(o));
|
||||
|
||||
if (type == typeof(string))
|
||||
return (Convert.ToString(o));
|
||||
|
||||
if (type == typeof(DateTime))
|
||||
return (Convert.ToDateTime(o));
|
||||
|
||||
return (o);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
internal static class DragDrop
|
||||
{
|
||||
public static bool DragStarted(Point pt1, Point pt2)
|
||||
{
|
||||
Rectangle r = new Rectangle(pt1.X, pt1.Y, 0, 0);
|
||||
|
||||
r.Inflate(SystemInformation.DragSize.Width,
|
||||
SystemInformation.DragSize.Height);
|
||||
|
||||
return (r.Contains(pt2.X, pt2.Y) == false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides helpers when working with text.
|
||||
/// </summary>
|
||||
internal static class TextHelper
|
||||
{
|
||||
private static int _textMarkupCultureSpecific = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Get or sets the text-markup padding for text
|
||||
/// measurement when running on Japanese version of Windows.
|
||||
/// </summary>
|
||||
public static int TextMarkupCultureSpecificPadding
|
||||
{
|
||||
get { return _textMarkupCultureSpecific; }
|
||||
set { _textMarkupCultureSpecific = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MeasureText always adds about 1/2 em width of white space on the right,
|
||||
/// even when NoPadding is specified. It returns zero for an empty string.
|
||||
/// To get the precise string width, measure the width of a string containing a
|
||||
/// single period and subtract that from the width of our original string plus a period.
|
||||
/// </summary>
|
||||
public static Size MeasureText(Graphics g,
|
||||
string s, Font font, Size csize, eTextFormat tf)
|
||||
{
|
||||
return (TextDrawing.MeasureString(g, s, font, csize, tf));
|
||||
|
||||
if (font.Italic == true)
|
||||
return (TextDrawing.MeasureString(g, s, font, csize, tf));
|
||||
|
||||
Size sz1 = TextDrawing.MeasureString(g, ".", font, csize, tf);
|
||||
Size sz2 = TextDrawing.MeasureString(g, s + ".", font, csize, tf);
|
||||
|
||||
return (new Size(sz2.Width - sz1.Width, sz2.Height));
|
||||
}
|
||||
|
||||
public static Size MeasureText(Graphics g, string s, Font font)
|
||||
{
|
||||
return (TextDrawing.MeasureString(g, s, font));
|
||||
|
||||
if (font.Italic == true)
|
||||
return (TextDrawing.MeasureString(g, s, font));
|
||||
|
||||
Size sz1 = TextDrawing.MeasureString(g, ".", font);
|
||||
Size sz2 = TextDrawing.MeasureString(g, s + ".", font);
|
||||
|
||||
return (new Size(sz2.Width - sz1.Width, sz2.Height));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 743 B |
|
After Width: | Height: | Size: 492 B |
|
After Width: | Height: | Size: 529 B |
|
After Width: | Height: | Size: 708 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 568 B |
|
After Width: | Height: | Size: 592 B |
|
After Width: | Height: | Size: 748 B |
|
After Width: | Height: | Size: 817 B |
|
After Width: | Height: | Size: 1014 B |
|
After Width: | Height: | Size: 613 B |
|
After Width: | Height: | Size: 657 B |
|
After Width: | Height: | Size: 821 B |
|
After Width: | Height: | Size: 525 B |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SuperGrid
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
63
PROMS/DotNetBar Source Code/DevComponents.DotNetBar.SuperGrid/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.5448
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DevComponents.DotNetBar.SuperGrid.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
PROMS/DotNetBar Source Code/DevComponents.DotNetBar.SuperGrid/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.5448
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,392 @@
|
||||
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
|
||||
{\f36\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}
|
||||
{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0502040204020203}Segoe UI;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
|
||||
{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}
|
||||
{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f40\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f41\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\f43\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f44\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f45\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f46\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\f47\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f48\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f380\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f381\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}
|
||||
{\f383\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f384\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f387\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f388\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}
|
||||
{\f400\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\f401\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\f403\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\f404\fbidi \froman\fcharset162\fprq2 Cambria Tur;}
|
||||
{\f407\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\f408\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\f410\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f411\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}
|
||||
{\f413\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f414\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f417\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f418\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}
|
||||
{\f420\fbidi \fswiss\fcharset238\fprq2 Tahoma CE;}{\f421\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f423\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek;}{\f424\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;}
|
||||
{\f425\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f426\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f427\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f428\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}
|
||||
{\f429\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f430\fbidi \fswiss\fcharset238\fprq2 Segoe UI CE;}{\f431\fbidi \fswiss\fcharset204\fprq2 Segoe UI Cyr;}{\f433\fbidi \fswiss\fcharset161\fprq2 Segoe UI Greek;}
|
||||
{\f434\fbidi \fswiss\fcharset162\fprq2 Segoe UI Tur;}{\f436\fbidi \fswiss\fcharset178\fprq2 Segoe UI (Arabic);}{\f437\fbidi \fswiss\fcharset186\fprq2 Segoe UI Baltic;}{\f438\fbidi \fswiss\fcharset163\fprq2 Segoe UI (Vietnamese);}
|
||||
{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
|
||||
{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}
|
||||
{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}
|
||||
{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
|
||||
{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
|
||||
{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}
|
||||
{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}
|
||||
{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}
|
||||
{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;
|
||||
\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\caccentone\ctint255\cshade191\red54\green95\blue145;\caccentone\ctint255\cshade255\red79\green129\blue189;\red220\green20\blue60;
|
||||
\red165\green42\blue42;\red139\green0\blue0;}{\*\defchp \f31506\fs22 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa200\sl276\slmult1
|
||||
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{
|
||||
\s1\ql \li0\ri0\sb480\sl276\slmult1\keep\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs28\alang1025 \ltrch\fcs0
|
||||
\b\fs28\cf17\lang1033\langfe1033\loch\f31502\hich\af31502\dbch\af31501\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat \spriority9 \styrsid5309040 heading 1;}{\s2\ql \li0\ri0\sb200\sl276\slmult1
|
||||
\keep\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel1\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs26\alang1025 \ltrch\fcs0 \b\fs26\cf18\lang1033\langfe1033\loch\f31502\hich\af31502\dbch\af31501\cgrid\langnp1033\langfenp1033
|
||||
\sbasedon0 \snext0 \slink16 \sunhideused \sqformat \spriority9 \styrsid5577294 heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
|
||||
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
|
||||
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31506\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused Normal Table;}{\*\cs15 \additive
|
||||
\rtlch\fcs1 \ab\af0\afs28 \ltrch\fcs0 \b\fs28\cf17\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 \styrsid5309040 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\af0\afs26 \ltrch\fcs0
|
||||
\b\fs26\cf18\loch\f31502\hich\af31502\dbch\af31501 \sbasedon10 \slink2 \slocked \spriority9 \styrsid5577294 Heading 2 Char;}{\*\ts17\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10
|
||||
\trbrdrv\brdrs\brdrw10 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
|
||||
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon11 \snext17 \spriority59 \styrsid5309040
|
||||
Table Grid;}{\*\cs18 \additive \rtlch\fcs1 \ai\af0 \ltrch\fcs0 \i \sbasedon10 \sqformat \spriority20 \styrsid5309040 Emphasis;}}{\*\rsidtbl \rsid68473\rsid1339969\rsid1911172\rsid2585630\rsid2703695\rsid2703989\rsid5197621\rsid5309040\rsid5577294
|
||||
\rsid6763582\rsid7805558\rsid11556279\rsid12418639\rsid14490061\rsid14880401\rsid15015837\rsid15694138\rsid16671883}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info
|
||||
{\author Brianta}{\operator Brianta}{\creatim\yr2012\mo3\dy30\hr23\min33}{\revtim\yr2012\mo4\dy19\hr11\min37}{\version8}{\edmins170}{\nofpages3}{\nofwords360}{\nofchars2052}{\nofcharsws2408}{\vern49273}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/o
|
||||
ffice/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt630\margb1440\gutter0\ltrsect
|
||||
\deftab2160\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1
|
||||
\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin630\dghshow1\dgvshow1
|
||||
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
|
||||
\asianbrkrule\rsidroot2703695\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0
|
||||
{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sectrsid2585630\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2
|
||||
\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6
|
||||
\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang
|
||||
{\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\s1\ql \li0\ri0\sl276\slmult1\keep\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0\pararsid16671883 \rtlch\fcs1 \ab\af0\afs28\alang1025 \ltrch\fcs0
|
||||
\b\fs28\cf17\lang1033\langfe1033\loch\af31502\hich\af31502\dbch\af31501\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid2703695 \hich\af31502\dbch\af31501\loch\f31502 Operators:
|
||||
\par }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid16671883 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid5309040
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 + \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Add
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 - \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Subtract}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 *\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Multiply}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 / \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Divide}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 = \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Equal}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid14880401 !}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 = \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Not}{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\insrsid2703695 Equal}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5309040\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 < \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Less Than}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 <= \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Less}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 }{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Than}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid15694138 o}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid2703695\charrsid2703695 r}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Equal}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 > \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Greater Than}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 >=\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Gre}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 ater}{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\insrsid2703695 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Than}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid15694138 o}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 r}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Equal
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 (\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 L}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 eft Parenthesis}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 )\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 R}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 ight Parenthesis}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 &&\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Conditional}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 And}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 AND\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Conditional}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 And}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 ||\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Conditional}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Or}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 OR \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Conditional}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Or
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 &\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Logical}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 And}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 |\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Logical}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Or
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 ^\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 Logical}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Xor
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5309040 XOR\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid2703695 Logical}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294 Xor}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 %\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Mod}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5309040 ulus}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid2703695
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 <<\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695 S}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 hift Left}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 >>\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Shift Right
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138 [IS] }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid2703695\charrsid5309040 LIKE\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695 Like (matches only what is specified)}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 [IS] }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5309040 NOT\tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294 Negate}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138 [IS] }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5309040 BETWEEN}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294 \tab Between (range comparison)}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695\charrsid2703695
|
||||
\par }\pard \ltrpar\ql \li0\ri0\widctlpar\brdrb\brdrs\brdrw15\brsp20 \wrapdefault\faauto\rin0\lin0\itap0\pararsid16671883 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695
|
||||
\par }\pard\plain \ltrpar\s1\ql \li0\ri0\sb240\sl276\slmult1\keep\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0\pararsid16671883 \rtlch\fcs1 \ab\af0\afs28\alang1025 \ltrch\fcs0
|
||||
\b\fs28\cf17\lang1033\langfe1033\loch\af31502\hich\af31502\dbch\af31501\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid5577294 \hich\af31502\dbch\af31501\loch\f31502 Functions:
|
||||
\par }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid16671883 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 N}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ow}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid5309040 Today\rquote s DateTime}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 D}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ate}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid5309040 Date portion of DateTime}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 T}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 od}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid5309040 Time of day}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 TimeOfD}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ay}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 \tab }{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5309040 Time of day}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid15694138\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 D}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ow}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Day of Week}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 DayOfW}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 eek}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 \tab }{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5309040 Day of Week}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 D}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 oy}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Day of Year}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 DayOfY}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ear}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 \tab }{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5309040 Day of Year}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12418639 {\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639 FirstOfMonth}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639\charrsid5197621 \tab }{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid12418639 First of month}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid7805558 (DateTime)}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid12418639\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639 End}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639 OfMonth}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639\charrsid5197621 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid12418639 End}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid12418639 of month}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid7805558 (DateTime)}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid12418639
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid12418639\charrsid5577294
|
||||
\par }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid16671883 {\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 Y}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ear}{\rtlch\fcs1
|
||||
\ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid15694138 Year}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 Y}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ears}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Year}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 M}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 onth}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Month}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 M}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 onths}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Months}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 Ho}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ur}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Hour}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 H}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ours}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Hours}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 M}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 inute}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Minutes}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 M}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 inutes}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Minutess}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 S}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 econd}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Second}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 S}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 econds}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid15694138 Seconds}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 TotalY}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ears }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138 \tab }{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\insrsid15694138 Total Years}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 TotalD}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ays}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138 \tab }{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\insrsid15694138 Total Days}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 TotalH}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ours }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138 \tab }{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\insrsid15694138 Total Hours}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 TotalM}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 inutes}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138 \tab }{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\insrsid15694138 Total Minutes}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 TotalS}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 econds}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138 \tab }{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\insrsid15694138 Total Seconds}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 C}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 eiling}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid15694138 Smallest integral greater than or equal to the value}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 Floor\tab }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15694138 Largest integral greater than or equal to the value}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid15694138\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid15694138\charrsid5197621 Round}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15694138 Rounds to a specified number of digits}{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\insrsid15694138\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid15694138 \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 L}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ength}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid6763582 Length of string}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 Ri}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ght}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid6763582 Right part of a string with the specified number of characters}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 L}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 eft}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid6763582 Left part of a string with the specified number of characters}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 S}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ubstring}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid6763582 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid6763582 Part of a string with the specified number of characters}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294
|
||||
\par }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12418639 {\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639 IndexOf}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid12418639 Gets the first occurrence of the specified string}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid12418639
|
||||
\par }\pard \ltrpar\qc \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid12418639 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid16671883 {\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 T}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 ostring}{
|
||||
\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid6763582 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6763582 String representation of the specified value}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 T}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 olower}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid6763582 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid6763582 Lowercase representation of the specified string}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 T}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 oupper}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid6763582 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid6763582 Uppercase representation of the specified string}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 T}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 rim}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid6763582 Leading }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15015837 and trailing whitespace removed}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 LT}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5577294\charrsid5197621 rim}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0
|
||||
\insrsid6763582 Leading }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15015837 whitespace removed}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid5577294\charrsid5577294
|
||||
\par }\pard \ltrpar\ql \li0\ri0\widctlpar\brdrb\brdrs\brdrw15\brsp20 \wrapdefault\faauto\rin0\lin0\itap0\pararsid16671883 {\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid5309040\charrsid5197621 RT}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0
|
||||
\cs18\i\insrsid5577294\charrsid5197621 rim}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid16671883 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid6763582 Tr}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15015837 ailing whitespace removed}{\rtlch\fcs1 \af0
|
||||
\ltrch\fcs0 \insrsid5577294
|
||||
\par }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid12418639
|
||||
\par }{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639\charrsid5197621 R}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639 aw}{\rtlch\fcs1 \ai\af0 \ltrch\fcs0 \cs18\i\insrsid12418639 \tab }{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid12418639
|
||||
Unevaluated string contents
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2585630
|
||||
\par }\pard\plain \ltrpar\s1\ql \li0\ri0\sb240\sl276\slmult1\keep\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0\pararsid16671883 \rtlch\fcs1 \ab\af0\afs28\alang1025 \ltrch\fcs0
|
||||
\b\fs28\cf17\lang1033\langfe1033\loch\af31502\hich\af31502\dbch\af31501\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid5577294 \hich\af31502\dbch\af31501\loch\f31502 Examples:
|
||||
\par }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid16671883 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid5577294
|
||||
\par }\pard \ltrpar\ql \li0\ri0\sl360\slmult1\widctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid16671883 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid6763582 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid6763582 LastName}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid6763582 >=}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf19\insrsid6763582 "T}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid1911172 olstoy}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid6763582 "}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 ) }{
|
||||
\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid6763582 OR}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 ((}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid6763582 Age}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid6763582 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid6763582 >}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 20) }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid6763582 AND}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid6763582 Age}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf2\insrsid6763582 <}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 45))}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid6763582
|
||||
\par (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid6763582 FirstName}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid6763582 LIKE}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid6763582 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid6763582 "Al"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 ) }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid6763582 AND}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid6763582 "Count"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf2\insrsid6763582 =}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 (30 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid6763582 /}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 }{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid6763582 Index}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid6763582 ))
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid2703989 ToString}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid2703989 HireDate}{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 ) }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid2703989 LIKE}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid2703989
|
||||
"6/15"
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid2703989 HireDate}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid2703989 = }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\insrsid2703695 #12/31/2010#}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703989 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703695
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid2703989 Date}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid2703989 HireDate}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid2703989 ) }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid2703989 =}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid2703989 Date}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid2703989 Now}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 ())
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid2703989 ToUpper}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid2703989 FirstName}{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 ) }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid2703989 =}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid1911172 "SMY}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid2703989 TH}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid1911172 E}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid2703989 "
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703989 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid2703989 Age}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0
|
||||
\f39\fs14\cf2\insrsid2703989 IS BETWEEN}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 20 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid2703989 AND}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 30) }{
|
||||
\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid2703989 AND}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid2703989 Age}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid2703989 !=}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 25)
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid2703989 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid2703989 LastName}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0
|
||||
\f39\fs14\cf2\insrsid2703989 IS}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid14490061 NOT }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid2703989 EMPTY}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 )}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid2703989 AND}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid2703989 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid2703989 Age}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid2703989 IS}{\rtlch\fcs1
|
||||
\af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid2703989 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid14490061 NOT}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0
|
||||
\f39\fs14\cf2\insrsid2703989 NULL}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 )
|
||||
\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid14490061 "Street"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid14490061 IS}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid14490061 }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid14490061 NOT LIKE}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid14490061 "Los"}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061
|
||||
\par }\pard \ltrpar\ql \li0\ri0\sa200\sl360\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid16671883 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid14490061 Right}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid14490061 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid14490061 LastName}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 ,3) }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 !=}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid14490061 "son"\line }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid14490061 (((}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf11\insrsid14490061 Age}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 %}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 10) }{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 =}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 0) }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid14490061 AND}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid14490061 ((}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid14490061 "Circ"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 /}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 25) }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 >}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 250)) }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0
|
||||
\f39\fs14\cf2\insrsid14490061 OR}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 ((}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid14490061 "Circ"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 }{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 <<}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 2) }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 >}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid14490061 100)\line }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\insrsid14490061 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid14490061 Length}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 (}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid14490061 LastName}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 ) }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 >}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid14490061 3) }{\rtlch\fcs1 \af39\afs14 \ltrch\fcs0 \f39\fs14\cf2\insrsid14490061 AND}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid14490061 Substring}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid14490061 LastName}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 ,2,1) }{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 =}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf19\insrsid14490061 "c"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 )
|
||||
\line }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid14490061 Year}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid14490061 HireDate}{\rtlch\fcs1 \af39\afs18
|
||||
\ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 ) }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 =}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 1996\line }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf20\insrsid14490061 Month}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf11\insrsid14490061 HireDate}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 ) }{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf2\insrsid14490061 =}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid14490061 Month}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0
|
||||
\f39\fs18\cf1\insrsid14490061 (}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf20\insrsid14490061 Now}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid14490061 ())}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid1911172 \line }{
|
||||
\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf21\insrsid11556279 IndexOf}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid11556279 (}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf21\insrsid11556279 Left}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0
|
||||
\f38\fs16\cf1\insrsid11556279 (}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf11\insrsid11556279 FirstName}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid11556279 , 1), }{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf19\insrsid11556279
|
||||
"AEIOUY"}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid11556279 ) }{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf2\insrsid11556279 >=}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid11556279 0}{\rtlch\fcs1 \af38\afs16
|
||||
\ltrch\fcs0 \f38\fs16\cf1\insrsid11556279 \line }{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf21\insrsid11556279 Left}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid11556279 (}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0
|
||||
\f38\fs16\cf21\insrsid11556279 Raw}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid11556279 (), 5) }{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf2\insrsid11556279 =}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid11556279 }{
|
||||
\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf19\insrsid11556279 "=sum("}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf19\insrsid7805558 \line }{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf21\insrsid7805558 Day}{\rtlch\fcs1 \af38\afs16
|
||||
\ltrch\fcs0 \f38\fs16\cf1\insrsid7805558 (}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf21\insrsid7805558 EndOfMonth}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid7805558 (}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0
|
||||
\f38\fs16\cf11\insrsid7805558 HireDate}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid7805558 )) }{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf2\insrsid7805558 =}{\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16\cf1\insrsid7805558 29}{
|
||||
\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \f39\fs18\cf1\insrsid1911172\charrsid14490061
|
||||
\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
|
||||
9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
|
||||
5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
|
||||
b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
|
||||
0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
|
||||
a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
|
||||
c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
|
||||
0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
|
||||
a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
|
||||
6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
|
||||
4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
|
||||
4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f
|
||||
7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
|
||||
615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
|
||||
79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
|
||||
5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
|
||||
999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
|
||||
699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
|
||||
8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
|
||||
0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
|
||||
9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
|
||||
15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
|
||||
3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
|
||||
32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
|
||||
f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
|
||||
e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90
|
||||
fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2
|
||||
ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae
|
||||
a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1
|
||||
399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5
|
||||
4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84
|
||||
0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b
|
||||
c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7
|
||||
689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20
|
||||
5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0
|
||||
aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d
|
||||
316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840
|
||||
545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a
|
||||
c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100
|
||||
0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7
|
||||
8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89
|
||||
d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500
|
||||
1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f
|
||||
bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6
|
||||
a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a
|
||||
0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021
|
||||
0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008
|
||||
00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000}
|
||||
{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
|
||||
617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
|
||||
6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
|
||||
656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
|
||||
{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;
|
||||
\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;
|
||||
\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7;
|
||||
\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000
|
||||
4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
|
||||
d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e50000000000000000000000008062
|
||||
b5795b1ecd01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000105000000000000}}
|
||||
@@ -0,0 +1,489 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{A344305F-D2E2-4350-B61E-D7277959A5B4}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DevComponents.DotNetBar.SuperGrid</RootNamespace>
|
||||
<AssemblyName>DevComponents.DotNetBar.SuperGrid</AssemblyName>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>SuperGrid.snk</AssemblyOriginatorKeyFile>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SUPERGRID</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Debug\DevComponents.DotNetBar.SuperGrid.XML</DocumentationFile>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SUPERGRID</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Release\DevComponents.DotNetBar.SuperGrid.XML</DocumentationFile>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseTrialSG|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>SUPERGRID;TRIAL</DefineConstants>
|
||||
<DocumentationFile>bin\Release\DevComponents.DotNetBar.SuperGrid.XML</DocumentationFile>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseTrial|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SUPERGRID;TRIAL</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<DocumentationFile>bin\Release\DevComponents.DotNetBar.SuperGrid.XML</DocumentationFile>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ContentManager\BlockLayoutManager.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ContentManager\Enums.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ContentManager\IBlock.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ContentManager\IBlockExtended.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ContentManager\IContentLayoutManager.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ContentManager\SerialContentLayoutManager.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Helpers\ColorHelpers.cs" />
|
||||
<Compile Include="Helpers\ConvertValue.cs" />
|
||||
<Compile Include="Helpers\DragDrop.cs" />
|
||||
<Compile Include="Helpers\TextHelpers.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SuperGrid\FloatWindow.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>FloatWindow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<EmbeddedResource Include="SampleExpr.rtf" />
|
||||
<None Include="SuperGrid.snk" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridColorPickerEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridComboTreeEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridRadialMenuEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridRatingStarEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridImageEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridComboBoxExEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridBubbleBarEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridTextBoxDropDownEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridMaskedTextBoxEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridIpAddressInputEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridLabelXEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridProgressBarXEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridCheckBoxEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridTrackBarEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridNumericUpDownEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridLabelEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridDateTimePickerEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridSwitchButtonEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridGaugeEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridButtonXEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridButtonEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridMicroChartEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\IGridCellEditControl.cs" />
|
||||
<Compile Include="SuperGrid\CellEditors\GridDateTimeInputEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridSliderEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridDoubleInputEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridIntegerInputEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridCheckBoxXEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\GridTextBoxXEditControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellEditors\EditorPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellInfoWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\CellInfoWindow.Designer.cs">
|
||||
<DependentUpon>CellInfoWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\Primitives\SymbolDef.cs" />
|
||||
<Compile Include="SuperGrid\SortableBindingList.cs" />
|
||||
<Compile Include="SuperGrid\DataBinder.cs" />
|
||||
<Compile Include="SuperGrid\EEval.cs" />
|
||||
<Compile Include="SuperGrid\FloatWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\FloatWindow.Designer.cs">
|
||||
<DependentUpon>FloatWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridCaption.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridColumn.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridColumnCollection.cs" />
|
||||
<Compile Include="SuperGrid\GridColumnGroupHeader.cs" />
|
||||
<Compile Include="SuperGrid\GridColumnHeader.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\CustomFilter.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\CustomFilter.Designer.cs">
|
||||
<DependentUpon>CustomFilter.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\CustomFilterEx.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\CustomFilterEx.Designer.cs">
|
||||
<DependentUpon>CustomFilterEx.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\DataFilter.cs" />
|
||||
<Compile Include="SuperGrid\GridFilter\FilterDateTimePicker.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\FilterDateTimePicker.Designer.cs">
|
||||
<DependentUpon>FilterDateTimePicker.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\FilterEval.cs" />
|
||||
<Compile Include="SuperGrid\GridFilter\FilterExprEdit.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\FilterExprEdit.Designer.cs">
|
||||
<DependentUpon>FilterExprEdit.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\FilterPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\FilterPopup.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\FilterScan.cs" />
|
||||
<Compile Include="SuperGrid\GridFilter\FilterUserData.cs" />
|
||||
<Compile Include="SuperGrid\GridFilter\GridFilter.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\PopupControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\Rtf.cs" />
|
||||
<Compile Include="SuperGrid\GridFilter\SampleExpr.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFilter\SampleExpr.Designer.cs">
|
||||
<DependentUpon>SampleExpr.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridFooter.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridGroupBy.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridHeader.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridMerge\CellRange.cs" />
|
||||
<Compile Include="SuperGrid\GridMerge\MergeScan.cs" />
|
||||
<Compile Include="SuperGrid\GridTextRow.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridTitle.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\Licensing.cs" />
|
||||
<Compile Include="SuperGrid\SelectedElementCollection.cs" />
|
||||
<Compile Include="SuperGrid\SelectedElements.cs" />
|
||||
<Compile Include="SuperGrid\Style\BackColorBlend.cs" />
|
||||
<Compile Include="SuperGrid\Style\BaseRowHeaderVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\BaseVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\BorderPattern.cs" />
|
||||
<Compile Include="SuperGrid\Style\ColumnHeaderRowStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\ColumnHeaderVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\FilterColumnHeaderVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\FilterRowVisualStyles.cs" />
|
||||
<Compile Include="SuperGrid\Style\GroupByVisualStyles.cs" />
|
||||
<Compile Include="SuperGrid\Style\GroupHeaderVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\GridPanelVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\RowHeaderVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\RowVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\TextRowVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\TreeButtonVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\VisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\VisualStyles.cs" />
|
||||
<Compile Include="SuperGrid\Style\DefaultVisualStyles.cs" />
|
||||
<Compile Include="SuperGrid\GridCell.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridCellCollection.cs" />
|
||||
<Compile Include="SuperGrid\GridContainer.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridGroup.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridLayoutInfo.cs" />
|
||||
<Compile Include="SuperGrid\GridPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridRenderInfo.cs" />
|
||||
<Compile Include="SuperGrid\GridRow.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridVirtualRowCollection.cs" />
|
||||
<Compile Include="SuperGrid\Primitives\CustomCollection.cs" />
|
||||
<Compile Include="SuperGrid\Style\Background.cs" />
|
||||
<Compile Include="SuperGrid\Style\BorderColor.cs" />
|
||||
<Compile Include="SuperGrid\CheckDisplay.cs" />
|
||||
<Compile Include="SuperGrid\ExpandDisplay.cs" />
|
||||
<Compile Include="SuperGrid\Style\Padding.cs" />
|
||||
<Compile Include="SuperGrid\Style\CellVisualStyle.cs" />
|
||||
<Compile Include="SuperGrid\Style\Thickness.cs" />
|
||||
<Compile Include="SuperGrid\SuperGridControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridElement.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SuperGrid\GridItemsCollection.cs" />
|
||||
<Compile Include="SuperGrid\TextDrawing.cs" />
|
||||
<Compile Include="SuperGrid\TreeDisplay.cs" />
|
||||
<Compile Include="TextMarkup\BodyElement.cs" />
|
||||
<Compile Include="TextMarkup\ContainerElement.cs" />
|
||||
<Compile Include="TextMarkup\Div.cs" />
|
||||
<Compile Include="TextMarkup\EndMarkupElement.cs" />
|
||||
<Compile Include="TextMarkup\ExpandElement.cs" />
|
||||
<Compile Include="TextMarkup\FontChangeElement.cs" />
|
||||
<Compile Include="TextMarkup\FontElement.cs" />
|
||||
<Compile Include="TextMarkup\Heading.cs" />
|
||||
<Compile Include="TextMarkup\HyperLink.cs" />
|
||||
<Compile Include="TextMarkup\IActiveMarkupElement.cs" />
|
||||
<Compile Include="TextMarkup\ImageElement.cs" />
|
||||
<Compile Include="TextMarkup\Italic.cs" />
|
||||
<Compile Include="TextMarkup\MarkupDrawContext.cs" />
|
||||
<Compile Include="TextMarkup\MarkupElement.cs" />
|
||||
<Compile Include="TextMarkup\MarkupElementCollection.cs" />
|
||||
<Compile Include="TextMarkup\MarkupLayoutManager.cs" />
|
||||
<Compile Include="TextMarkup\MarkupParser.cs" />
|
||||
<Compile Include="TextMarkup\MarkupSettings.cs" />
|
||||
<Compile Include="TextMarkup\NewLine.cs" />
|
||||
<Compile Include="TextMarkup\Paragraph.cs" />
|
||||
<Compile Include="TextMarkup\Span.cs" />
|
||||
<Compile Include="TextMarkup\Strike.cs" />
|
||||
<Compile Include="TextMarkup\Strong.cs" />
|
||||
<Compile Include="TextMarkup\TextElement.cs" />
|
||||
<Compile Include="TextMarkup\Underline.cs" />
|
||||
<Compile Include="VisualStyles\MetroStyleFactory.cs" />
|
||||
<Compile Include="VisualStyles\Office2010BlackStyleFactory.cs" />
|
||||
<Compile Include="VisualStyles\Office2010BlueStyleFactory.cs" />
|
||||
<Compile Include="VisualStyles\Office2010SilverStyleFactory.cs" />
|
||||
<Compile Include="VisualStyles\VisualStyleFactory.cs" />
|
||||
<Compile Include="VisualStyles\VisualStylesTable.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Pencil3.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="InsertRow.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="InfoImage.png" />
|
||||
<EmbeddedResource Include="SuperGrid\CellInfoWindow.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>CellInfoWindow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="SuperGridControl.png" />
|
||||
<EmbeddedResource Include="SuperGrid\GridFilter\CustomFilter.resx">
|
||||
<DependentUpon>CustomFilter.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SuperGrid\GridFilter\CustomFilterEx.resx">
|
||||
<DependentUpon>CustomFilterEx.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SuperGrid\GridFilter\FilterDateTimePicker.resx">
|
||||
<DependentUpon>FilterDateTimePicker.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SuperGrid\GridFilter\FilterExprEdit.resx">
|
||||
<DependentUpon>FilterExprEdit.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SuperGrid\GridFilter\SampleExpr.resx">
|
||||
<DependentUpon>SampleExpr.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DotNetBar.csproj">
|
||||
<Project>{36546CE3-335C-4AB6-A2F3-40F8C818BC66}</Project>
|
||||
<Name>DotNetBar</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\InstrumentationControls\DevComponents.Instrumentation.csproj">
|
||||
<Project>{3084E369-3D7B-4918-958F-2776DA03E6BC}</Project>
|
||||
<Name>DevComponents.Instrumentation</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="InfoImage16.png" />
|
||||
<EmbeddedResource Include="InfoImage20.png" />
|
||||
<EmbeddedResource Include="InfoImage24.png" />
|
||||
<EmbeddedResource Include="InfoImage32.png" />
|
||||
<EmbeddedResource Include="InsertRow16.png" />
|
||||
<EmbeddedResource Include="InsertRow20.png" />
|
||||
<EmbeddedResource Include="InsertRow24.png" />
|
||||
<EmbeddedResource Include="InsertRow32.png" />
|
||||
<EmbeddedResource Include="Pencil16.png" />
|
||||
<EmbeddedResource Include="Pencil20.png" />
|
||||
<EmbeddedResource Include="Pencil24.png" />
|
||||
<EmbeddedResource Include="Pencil32.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\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>
|
||||
@@ -0,0 +1,105 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// EditorPanel
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class EditorPanel : Control
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Size _SizeEx;
|
||||
private Point _OffsetEx;
|
||||
private GridCell _GridCell;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// Constructor
|
||||
///</summary>
|
||||
public EditorPanel()
|
||||
{
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region GridCell
|
||||
|
||||
///<summary>
|
||||
/// GridCell
|
||||
///</summary>
|
||||
public GridCell GridCell
|
||||
{
|
||||
get { return (_GridCell); }
|
||||
internal set { _GridCell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region OffsetEx
|
||||
|
||||
internal Point OffsetEx
|
||||
{
|
||||
get { return (_OffsetEx); }
|
||||
set { _OffsetEx = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SizeEx
|
||||
|
||||
internal Size SizeEx
|
||||
{
|
||||
get { return (_SizeEx); }
|
||||
set { _SizeEx = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaintBackground
|
||||
|
||||
/// <summary>
|
||||
/// Background painting
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
if (_GridCell != null && _GridCell.GridColumn != null)
|
||||
{
|
||||
Rectangle r = new Rectangle(_OffsetEx, _SizeEx);
|
||||
VisualStyle style = _GridCell.GetEffectiveStyle();
|
||||
|
||||
if (r.IsEmpty == false)
|
||||
{
|
||||
if (_GridCell.SuperGrid.DoPreRenderCellEvent(g, _GridCell, RenderParts.Background, r) == false)
|
||||
{
|
||||
using (Brush br = style.Background.GetBrush(r))
|
||||
g.FillRectangle(br, r);
|
||||
|
||||
_GridCell.SuperGrid.DoPostRenderCellEvent(g, _GridCell, RenderParts.Background, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnPaintBackground(e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,517 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridCheckBoxEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridBubbleBarEditControl : BubbleBar, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.Both;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridBubbleBarEditControl
|
||||
///</summary>
|
||||
public GridBubbleBarEditControl()
|
||||
{
|
||||
ShowTooltips = false;
|
||||
|
||||
ButtonClick += EditControlButtonClick;
|
||||
|
||||
#if !TRIAL
|
||||
LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
|
||||
#endif
|
||||
}
|
||||
|
||||
#region Hidden properties
|
||||
|
||||
///<summary>
|
||||
/// ShowTooltips
|
||||
///</summary>
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new bool ShowTooltips
|
||||
{
|
||||
get { return (base.ShowTooltips); }
|
||||
set { base.ShowTooltips = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditControlButtonClick
|
||||
|
||||
private void EditControlButtonClick(object sender, ClickEventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
{
|
||||
if (_Cell != null)
|
||||
{
|
||||
_Cell.Value = SelectedTab.Buttons.IndexOf((BubbleButton) sender);
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
_Cell.EndEdit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaint
|
||||
|
||||
/// <summary>
|
||||
/// OnPaint
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
|
||||
PaintControl(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public virtual bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get { return (Text); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorPanel != null)
|
||||
_EditorPanel.VisibleChanged -= EditorPanelVisibleChanged;
|
||||
|
||||
_EditorPanel = value;
|
||||
|
||||
if (_EditorPanel != null)
|
||||
_EditorPanel.VisibleChanged += EditorPanelVisibleChanged;
|
||||
}
|
||||
}
|
||||
|
||||
void EditorPanelVisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_EditorPanel.Visible == false)
|
||||
StopBubbleEffect();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (_Cell.Value); }
|
||||
set { }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public virtual bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.None); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
if (constraintSize.Height == 0)
|
||||
size.Height = Dpi.Height50;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns>false</returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns>false</returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
Focus();
|
||||
|
||||
switch (e.KeyData)
|
||||
{
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,501 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridButtonXEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridButtonEditControl : Button, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
private bool _UseCellValueAsButtonText = true;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.Both;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridButtonEditControl
|
||||
///</summary>
|
||||
public GridButtonEditControl()
|
||||
{
|
||||
AccessibleRole = AccessibleRole.PushButton;
|
||||
|
||||
Click += ButtonClick;
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region UseCellValueAsButtonText
|
||||
|
||||
///<summary>
|
||||
/// UseCellValueAsButtonText
|
||||
///</summary>
|
||||
public bool UseCellValueAsButtonText
|
||||
{
|
||||
get { return (_UseCellValueAsButtonText); }
|
||||
set { _UseCellValueAsButtonText = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ButtonClick
|
||||
|
||||
private void ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
EditorValueChanged = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual string GetValue(object value)
|
||||
{
|
||||
if (_UseCellValueAsButtonText == false)
|
||||
return (Text);
|
||||
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (_Cell.NullString);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (value.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get { return (Text); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Text); }
|
||||
set { Text = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public virtual bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Text = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
if (constraintSize.Height == 0)
|
||||
size.Height = Dpi.Height23;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
OnKeyDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
|
||||
if (Bounds.Contains(e.Location) == true)
|
||||
OnClick(EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,610 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridButtonXEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridButtonXEditControl : ButtonX, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
private bool _UseCellValueAsButtonText = true;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.Both;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridButtXEditControl
|
||||
///</summary>
|
||||
public GridButtonXEditControl()
|
||||
{
|
||||
AutoCheckOnClick = false;
|
||||
AutoExpandOnClick = false;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
|
||||
ColorTable = eButtonColor.OrangeWithBackground;
|
||||
Style = eDotNetBarStyle.StyleManagerControlled;
|
||||
|
||||
Click += ButtonXClick;
|
||||
ButtonItem.ExpandChange += ButtonXExpandChanged;
|
||||
}
|
||||
|
||||
#region Hidden properties
|
||||
|
||||
///<summary>
|
||||
/// AutoCheckOnClick
|
||||
///</summary>
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new bool AutoCheckOnClick
|
||||
{
|
||||
get { return (base.AutoCheckOnClick); }
|
||||
set { base.AutoCheckOnClick = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region FocusCuesEnabled
|
||||
|
||||
/// <summary>
|
||||
/// FocusCuesEnabled
|
||||
/// </summary>
|
||||
public override bool FocusCuesEnabled
|
||||
{
|
||||
get { return (false); }
|
||||
set { base.FocusCuesEnabled = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UseCellValueAsButtonText
|
||||
|
||||
///<summary>
|
||||
/// UseCellValueAsButtonText
|
||||
///</summary>
|
||||
public bool UseCellValueAsButtonText
|
||||
{
|
||||
get { return (_UseCellValueAsButtonText); }
|
||||
set { _UseCellValueAsButtonText = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ButtonXExpandChanged
|
||||
|
||||
private void ButtonXExpandChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Expanded == false)
|
||||
{
|
||||
_Cell.SuperGrid.PostInternalMouseMove();
|
||||
_Cell.SuperGrid.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ButtonXClick
|
||||
|
||||
private void ButtonXClick(object sender, EventArgs e)
|
||||
{
|
||||
EditorValueChanged = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual string GetValue(object value)
|
||||
{
|
||||
if (_UseCellValueAsButtonText == false)
|
||||
return (Text);
|
||||
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (_Cell.NullString);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (value.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (Expanded == false && IsMouseDown == false); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.NonModal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get { return (Text); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Text); }
|
||||
set { Text = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public virtual bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Text = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
// Perform a little kludge work here, since getting the base.PreferredSize
|
||||
// on a button with empty text seems to add height to the size of the
|
||||
// button each time it is called.
|
||||
|
||||
string oldText = Text;
|
||||
|
||||
if (string.IsNullOrEmpty(Text))
|
||||
Text = " ";
|
||||
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
if (constraintSize.Width > 0)
|
||||
{
|
||||
ButtonItem.RecalcSize();
|
||||
|
||||
if (String.IsNullOrEmpty(ButtonItem.Text) == false)
|
||||
{
|
||||
size = ButtonItem.TextDrawRect.Size;
|
||||
size.Height += Dpi.Height8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size.Width += Dpi.Width1;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(oldText))
|
||||
Text = oldText;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
Expanded = false;
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
Expanded = false;
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
OnKeyDown(e);
|
||||
OnKeyUp(e);
|
||||
|
||||
Checked = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
Point pt = _Cell.SuperGrid.PointToClient(MousePosition);
|
||||
|
||||
if (_Cell.Bounds.Contains(pt) == false)
|
||||
StopFade();
|
||||
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
if (_Cell != null)
|
||||
{
|
||||
Point pt = _Cell.SuperGrid.PointToClient(MousePosition);
|
||||
|
||||
if (_Cell.Bounds.Contains(pt) == false)
|
||||
StopFade();
|
||||
|
||||
OnMouseLeave(e);
|
||||
|
||||
_Cell.GridRow.EditorDirty = false;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
Click -= ButtonXClick;
|
||||
ButtonItem.ExpandChange -= ButtonXExpandChanged;
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,612 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridCheckBoxEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridCheckBoxEditControl : CheckBox, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private object _CheckValueChecked;
|
||||
private object _CheckValueUnchecked;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridCheckBoxEditControl
|
||||
///</summary>
|
||||
public GridCheckBoxEditControl()
|
||||
{
|
||||
BackColor = Color.Transparent;
|
||||
|
||||
CheckedChanged += ControlCheckedChanged;
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CheckValueChecked
|
||||
|
||||
///<summary>
|
||||
/// CheckValueChecked
|
||||
///</summary>
|
||||
public object CheckValueChecked
|
||||
{
|
||||
get { return (_CheckValueChecked); }
|
||||
set { _CheckValueChecked = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CheckValueUnchecked
|
||||
|
||||
///<summary>
|
||||
/// CheckValueUnchecked
|
||||
///</summary>
|
||||
public object CheckValueUnchecked
|
||||
{
|
||||
get { return (_CheckValueUnchecked); }
|
||||
set { _CheckValueUnchecked = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ControlCheckedChanged
|
||||
|
||||
private void ControlCheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
{
|
||||
if (Checked == true)
|
||||
_Cell.Value = _CheckValueChecked ?? true;
|
||||
else
|
||||
_Cell.Value = _CheckValueUnchecked ?? false;
|
||||
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
///<exception cref="Exception"></exception>
|
||||
public virtual bool GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
Type type = value.GetType();
|
||||
|
||||
if (CheckValueChecked != null)
|
||||
{
|
||||
if (value.Equals(CheckValueChecked))
|
||||
return (true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == typeof(bool))
|
||||
return ((bool)value);
|
||||
|
||||
if (type == typeof(string))
|
||||
{
|
||||
string s = (string)value;
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
s = _Cell.GetExpValue(s);
|
||||
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "y":
|
||||
case "yes":
|
||||
case "t":
|
||||
case "true":
|
||||
case "1":
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int n = Convert.ToInt32(value);
|
||||
|
||||
if (n == 1)
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckValueUnchecked != null)
|
||||
{
|
||||
if (value.Equals(CheckValueUnchecked))
|
||||
return (true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (type == typeof(bool))
|
||||
return ((bool)value);
|
||||
|
||||
if (type == typeof(string))
|
||||
{
|
||||
string s = (string)value;
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
s = _Cell.GetExpValue(s);
|
||||
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "n":
|
||||
case "no":
|
||||
case "f":
|
||||
case "false":
|
||||
case "0":
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int n = Convert.ToInt32(value);
|
||||
|
||||
if (n == 0)
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception("Invalid checkBox cell value (" + value + ").");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.NonModal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Checked); }
|
||||
set { Checked = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Checked = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
Focus();
|
||||
|
||||
switch (e.KeyData)
|
||||
{
|
||||
case Keys.T:
|
||||
if (Checked == false)
|
||||
Checked = true;
|
||||
break;
|
||||
|
||||
case Keys.F:
|
||||
if (Checked == true)
|
||||
Checked = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.T:
|
||||
case Keys.F:
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,676 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridCheckBoxEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridCheckBoxXEditControl : CheckBoxX, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridCheckBoxXEditControl
|
||||
///</summary>
|
||||
public GridCheckBoxXEditControl()
|
||||
{
|
||||
CheckValueChecked = null;
|
||||
CheckValueUnchecked = null;
|
||||
|
||||
Text = "";
|
||||
|
||||
CheckedChanged += ControlCheckedChanged;
|
||||
}
|
||||
|
||||
#region ControlCheckedChanged
|
||||
|
||||
private void ControlCheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
{
|
||||
if (CheckState == CheckState.Checked)
|
||||
{
|
||||
_Cell.Value = (CheckValueChecked ?? true);
|
||||
}
|
||||
else if (CheckState == CheckState.Unchecked)
|
||||
{
|
||||
_Cell.Value = (CheckValueUnchecked ?? false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_Cell.Value = CheckValueIndeterminate;
|
||||
}
|
||||
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaint
|
||||
|
||||
/// <summary>
|
||||
/// OnPaint
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
|
||||
PaintControl(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Text
|
||||
|
||||
/// <summary>
|
||||
/// Text
|
||||
/// </summary>
|
||||
public override string Text
|
||||
{
|
||||
get { return (base.Text); }
|
||||
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
value = "";
|
||||
|
||||
TextVisible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
TextVisible = true;
|
||||
}
|
||||
|
||||
base.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
///<exception cref="Exception"></exception>
|
||||
public virtual CheckState GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (ThreeState ? CheckState.Indeterminate : CheckState.Unchecked);
|
||||
}
|
||||
|
||||
Type type = value.GetType();
|
||||
|
||||
if (CheckValueChecked != null)
|
||||
{
|
||||
if (value.Equals(CheckValueChecked))
|
||||
return (CheckState.Checked);
|
||||
}
|
||||
|
||||
if (CheckValueUnchecked != null)
|
||||
{
|
||||
if (value.Equals(CheckValueUnchecked))
|
||||
return (CheckState.Unchecked);
|
||||
}
|
||||
|
||||
if (type == typeof (bool))
|
||||
return ((bool) value ? CheckState.Checked : CheckState.Unchecked);
|
||||
|
||||
if (type == typeof (string))
|
||||
{
|
||||
string s = (string) value;
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
s = _Cell.GetExpValue(s);
|
||||
|
||||
switch (s.ToLower())
|
||||
{
|
||||
case "y":
|
||||
case "yes":
|
||||
case "t":
|
||||
case "true":
|
||||
case "1":
|
||||
return (CheckState.Checked);
|
||||
|
||||
case "":
|
||||
case "0":
|
||||
case "n":
|
||||
case "no":
|
||||
case "f":
|
||||
case "false":
|
||||
return (CheckState.Unchecked);
|
||||
}
|
||||
}
|
||||
else if (type == typeof (SqlBoolean))
|
||||
{
|
||||
SqlBoolean sb = (SqlBoolean) value;
|
||||
|
||||
if (sb.IsNull == true)
|
||||
return (ThreeState ? CheckState.Indeterminate : CheckState.Unchecked);
|
||||
|
||||
return (sb.IsTrue ? CheckState.Checked : CheckState.Unchecked);
|
||||
}
|
||||
else if (type == typeof(char))
|
||||
{
|
||||
char c = (char)value;
|
||||
|
||||
switch (Char.ToLower(c))
|
||||
{
|
||||
case 't':
|
||||
case 'y':
|
||||
case '1':
|
||||
return (CheckState.Checked);
|
||||
|
||||
case 'f':
|
||||
case 'n':
|
||||
case '0':
|
||||
return (CheckState.Unchecked);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int n = Convert.ToInt32(value);
|
||||
|
||||
return (n == 0 ? CheckState.Unchecked : CheckState.Checked);
|
||||
}
|
||||
|
||||
throw new Exception("Invalid checkBox cell value (" + value + ").");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (EditorValue.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (CheckState); }
|
||||
set { CheckState = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(bool)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
CheckState = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
HostItem.RecalcSize();
|
||||
Size size = HostItem.Size;
|
||||
|
||||
if (TextVisible == false)
|
||||
{
|
||||
// RadioButtons are not actually 13 - they are 14, even
|
||||
// though the system thinks they are 13.
|
||||
|
||||
if (CheckBoxStyle == eCheckBoxStyle.RadioButton)
|
||||
size.Height += Dpi.Height1;
|
||||
|
||||
if (size.Width < size.Height)
|
||||
size.Width = size.Height;
|
||||
}
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyData)
|
||||
{
|
||||
case Keys.T:
|
||||
case Keys.Y:
|
||||
if (Checked == false)
|
||||
Checked = true;
|
||||
break;
|
||||
|
||||
case Keys.F:
|
||||
case Keys.N:
|
||||
if (Checked == true)
|
||||
Checked = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.T:
|
||||
case Keys.F:
|
||||
case Keys.Y:
|
||||
case Keys.N:
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
eCheckBoxStyle style = CheckBoxStyle;
|
||||
CheckBoxStyle = eCheckBoxStyle.CheckBox;
|
||||
|
||||
try
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
CheckBoxStyle = style;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
CheckedChanged -= ControlCheckedChanged;
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,602 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridColorPickerEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridColorPickerEditControl : ColorPickerButton, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridColorPickerEditControl
|
||||
///</summary>
|
||||
public GridColorPickerEditControl()
|
||||
{
|
||||
AccessibleRole = AccessibleRole.PushButton;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ColorTable = eButtonColor.Flat;
|
||||
|
||||
InternalAutoExpandOnClick = true;
|
||||
InternalFocusCuesEnabled = false;
|
||||
InternalStyle = eDotNetBarStyle.StyleManagerControlled;
|
||||
|
||||
SetSelectedColorImageEx();
|
||||
|
||||
SelectedColorChanged += ControlSelectedColorChanged;
|
||||
}
|
||||
|
||||
#region SetSelectedColorImage
|
||||
|
||||
/// <summary>
|
||||
/// Creates and sets the Image and SelectedColorImageRectangle.
|
||||
/// </summary>
|
||||
protected virtual void SetSelectedColorImage()
|
||||
{
|
||||
SetSelectedColorImageEx();
|
||||
}
|
||||
|
||||
private void SetSelectedColorImageEx()
|
||||
{
|
||||
Rectangle r = new Rectangle(0, 0, 16, 16);
|
||||
|
||||
Bitmap image = new Bitmap(r.Width, r.Height);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(image))
|
||||
g.FillRectangle(Brushes.Black, r);
|
||||
|
||||
r.Inflate(-1, -1);
|
||||
|
||||
Image = image;
|
||||
SelectedColorImageRectangle = r;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ControlSelectedColorChanged
|
||||
|
||||
private void ControlSelectedColorChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
{
|
||||
Type dataType = _Cell.GridColumn.DataType;
|
||||
|
||||
if (dataType == null && _Cell.Value != null)
|
||||
dataType = _Cell.Value.GetType();
|
||||
|
||||
if (dataType == typeof(Color))
|
||||
{
|
||||
_Cell.Value = SelectedColor;
|
||||
}
|
||||
else if (dataType == typeof(string))
|
||||
{
|
||||
if (SelectedColor.IsKnownColor)
|
||||
_Cell.Value = SelectedColor.Name;
|
||||
else
|
||||
_Cell.Value = SelectedColor.ToArgb().ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
_Cell.Value = SelectedColor.ToArgb();
|
||||
}
|
||||
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated processing.
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual int GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (value.GetType() == typeof(int))
|
||||
return ((int)value);
|
||||
|
||||
if (value.GetType() == typeof(Color))
|
||||
return (((Color)value).ToArgb());
|
||||
|
||||
if (value is string)
|
||||
{
|
||||
Color color = Color.FromName((string)value);
|
||||
|
||||
if (color.IsKnownColor == true)
|
||||
return (color.ToArgb());
|
||||
|
||||
int x;
|
||||
if (int.TryParse((string)value, out x) == true)
|
||||
return (x);
|
||||
|
||||
if (int.TryParse((string)value,
|
||||
NumberStyles.HexNumber, CultureInfo.InvariantCulture, out x) == true)
|
||||
return (x);
|
||||
}
|
||||
|
||||
throw new Exception("Invalid cell value (" + value + ").");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (Expanded == false && IsMouseDown == false); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.NonModal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return String.IsNullOrEmpty(SelectedColor.Name) ? "" : SelectedColor.Name;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (SelectedColor.ToArgb()); }
|
||||
|
||||
set
|
||||
{
|
||||
Color color = Color.FromArgb(GetValue(value));
|
||||
|
||||
if (SelectedColor != color)
|
||||
SelectedColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(int)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public virtual bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
|
||||
int value = GetValue(_Cell.Value);
|
||||
|
||||
if (value != 0)
|
||||
SelectedColor = Color.FromArgb(value);
|
||||
else
|
||||
SelectedColor = Color.Empty;
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
OnKeyDown(e);
|
||||
OnKeyUp(e);
|
||||
|
||||
Checked = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
if (_Cell != null)
|
||||
{
|
||||
Refresh();
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
Image image = Image;
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
Image = null;
|
||||
|
||||
image.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,871 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridComboBoxExEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridComboBoxExEditControl : ComboBoxEx, IGridCellEditControl
|
||||
{
|
||||
#region DllImports
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern int GetCurrentThreadId();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool IsWindowVisible(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern void GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool EnumThreadWindows(int dwThreadId, EnumThreadDelegate lpfn, IntPtr lParam);
|
||||
|
||||
private delegate bool EnumThreadDelegate(IntPtr hWnd, IntPtr lParam);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Static data
|
||||
|
||||
static bool _StaticIsOpen;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
private bool _PanelShown;
|
||||
private bool _CacheDisplayMembers = true;
|
||||
|
||||
private int _ValueIndex;
|
||||
private string _ValueText;
|
||||
|
||||
private int[] _ValueIndicees;
|
||||
private object[] _ValueMembers;
|
||||
|
||||
private CurrencyManager _CurrentDataManager;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridComboBoxExEditControl
|
||||
///</summary>
|
||||
public GridComboBoxExEditControl()
|
||||
{
|
||||
DrawMode = DrawMode.OwnerDrawFixed;
|
||||
DisconnectedPopupDataSource = true;
|
||||
|
||||
BindingContext = new BindingContext();
|
||||
}
|
||||
|
||||
#region OnDataSourceChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnDataSourceChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnDataSourceChanged(EventArgs e)
|
||||
{
|
||||
if (_CurrentDataManager != null)
|
||||
_CurrentDataManager.ListChanged -= DataManagerListChanged;
|
||||
|
||||
base.OnDataSourceChanged(e);
|
||||
|
||||
_ValueMembers = null;
|
||||
_ValueIndicees = null;
|
||||
|
||||
_CurrentDataManager = DataManager;
|
||||
|
||||
if (_CurrentDataManager != null)
|
||||
_CurrentDataManager.ListChanged += DataManagerListChanged;
|
||||
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
if (_Cell != null && _Cell.GridPanel != null)
|
||||
InitializeContext(_Cell, null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DataManagerListChanged
|
||||
|
||||
/// <summary>
|
||||
/// DataManager_ListChanged
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void DataManagerListChanged(object sender, ListChangedEventArgs e)
|
||||
{
|
||||
_ValueMembers = null;
|
||||
_ValueIndicees = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnTextChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnTextChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
{
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
_ValueIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnTextChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnSelectedIndexChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnSelectedIndexChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnSelectedIndexChanged(EventArgs e)
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
{
|
||||
_ValueIndex = SelectedIndex;
|
||||
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
EditorValueChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnSelectedIndexChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
/// <summary>
|
||||
/// GetValue
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public virtual object GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return ("");
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetValue
|
||||
|
||||
private void SetValue(object o, bool initEdit)
|
||||
{
|
||||
_ValueText = "";
|
||||
_ValueIndex = -1;
|
||||
|
||||
bool oldSuspend = SuspendUpdate;
|
||||
SuspendUpdate = true;
|
||||
|
||||
SelectedIndex = -1;
|
||||
|
||||
SuspendUpdate = oldSuspend;
|
||||
|
||||
if (o != null)
|
||||
{
|
||||
_ValueText = o.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(_ValueText) == false &&
|
||||
string.IsNullOrEmpty(ValueMember) == false &&
|
||||
string.IsNullOrEmpty(DisplayMember) == false)
|
||||
{
|
||||
if (Items.Count > 0)
|
||||
{
|
||||
if (Items[0] is DataRowView &&
|
||||
initEdit == false && _CacheDisplayMembers == true)
|
||||
{
|
||||
SetSelectedDrvValue(o);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSelectedValue(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = _ValueText;
|
||||
_ValueIndex = SelectedIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region SetSelectedDrvValue
|
||||
|
||||
private void SetSelectedDrvValue(object o)
|
||||
{
|
||||
if (_ValueMembers == null)
|
||||
{
|
||||
SuspendUpdate = true;
|
||||
|
||||
_ValueMembers = new object[Items.Count];
|
||||
_ValueIndicees = new int[Items.Count];
|
||||
|
||||
for (int i = 0; i < Items.Count; i++)
|
||||
{
|
||||
DataRowView drv = (DataRowView)Items[i];
|
||||
|
||||
_ValueMembers[i] = drv.Row[ValueMember];
|
||||
_ValueIndicees[i] = i;
|
||||
}
|
||||
|
||||
Array.Sort(_ValueMembers, _ValueIndicees);
|
||||
|
||||
SuspendUpdate = false;
|
||||
}
|
||||
|
||||
int n = -1;
|
||||
|
||||
try
|
||||
{
|
||||
n = Array.BinarySearch(_ValueMembers, o);
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (n >= 0)
|
||||
{
|
||||
_ValueIndex = _ValueIndicees[n];
|
||||
_ValueText = GetItemText(Items[_ValueIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = _ValueText;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetSelectedValue
|
||||
|
||||
private void SetSelectedValue(object o)
|
||||
{
|
||||
try
|
||||
{
|
||||
SelectedValue = o;
|
||||
_ValueIndex = SelectedIndex;
|
||||
|
||||
if (SelectedValue != null)
|
||||
_ValueText = Text;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Text = _ValueText;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CacheDisplayMembers
|
||||
|
||||
/// <summary>
|
||||
/// Informs the control to cache DataRowView
|
||||
/// ValueMember/DisplayMember information (default is true).
|
||||
/// </summary>
|
||||
public bool CacheDisplayMembers
|
||||
{
|
||||
get { return (_CacheDisplayMembers); }
|
||||
|
||||
set
|
||||
{
|
||||
_CacheDisplayMembers = value;
|
||||
|
||||
if (value == false)
|
||||
{
|
||||
_ValueMembers = null;
|
||||
_ValueIndicees = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public virtual bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
CellEditMode _CellEditMode = CellEditMode.Modal;
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public virtual CellEditMode CellEditMode
|
||||
{
|
||||
get { return (_CellEditMode); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (_ValueText);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ValueIndex >= 0)
|
||||
SelectedIndex = _ValueIndex;
|
||||
|
||||
if (string.IsNullOrEmpty(ValueMember) == false)
|
||||
return (SelectedValue ?? Text);
|
||||
|
||||
if (string.IsNullOrEmpty(DisplayMember) == false)
|
||||
return (Text);
|
||||
|
||||
return (this.SelectedValue ?? this.SelectedItem ?? Text);
|
||||
}
|
||||
|
||||
set { SetValue(GetValue(value), true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
SetValue(GetValue(_Cell.Value), false);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
eTextFormat tf = eTextFormat.NoClipping |
|
||||
eTextFormat.WordEllipsis | eTextFormat.NoPrefix;
|
||||
|
||||
if (style.AllowWrap == Tbool.True)
|
||||
tf |= eTextFormat.WordBreak;
|
||||
|
||||
string s = EditorFormattedValue;
|
||||
|
||||
if (String.IsNullOrEmpty(s) == true)
|
||||
s = " ";
|
||||
|
||||
Size size = (constraintSize.IsEmpty == true)
|
||||
? TextHelper.MeasureText(g, s, style.Font)
|
||||
: TextHelper.MeasureText(g, s, style.Font, constraintSize, tf);
|
||||
|
||||
if (ItemHeight > size.Height)
|
||||
size.Height = ItemHeight;
|
||||
|
||||
size.Height += Dpi.Height(DefaultMargin.Vertical);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
// If we are caching Display/Value member info, then
|
||||
// force the ComboBox to now set the correct SelectedValue.
|
||||
|
||||
if (CacheDisplayMembers == true)
|
||||
{
|
||||
object o = EditorValue;
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
if (IsPopupOpen == true)
|
||||
IsPopupOpen = false;
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
if (IsPopupOpen == true)
|
||||
IsPopupOpen = false;
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
if (_PanelShown == false)
|
||||
{
|
||||
_EditorPanel.Show();
|
||||
_EditorPanel.Hide();
|
||||
|
||||
_PanelShown = true;
|
||||
}
|
||||
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
Focus();
|
||||
|
||||
switch (e.KeyData)
|
||||
{
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Space:
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
return (true);
|
||||
|
||||
case Keys.Enter:
|
||||
if (DroppedDown == true || IsPopupOpen == true)
|
||||
return (true);
|
||||
|
||||
if (AutoCompleteMode != AutoCompleteMode.None)
|
||||
{
|
||||
if (string.IsNullOrEmpty(DropDownColumns) == true)
|
||||
{
|
||||
if (IsAutoSuggestOpen() == true)
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
|
||||
#region IsAutoSuggestOpen
|
||||
|
||||
private bool IsAutoSuggestOpen()
|
||||
{
|
||||
_StaticIsOpen = false;
|
||||
|
||||
EnumThreadWindows(GetCurrentThreadId(), EnumThreadWindowCallback, IntPtr.Zero);
|
||||
|
||||
return (_StaticIsOpen);
|
||||
}
|
||||
|
||||
#region EnumThreadWindowCallback
|
||||
|
||||
private static bool EnumThreadWindowCallback(IntPtr hWnd, IntPtr lParam)
|
||||
{
|
||||
if (IsWindowVisible(hWnd) == true)
|
||||
{
|
||||
if ((GetClassName(hWnd) == "Auto-Suggest Dropdown"))
|
||||
{
|
||||
_StaticIsOpen = true;
|
||||
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#region GetClassName
|
||||
|
||||
private static string GetClassName(IntPtr hRef)
|
||||
{
|
||||
StringBuilder lpClassName = new StringBuilder(256);
|
||||
|
||||
GetClassName(hRef, lpClassName, 256);
|
||||
|
||||
return (lpClassName.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (_CurrentDataManager != null)
|
||||
_CurrentDataManager.ListChanged -= DataManagerListChanged;
|
||||
|
||||
BindingContext = null;
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,622 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.AdvTree;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridComboTreeEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridComboTreeEditControl : ComboTree, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
private bool _PanelShown;
|
||||
|
||||
private string _ValueText;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridComboTreeEditControl
|
||||
///</summary>
|
||||
public GridComboTreeEditControl()
|
||||
{
|
||||
BindingContext = new BindingContext();
|
||||
|
||||
ButtonDropDown.Visible = true;
|
||||
}
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
BindingContext = null;
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnTextChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnTextChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
|
||||
base.OnTextChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnSelectedIndexChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnSelectedIndexChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnSelectedIndexChanged(EventArgs e)
|
||||
{
|
||||
if (IsDisposed == false)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
{
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
EditorValueChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnSelectedIndexChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
/// <summary>
|
||||
/// GetValue
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public virtual object GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return ("");
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetValue
|
||||
|
||||
private void SetValue(object o)
|
||||
{
|
||||
if (o == null)
|
||||
{
|
||||
_ValueText = "";
|
||||
SelectedIndex = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ValueText = o.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(ValueMember) == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
SelectedValue = o;
|
||||
|
||||
if (SelectedValue != null)
|
||||
_ValueText = Text;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Text = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedIndex = -1;
|
||||
|
||||
string s = o.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(s) == false)
|
||||
{
|
||||
Node node = AdvTree.FindNodeByCellText(s);
|
||||
|
||||
if (node != null)
|
||||
{
|
||||
SelectedNode = node;
|
||||
|
||||
if (string.IsNullOrEmpty(SelectedDisplayMember) == false)
|
||||
_ValueText = GetSelectedDisplayMemberText(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (_ValueText);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(ValueMember) == false)
|
||||
return (SelectedValue);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
|
||||
set { SetValue(GetValue(value)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
SetValue(GetValue(_Cell.Value));
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
eTextFormat tf = eTextFormat.NoPadding | eTextFormat.NoClipping |
|
||||
eTextFormat.WordEllipsis | eTextFormat.NoPrefix;
|
||||
|
||||
if (style.AllowWrap == Tbool.True)
|
||||
tf |= eTextFormat.WordBreak;
|
||||
|
||||
string s = String.IsNullOrEmpty(Text) ? " " : Text;
|
||||
|
||||
Size size = (constraintSize.IsEmpty == true)
|
||||
? TextHelper.MeasureText(g, s, style.Font, new Size(10000, 0), tf)
|
||||
: TextHelper.MeasureText(g, s, style.Font, constraintSize, tf);
|
||||
|
||||
if (size.Height < Dpi.Height22)
|
||||
size.Height = Dpi.Height22;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
UpdateTreeSize();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
if (_PanelShown == false)
|
||||
{
|
||||
_EditorPanel.Show();
|
||||
_EditorPanel.Hide();
|
||||
|
||||
_PanelShown = true;
|
||||
}
|
||||
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
Focus();
|
||||
|
||||
switch (e.KeyData)
|
||||
{
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Space:
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,506 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.Editors.DateTimeAdv;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridTextBoxEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridDateTimeInputEditControl : DateTimeInput, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private DateTime _OrigValue;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridDateTimeInputEditControl
|
||||
///</summary>
|
||||
public GridDateTimeInputEditControl()
|
||||
{
|
||||
ShowUpDown = true;
|
||||
}
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnValueChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnValueChanged(EventArgs e)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
{
|
||||
if (_OrigValue.Year != Value.Year || _OrigValue.Month != Value.Month ||
|
||||
_OrigValue.Day != Value.Day || _OrigValue.Hour != Value.Hour ||
|
||||
_OrigValue.Minute != Value.Minute || _OrigValue.Second != Value.Second)
|
||||
{
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
base.OnValueChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
/// <summary>
|
||||
/// GetValue
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public virtual DateTime GetValue(object value)
|
||||
{
|
||||
if (value == null || value == Convert.DBNull ||
|
||||
(value is string && String.IsNullOrEmpty((string)value) == true))
|
||||
{
|
||||
return (DateTime.MinValue);
|
||||
}
|
||||
|
||||
if (value is DateTime)
|
||||
return (Convert.ToDateTime(value));
|
||||
|
||||
if (value is SqlDateTime)
|
||||
{
|
||||
SqlDateTime sdt = (SqlDateTime)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (DateTime.MinValue);
|
||||
|
||||
return (sdt.Value);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
if (value is string && CurrentCulture != null)
|
||||
{
|
||||
DateTime d;
|
||||
|
||||
if (DateTime.TryParse(value.ToString(), GetActiveCulture().DateTimeFormat,
|
||||
System.Globalization.DateTimeStyles.None, out d))
|
||||
{
|
||||
return (d);
|
||||
}
|
||||
}
|
||||
|
||||
return (Convert.ToDateTime(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Value); }
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(DateTime)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
ForeColor = style.TextColor;
|
||||
Font = style.Font;
|
||||
}
|
||||
|
||||
_OrigValue = GetValue(cell.Value);
|
||||
|
||||
Value = _OrigValue;
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
Show();
|
||||
Focus();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
case Keys.Home:
|
||||
case Keys.End:
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,490 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridDateTimePickerEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridDateTimePickerEditControl : DateTimePicker, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
///GridDateTimePickerEditControl
|
||||
///</summary>
|
||||
public GridDateTimePickerEditControl()
|
||||
{
|
||||
Format = DateTimePickerFormat.Short;
|
||||
}
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnValueChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnValueChanged(EventArgs e)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
base.OnValueChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
/// <summary>
|
||||
/// GetValue
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public virtual DateTime GetValue(object value)
|
||||
{
|
||||
if (value == null || value == Convert.DBNull ||
|
||||
(value is string && String.IsNullOrEmpty((string)value) == true))
|
||||
{
|
||||
return (MinDate);
|
||||
}
|
||||
|
||||
if (value is DateTime)
|
||||
return ((DateTime)value);
|
||||
|
||||
if (value is SqlDateTime)
|
||||
{
|
||||
SqlDateTime sdt = (SqlDateTime)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (DateTime.MinValue);
|
||||
|
||||
return (sdt.Value);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToDateTime(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Value); }
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(DateTime)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
// Control colors are tied to Windows System Colors
|
||||
// therefore there is not an easy way to pass along color settings.
|
||||
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
Font = style.Font;
|
||||
}
|
||||
|
||||
Value = GetValue(cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
// We seem to have to recreate the control to override it's
|
||||
// internal client area offsetting when previously sized too
|
||||
// small for the given constraintSize
|
||||
|
||||
//RecreateHandle();
|
||||
|
||||
Show();
|
||||
Focus();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
case Keys.Home:
|
||||
case Keys.End:
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,621 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.Editors;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridDoubleInputEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridDoubleInputEditControl : DoubleInput, IGridCellEditControl, IGridCellEditorFocus
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridIntegerInputEditControl
|
||||
///</summary>
|
||||
public GridDoubleInputEditControl()
|
||||
{
|
||||
InitInputControl(false);
|
||||
}
|
||||
|
||||
#region InitInputControl
|
||||
|
||||
/// <summary>
|
||||
/// InitInputControl
|
||||
/// </summary>
|
||||
/// <param name="isIntegral"></param>
|
||||
protected void InitInputControl(bool isIntegral)
|
||||
{
|
||||
ShowUpDown = true;
|
||||
|
||||
if (isIntegral == true)
|
||||
DisplayFormat = "G";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnValueChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnValueChanged(EventArgs e)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
base.OnValueChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual double GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (value is SqlSingle)
|
||||
{
|
||||
SqlSingle sdt = (SqlSingle)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (0);
|
||||
|
||||
return (sdt.Value);
|
||||
}
|
||||
|
||||
if (value is SqlDouble)
|
||||
{
|
||||
SqlDouble sdt = (SqlDouble)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (0);
|
||||
|
||||
return (sdt.Value);
|
||||
}
|
||||
|
||||
if (value is SqlDecimal)
|
||||
{
|
||||
SqlDecimal sdt = (SqlDecimal)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (0);
|
||||
|
||||
return (Convert.ToDouble(sdt.Value));
|
||||
}
|
||||
|
||||
if (value is SqlInt64)
|
||||
{
|
||||
SqlDecimal sdt = (SqlInt64)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (0);
|
||||
|
||||
return (Convert.ToDouble(sdt.Value));
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToDouble(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Value); }
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(double)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Value = GetValue(cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
if (FreeTextEntryMode == true)
|
||||
{
|
||||
TextBox box = GetFreeTextBox() as TextBox;
|
||||
|
||||
if (box != null)
|
||||
{
|
||||
if (selectAll == true)
|
||||
box.SelectAll();
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
CloseDropDown();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
CloseDropDown();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
if ((key & Keys.KeyCode) == Keys.Tab)
|
||||
{
|
||||
ApplyFreeTextValue();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
if (IsCalculatorDisplayed == true)
|
||||
return (true);
|
||||
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
case Keys.Home:
|
||||
case Keys.End:
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
return (true);
|
||||
|
||||
case Keys.Enter:
|
||||
ApplyFreeTextValue();
|
||||
return (gridWantsKey == false);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditorFocus members
|
||||
|
||||
#region FocusEditor
|
||||
|
||||
/// <summary>
|
||||
/// Gives focus to the editor
|
||||
/// </summary>
|
||||
public void FocusEditor()
|
||||
{
|
||||
if (IsEditorFocused == false)
|
||||
{
|
||||
if (FreeTextEntryMode == true)
|
||||
{
|
||||
TextBox box = GetFreeTextBox() as TextBox;
|
||||
|
||||
if (box != null)
|
||||
box.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEditorFocused
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether editor has the focus
|
||||
/// </summary>
|
||||
public bool IsEditorFocused
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FreeTextEntryMode == true)
|
||||
{
|
||||
TextBox box = GetFreeTextBox() as TextBox;
|
||||
|
||||
if (box != null)
|
||||
return (box.Focused);
|
||||
}
|
||||
|
||||
return (Focused);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// GridDoubleIntInputEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridDoubleIntInputEditControl : GridDoubleInputEditControl
|
||||
{
|
||||
///<summary>
|
||||
/// GridDoubleIntInputEditControl
|
||||
///</summary>
|
||||
public GridDoubleIntInputEditControl()
|
||||
{
|
||||
InitInputControl(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,548 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.Instrumentation;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridGaugeEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridGaugeEditControl : GaugeControl, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private string _PointerName = "Pointer1";
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.Both;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridGaugeEditControl
|
||||
///</summary>
|
||||
public GridGaugeEditControl()
|
||||
{
|
||||
PointerValueChanged += OnValueChanged;
|
||||
#if !TRIAL
|
||||
LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
|
||||
#endif
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
///<summary>
|
||||
/// PointerName
|
||||
///</summary>
|
||||
public string PointerName
|
||||
{
|
||||
get { return (_PointerName); }
|
||||
set { _PointerName = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// Pointer Value changed
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected virtual void OnValueChanged(object sender, PointerChangedEventArgs e)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
{
|
||||
_Cell.Value = e.NewValue;
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaintBackground
|
||||
|
||||
/// <summary>
|
||||
/// OnPaintBackground
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual double GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToDouble(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get { return (Text); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (GetPointerValue(_PointerName)); }
|
||||
set { SetPointerValue(_PointerName, GetValue(value), false); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
SetPointerValue(_PointerName, GetValue(_Cell.Value), false);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = constraintSize;
|
||||
size.Height = size.Width;
|
||||
|
||||
if (size.Width == 0)
|
||||
size.Width = cell.Size.Width - Dpi.Width2;
|
||||
|
||||
size.Height = Dpi.Height50;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyData)
|
||||
{
|
||||
case Keys.T:
|
||||
break;
|
||||
|
||||
case Keys.F:
|
||||
break;
|
||||
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.T:
|
||||
case Keys.F:
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
|
||||
_Cell.SuperGrid.GridCursor = Cursor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
PointerValueChanged -= OnValueChanged;
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,900 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridImageEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridImageEditControl : Control, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private int _ImageIndex = -1;
|
||||
private ImageList _ImageList;
|
||||
private string _ImageKey;
|
||||
|
||||
private Image _Image;
|
||||
private string _ImageLocation;
|
||||
private Image _LocationImage;
|
||||
private ImageSizeMode _ImageSizeMode = ImageSizeMode.Normal;
|
||||
|
||||
private Image _StreamImage;
|
||||
private MemoryStream _ImageMemoryStream;
|
||||
private byte[] _ImageData;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.Both;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Image
|
||||
|
||||
///<summary>
|
||||
/// Image
|
||||
///</summary>
|
||||
public Image Image
|
||||
{
|
||||
get { return (_Image); }
|
||||
set { _Image = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageData
|
||||
|
||||
///<summary>
|
||||
/// ImageData
|
||||
///</summary>
|
||||
public byte[] ImageData
|
||||
{
|
||||
get { return (_ImageData); }
|
||||
|
||||
set
|
||||
{
|
||||
_ImageData = value;
|
||||
|
||||
StreamImage = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageIndex
|
||||
|
||||
///<summary>
|
||||
/// ImageKey
|
||||
///</summary>
|
||||
public int ImageIndex
|
||||
{
|
||||
get { return (_ImageIndex); }
|
||||
set { _ImageIndex = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageKey
|
||||
|
||||
///<summary>
|
||||
/// ImageKey
|
||||
///</summary>
|
||||
public string ImageKey
|
||||
{
|
||||
get { return (_ImageKey); }
|
||||
set { _ImageKey = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageList
|
||||
|
||||
///<summary>
|
||||
/// ImageList
|
||||
///</summary>
|
||||
public ImageList ImageList
|
||||
{
|
||||
get { return (_ImageList); }
|
||||
set { _ImageList = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageLocation
|
||||
|
||||
///<summary>
|
||||
/// ImageLocation
|
||||
///</summary>
|
||||
public string ImageLocation
|
||||
{
|
||||
get { return (_ImageLocation); }
|
||||
|
||||
set
|
||||
{
|
||||
_ImageLocation = value;
|
||||
|
||||
LocationImage = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageSizeMode
|
||||
|
||||
///<summary>
|
||||
/// ImageSizeMode
|
||||
///</summary>
|
||||
public ImageSizeMode ImageSizeMode
|
||||
{
|
||||
get { return (_ImageSizeMode); }
|
||||
set { _ImageSizeMode = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private properties
|
||||
|
||||
#region EffectiveImage
|
||||
|
||||
private Image EffectiveImage
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Image != null)
|
||||
return (_Image);
|
||||
|
||||
if (StreamImage != null)
|
||||
return (StreamImage);
|
||||
|
||||
if (_ImageList != null)
|
||||
{
|
||||
_ImageList.TransparentColor = Color.Magenta;
|
||||
|
||||
if ((uint)_ImageIndex < _ImageList.Images.Count)
|
||||
return (_ImageList.Images[_ImageIndex]);
|
||||
|
||||
if (_ImageKey != null)
|
||||
return (_ImageList.Images[_ImageKey]);
|
||||
}
|
||||
|
||||
return (LocationImage);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageMemoryStream
|
||||
|
||||
private MemoryStream ImageMemoryStream
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ImageMemoryStream == null)
|
||||
_ImageMemoryStream = new MemoryStream();
|
||||
|
||||
return (_ImageMemoryStream);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ImageMemoryStream != null)
|
||||
_ImageMemoryStream.Dispose();
|
||||
|
||||
_ImageMemoryStream = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LocationImage
|
||||
|
||||
private Image LocationImage
|
||||
{
|
||||
get { return (_LocationImage); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_LocationImage != null)
|
||||
_LocationImage.Dispose();
|
||||
|
||||
_LocationImage = value;
|
||||
|
||||
if (string.IsNullOrEmpty(_ImageLocation) == false)
|
||||
{
|
||||
using (FileStream fs = new FileStream(_ImageLocation, FileMode.Open))
|
||||
_LocationImage = Image.FromStream(fs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StreamImage
|
||||
|
||||
private Image StreamImage
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_StreamImage == null)
|
||||
{
|
||||
if (_ImageData != null)
|
||||
{
|
||||
MemoryStream ms = ImageMemoryStream;
|
||||
|
||||
if (ms != null)
|
||||
{
|
||||
ms.SetLength(0);
|
||||
ms.Write(_ImageData, 0, _ImageData.Length);
|
||||
|
||||
StreamImage = Image.FromStream(ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (_StreamImage);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_StreamImage != null)
|
||||
_StreamImage.Dispose();
|
||||
|
||||
_StreamImage = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaintBackground
|
||||
|
||||
/// <summary>
|
||||
/// OnPaintBackground
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
ResetImageInfo();
|
||||
|
||||
ImageMemoryStream = null;
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetValue
|
||||
|
||||
///<summary>
|
||||
/// SetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
public virtual void SetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (panel.IsDesignerHosted == false)
|
||||
{
|
||||
ResetImageInfo();
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
}
|
||||
else if (value is Image)
|
||||
{
|
||||
Image = (Image)value;
|
||||
}
|
||||
else if (value is string)
|
||||
{
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
if (SetImageKey((string)value) == false)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (int.TryParse((string)value, out index) == true)
|
||||
SetImageIndex(index);
|
||||
else
|
||||
ImageLocation = (string)value;
|
||||
}
|
||||
}
|
||||
else if (value is byte[])
|
||||
{
|
||||
ImageData = (byte[])value;
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = Convert.ToInt32(value);
|
||||
|
||||
SetImageIndex(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region ResetImageInfo
|
||||
|
||||
private void ResetImageInfo()
|
||||
{
|
||||
Image = null;
|
||||
ImageKey = null;
|
||||
ImageIndex = -1;
|
||||
ImageLocation = null;
|
||||
ImageData = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetImageKey
|
||||
|
||||
private bool SetImageKey(string key)
|
||||
{
|
||||
if (_ImageList != null)
|
||||
{
|
||||
if (_ImageList.Images.ContainsKey(key))
|
||||
{
|
||||
_ImageKey = key;
|
||||
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetImageIndex
|
||||
|
||||
private void SetImageIndex(int index)
|
||||
{
|
||||
if (_ImageList != null && index < _ImageList.Images.Count)
|
||||
ImageIndex = index;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.Value != null)
|
||||
return (_Cell.Value.ToString());
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (String.IsNullOrEmpty(ImageLocation) == false)
|
||||
return (ImageLocation);
|
||||
|
||||
if (String.IsNullOrEmpty(_ImageKey) == false)
|
||||
return (_ImageKey);
|
||||
|
||||
return (_ImageIndex);
|
||||
}
|
||||
|
||||
set { SetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
SetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Image image = EffectiveImage;
|
||||
|
||||
Size size = (image != null)
|
||||
? image.Size : Dpi.Size(20, 20);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
Image image = EffectiveImage;
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
Rectangle r = _Cell.GetCellEditBounds(this);
|
||||
|
||||
switch (_ImageSizeMode)
|
||||
{
|
||||
case ImageSizeMode.Normal:
|
||||
Rectangle sr = r;
|
||||
sr.Location = Point.Empty;
|
||||
|
||||
g.DrawImage(image, r, sr, GraphicsUnit.Pixel);
|
||||
break;
|
||||
|
||||
case ImageSizeMode.CenterImage:
|
||||
RenderImageCentered(g, image, r);
|
||||
break;
|
||||
|
||||
case ImageSizeMode.StretchImage:
|
||||
g.DrawImage(image, r);
|
||||
break;
|
||||
|
||||
case ImageSizeMode.Zoom:
|
||||
RenderImageScaled(g, image, r);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region RenderImageCentered
|
||||
|
||||
private void RenderImageCentered(Graphics g, Image image, Rectangle r)
|
||||
{
|
||||
Rectangle sr = r;
|
||||
sr.Location = Point.Empty;
|
||||
|
||||
if (image.Width > r.Width)
|
||||
sr.X += (image.Width - r.Width) / 2;
|
||||
else
|
||||
r.X += (r.Width - image.Width) / 2;
|
||||
|
||||
if (image.Height > r.Height)
|
||||
sr.Y += (image.Height - r.Height) / 2;
|
||||
else
|
||||
r.Y += (r.Height - image.Height) / 2;
|
||||
|
||||
g.DrawImage(image, r, sr, GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderImageScaled
|
||||
|
||||
private void RenderImageScaled(Graphics g, Image image, Rectangle r)
|
||||
{
|
||||
SizeF size = new SizeF(image.Width / image.HorizontalResolution,
|
||||
image.Height / image.VerticalResolution);
|
||||
|
||||
float scale = Math.Min(r.Width / size.Width, r.Height / size.Height);
|
||||
|
||||
size.Width *= scale;
|
||||
size.Height *= scale;
|
||||
|
||||
g.DrawImage(image, r.X + (r.Width - size.Width) / 2,
|
||||
r.Y + (r.Height - size.Height) / 2,
|
||||
size.Width, size.Height);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
OnKeyDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region ImageSizeMode
|
||||
|
||||
///<summary>
|
||||
/// ImageSizeMode
|
||||
///</summary>
|
||||
public enum ImageSizeMode
|
||||
{
|
||||
///<summary>
|
||||
/// The image is placed in the upper-left
|
||||
/// corner of the cell and is clipped if needed to fit.
|
||||
///</summary>
|
||||
Normal,
|
||||
|
||||
///<summary>
|
||||
/// The image is stretched or shrunk to fit the cell.
|
||||
///</summary>
|
||||
StretchImage,
|
||||
|
||||
///<summary>
|
||||
/// The image is displayed in the center of the cell if
|
||||
/// the cell is larger than the image. If the image is larger
|
||||
/// than the cell, the image is placed in the center of the
|
||||
/// cell and the outside edges are clipped.
|
||||
///</summary>
|
||||
CenterImage,
|
||||
|
||||
///<summary>
|
||||
/// The size of the image is increased or decreased to fit the
|
||||
/// cell, maintaining the size ratio.
|
||||
///</summary>
|
||||
Zoom
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,570 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.Editors;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridIntegerInputEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridIntegerInputEditControl : IntegerInput, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridIntegerInputEditControl
|
||||
///</summary>
|
||||
public GridIntegerInputEditControl()
|
||||
{
|
||||
ShowUpDown = true;
|
||||
}
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnValueChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnValueChanged(EventArgs e)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
base.OnValueChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual int GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (value is SqlInt16)
|
||||
{
|
||||
SqlInt16 sdt = (SqlInt16) value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (0);
|
||||
|
||||
return (sdt.Value);
|
||||
}
|
||||
|
||||
if (value is SqlInt32)
|
||||
{
|
||||
SqlInt32 sdt = (SqlInt32)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (0);
|
||||
|
||||
return (sdt.Value);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToInt32(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Value); }
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(int)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Value = GetValue(cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
if (FreeTextEntryMode == true)
|
||||
{
|
||||
TextBox box = GetFreeTextBox() as TextBox;
|
||||
|
||||
if (box != null)
|
||||
{
|
||||
if (selectAll == true)
|
||||
box.SelectAll();
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
CloseDropDown();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
CloseDropDown();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
if ((key & Keys.KeyCode) == Keys.Tab)
|
||||
{
|
||||
ApplyFreeTextValue();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
if (IsCalculatorDisplayed == true)
|
||||
return (true);
|
||||
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
case Keys.Home:
|
||||
case Keys.End:
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
return (true);
|
||||
|
||||
case Keys.Enter:
|
||||
ApplyFreeTextValue();
|
||||
return (gridWantsKey == false);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditorFocus members
|
||||
|
||||
#region FocusEditor
|
||||
|
||||
/// <summary>
|
||||
/// Gives focus to the editor
|
||||
/// </summary>
|
||||
public void FocusEditor()
|
||||
{
|
||||
if (IsEditorFocused == false)
|
||||
{
|
||||
if (FreeTextEntryMode == true)
|
||||
{
|
||||
TextBox box = GetFreeTextBox() as TextBox;
|
||||
|
||||
if (box != null)
|
||||
box.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEditorFocused
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether editor has the focus
|
||||
/// </summary>
|
||||
public bool IsEditorFocused
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FreeTextEntryMode == true)
|
||||
{
|
||||
TextBox box = GetFreeTextBox() as TextBox;
|
||||
|
||||
if (box != null)
|
||||
return (box.Focused);
|
||||
}
|
||||
|
||||
return (Focused);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,463 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.Editors;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridIpAddressInputEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridIpAddressInputEditControl : IpAddressInput, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnValueChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnValueChanged(EventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
base.OnValueChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual string GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return ("");
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToString(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Value); }
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(int)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Value = GetValue(cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
Show();
|
||||
Focus();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
case Keys.Home:
|
||||
case Keys.End:
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,513 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridLabelEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridLabelEditControl : Label, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaintBackground
|
||||
|
||||
/// <summary>
|
||||
/// OnPaintBackground
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual string GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return ("");
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToString(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Text); }
|
||||
set { Text = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
|
||||
SetTextAlign(style);
|
||||
}
|
||||
|
||||
Text = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#region SetTextAlign
|
||||
|
||||
private void SetTextAlign(CellVisualStyle style)
|
||||
{
|
||||
switch (style.Alignment)
|
||||
{
|
||||
case Alignment.TopLeft:
|
||||
TextAlign = ContentAlignment.TopLeft;
|
||||
break;
|
||||
|
||||
case Alignment.TopCenter:
|
||||
TextAlign = ContentAlignment.TopCenter;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
TextAlign = ContentAlignment.TopRight;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleLeft:
|
||||
TextAlign = ContentAlignment.MiddleLeft;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleCenter:
|
||||
TextAlign = ContentAlignment.MiddleCenter;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
TextAlign = ContentAlignment.MiddleRight;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
TextAlign = ContentAlignment.BottomLeft;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
TextAlign = ContentAlignment.BottomCenter;
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
TextAlign = ContentAlignment.BottomRight;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,555 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridLabelEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridLabelXEditControl : LabelX, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaint
|
||||
|
||||
/// <summary>
|
||||
/// OnPaint
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
|
||||
PaintControl(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual string GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (" ");
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
string s = Convert.ToString(value);
|
||||
|
||||
if (string.IsNullOrEmpty(s) == true)
|
||||
s = " ";
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (PlainText);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Text); }
|
||||
set { Text = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateLayout); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Font = style.Font;
|
||||
WordWrap = (style.AllowWrap == Tbool.True);
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
SetTextAlign(style);
|
||||
|
||||
ForeColor = style.TextColor;
|
||||
BackColor = Color.Transparent;
|
||||
}
|
||||
|
||||
EnableMarkup = !EnableMarkup;
|
||||
EnableMarkup = !EnableMarkup;
|
||||
|
||||
Text = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#region SetTextAlign
|
||||
|
||||
private void SetTextAlign(CellVisualStyle style)
|
||||
{
|
||||
switch (style.Alignment)
|
||||
{
|
||||
case Alignment.TopLeft:
|
||||
TextLineAlignment = StringAlignment.Near;
|
||||
TextAlignment = StringAlignment.Near;
|
||||
break;
|
||||
|
||||
case Alignment.TopCenter:
|
||||
TextLineAlignment = StringAlignment.Near;
|
||||
TextAlignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
TextLineAlignment = StringAlignment.Near;
|
||||
TextAlignment = StringAlignment.Far;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleLeft:
|
||||
TextLineAlignment = StringAlignment.Center;
|
||||
TextAlignment = StringAlignment.Near;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleCenter:
|
||||
TextLineAlignment = StringAlignment.Center;
|
||||
TextAlignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
TextLineAlignment = StringAlignment.Center;
|
||||
TextAlignment = StringAlignment.Far;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
TextLineAlignment = StringAlignment.Far;
|
||||
TextAlignment = StringAlignment.Near;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
TextLineAlignment = StringAlignment.Far;
|
||||
TextAlignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
TextLineAlignment = StringAlignment.Far;
|
||||
TextAlignment = StringAlignment.Far;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size maxSize = MaximumSize;
|
||||
MaximumSize = constraintSize;
|
||||
|
||||
InvalidateAutoSize();
|
||||
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
MaximumSize = maxSize;
|
||||
|
||||
if (constraintSize.Width > 0 && EnableMarkup == true)
|
||||
size.Width = constraintSize.Width;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
// Force a resize (LabelX seems to need this)
|
||||
|
||||
Bounds = new Rectangle();
|
||||
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
|
||||
_Cell.SuperGrid.GridCursor = Cursor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
|
||||
OnClick(EventArgs.Empty);
|
||||
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,526 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridMaskedTextBoxEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridMaskedTextBoxEditControl : MaskedTextBox, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnTextChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnTextChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
base.OnTextChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual string GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return ("");
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToString(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return ((PasswordChar == '\0')
|
||||
? Text : PasswordText());
|
||||
}
|
||||
}
|
||||
|
||||
#region PasswordText
|
||||
|
||||
private string PasswordText()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Mask))
|
||||
return (new string(PasswordChar, TextLength));
|
||||
|
||||
string text = Mask;
|
||||
|
||||
char[] c = new char[text.Length];
|
||||
|
||||
int n = 0;
|
||||
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
if ("09#L?&CAa".IndexOf(text[i]) >= 0)
|
||||
c[n++] = PasswordChar;
|
||||
|
||||
else if ("<>|".IndexOf(text[i]) < 0)
|
||||
c[n++] = text[i];
|
||||
}
|
||||
|
||||
return (new string(c));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Text); }
|
||||
set { Text = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
ForeColor = style.TextColor;
|
||||
Font = style.Font;
|
||||
|
||||
SetTextAlign(style);
|
||||
}
|
||||
|
||||
Text = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#region SetTextAlign
|
||||
|
||||
private void SetTextAlign(CellVisualStyle style)
|
||||
{
|
||||
switch (style.Alignment)
|
||||
{
|
||||
case Alignment.TopLeft:
|
||||
case Alignment.MiddleLeft:
|
||||
case Alignment.BottomLeft:
|
||||
TextAlign = HorizontalAlignment.Left;
|
||||
break;
|
||||
|
||||
case Alignment.TopCenter:
|
||||
case Alignment.MiddleCenter:
|
||||
case Alignment.BottomCenter:
|
||||
TextAlign = HorizontalAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
case Alignment.MiddleRight:
|
||||
case Alignment.BottomRight:
|
||||
TextAlign = HorizontalAlignment.Right;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
Show();
|
||||
Focus();
|
||||
|
||||
if (selectAll == true)
|
||||
SelectAll();
|
||||
else
|
||||
Select(Text.Length, 1);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
// Let the TextBox handle the following keys
|
||||
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
case Keys.Home:
|
||||
case Keys.End:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,488 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridMicroChartEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridMicroChartEditControl : MicroChart, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.Both;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridMicroChartEditControl
|
||||
///</summary>
|
||||
public GridMicroChartEditControl()
|
||||
{
|
||||
FocusCuesEnabled = false;
|
||||
AnimationEnabled = false;
|
||||
}
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaint
|
||||
|
||||
/// <summary>
|
||||
/// OnPaint
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
|
||||
PaintControl(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual List<double> GetValue(object value)
|
||||
{
|
||||
List<double> dps = new List<double>();
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
string s = value as string;
|
||||
|
||||
if (s != null)
|
||||
{
|
||||
string[] values = s.Split(new char[] { ',', ' ', '\t', '|' });
|
||||
|
||||
foreach (string t in values)
|
||||
{
|
||||
double d;
|
||||
|
||||
if (double.TryParse(t, out d) == true)
|
||||
dps.Add(d);
|
||||
}
|
||||
}
|
||||
|
||||
return (dps);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.Value == null)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (null); }
|
||||
set { DataPoints = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
DataPoints = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
size.Width += Dpi.Width1;
|
||||
|
||||
if (constraintSize.Height == 0)
|
||||
size.Height = Dpi.Height24;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
OnKeyDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,549 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridNumericUpDownEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridNumericUpDownEditControl : NumericUpDown, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridNumericUpDownEditControl
|
||||
///</summary>
|
||||
public GridNumericUpDownEditControl()
|
||||
{
|
||||
DecimalPlaces = 4;
|
||||
}
|
||||
|
||||
#region OnTextChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnTextChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
base.OnTextChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual decimal GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (value is SqlDecimal)
|
||||
{
|
||||
SqlDecimal sdt = (SqlDecimal)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (0);
|
||||
|
||||
return (sdt.Value);
|
||||
}
|
||||
|
||||
if (value is SqlSingle)
|
||||
{
|
||||
SqlSingle sdt = (SqlSingle)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (0);
|
||||
|
||||
return (Convert.ToDecimal(sdt.Value));
|
||||
}
|
||||
|
||||
if (value is SqlDouble)
|
||||
{
|
||||
SqlDouble sdt = (SqlDouble)value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return (0);
|
||||
|
||||
return (Convert.ToDecimal(sdt.Value));
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToDecimal(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(Text) == true)
|
||||
return (0);
|
||||
|
||||
return (Value);
|
||||
}
|
||||
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(decimal)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
ForeColor = style.TextColor;
|
||||
Font = style.Font;
|
||||
|
||||
SetTextAlign(style);
|
||||
}
|
||||
|
||||
Value = GetValue(cell.Value);
|
||||
Text = Value.ToString();
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#region SetTextAlign
|
||||
|
||||
private void SetTextAlign(CellVisualStyle style)
|
||||
{
|
||||
switch (style.Alignment)
|
||||
{
|
||||
case Alignment.TopLeft:
|
||||
case Alignment.MiddleLeft:
|
||||
case Alignment.BottomLeft:
|
||||
TextAlign = HorizontalAlignment.Left;
|
||||
break;
|
||||
|
||||
case Alignment.TopCenter:
|
||||
case Alignment.MiddleCenter:
|
||||
case Alignment.BottomCenter:
|
||||
TextAlign = HorizontalAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
case Alignment.MiddleRight:
|
||||
case Alignment.BottomRight:
|
||||
TextAlign = HorizontalAlignment.Right;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
AutoSize = true;
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
AutoSize = false;
|
||||
|
||||
if (constraintSize.Width > 0)
|
||||
size.Width = constraintSize.Width;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
if (selectAll == true)
|
||||
Select(0, 100);
|
||||
else
|
||||
Select(Text.Length, 1);
|
||||
|
||||
Show();
|
||||
Focus();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
case Keys.Home:
|
||||
case Keys.End:
|
||||
case Keys.Up:
|
||||
case Keys.Down:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,481 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridProgressBarXEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridProgressBarXEditControl : ProgressBarX, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.Both;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaint
|
||||
|
||||
/// <summary>
|
||||
/// OnPaint
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
|
||||
PaintControl(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual int GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToInt32(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get { return (Text); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Value); }
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
Value = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
if (constraintSize.Height == 0)
|
||||
size.Height = Dpi.Height23;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Add:
|
||||
Value += Step;
|
||||
break;
|
||||
|
||||
case Keys.Subtract:
|
||||
Value -= Step;
|
||||
break;
|
||||
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Add:
|
||||
case Keys.Subtract:
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,575 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridButtonXEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridRadialMenuEditControl : RadialMenu, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridRadialMenuEditControl
|
||||
///</summary>
|
||||
public GridRadialMenuEditControl()
|
||||
{
|
||||
this.SetStyle(
|
||||
ControlStyles.UserPaint |
|
||||
ControlStyles.AllPaintingInWmPaint |
|
||||
ControlStyles.Opaque |
|
||||
ControlStyles.ResizeRedraw |
|
||||
DisplayHelp.DoubleBufferFlag |
|
||||
ControlStyles.SupportsTransparentBackColor, true);
|
||||
|
||||
BackColor = Color.Transparent;
|
||||
Colors.RadialMenuButtonBackground = Color.Transparent;
|
||||
|
||||
ItemClick += GridRadialMenuEditControl_ItemClick;
|
||||
}
|
||||
|
||||
#region GridRadialMenuEditControl_ItemClick
|
||||
|
||||
/// <summary>
|
||||
/// RadialMenu item click handler
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void GridRadialMenuEditControl_ItemClick(object sender, EventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
{
|
||||
RadialMenuItem item = sender as RadialMenuItem;
|
||||
|
||||
if (item != null)
|
||||
OnGridRadialMenuEditControl_ItemClick(item);
|
||||
}
|
||||
}
|
||||
|
||||
#region OnGridRadialMenuEditControl_ItemClick
|
||||
|
||||
/// <summary>
|
||||
/// RadialMenu item click handler
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public virtual void OnGridRadialMenuEditControl_ItemClick(RadialMenuItem item)
|
||||
{
|
||||
if ((item.Text != null && item.Text.Equals(_Cell.Value) == false) ||
|
||||
(item.Text == null && _Cell.Value != null))
|
||||
{
|
||||
_Cell.Value = item.Text;
|
||||
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual string GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (_Cell.NullString);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (value.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FindItemByText
|
||||
|
||||
/// <summary>
|
||||
/// Finds the RadialMenuItem based upon the given item Text.
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
/// <param name="text"></param>
|
||||
/// <returns>RadialMenuItem or null</returns>
|
||||
public RadialMenuItem FindItemByText(SubItemsCollection items, string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return (null);
|
||||
|
||||
foreach (RadialMenuItem item in items)
|
||||
{
|
||||
if (item.Text.Equals(text))
|
||||
return (item);
|
||||
|
||||
if (item.SubItems.Count > 0)
|
||||
{
|
||||
RadialMenuItem item2 = FindItemByText(item.SubItems, text);
|
||||
|
||||
if (item2 != null)
|
||||
return (item2);
|
||||
}
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.NonModal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get { return (Text); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Text); }
|
||||
set { Text = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public virtual bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Text = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(Size.Empty);
|
||||
|
||||
int n = Dpi.Width(CenterButtonDiameter);
|
||||
|
||||
if (n > size.Width)
|
||||
size.Width = n;
|
||||
|
||||
n = Dpi.Height(CenterButtonDiameter);
|
||||
|
||||
if (n > size.Height)
|
||||
size.Height = n;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
OnKeyDown(e);
|
||||
OnKeyUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
Point pt = _Cell.SuperGrid.PointToClient(MousePosition);
|
||||
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
if (_Cell != null)
|
||||
{
|
||||
Refresh();
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,506 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridRatingStarEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridRatingStarEditControl : RatingStar, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnRatingChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnRatingChanged
|
||||
/// </summary>
|
||||
/// <param name="eventArgs"></param>
|
||||
protected override void OnRatingChanged(EventArgs eventArgs)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
{
|
||||
_Cell.Value = Rating;
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
|
||||
base.OnRatingChanged(eventArgs);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaint
|
||||
|
||||
/// <summary>
|
||||
/// OnPaint
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
|
||||
PaintControl(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual int GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToInt32(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get { return (Text); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Rating); }
|
||||
set { Rating = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Rating = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
GetPreferredSize(constraintSize);
|
||||
|
||||
return (CalcSize);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Add:
|
||||
Rating += 1;
|
||||
break;
|
||||
|
||||
case Keys.Subtract:
|
||||
Rating -= 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Add:
|
||||
case Keys.Subtract:
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
|
||||
OnClick(EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,510 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridSliderEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridSliderEditControl : Slider, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.HorizontalOnly;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnValueChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnValueChanged(EventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
{
|
||||
_Cell.Value = Value;
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
|
||||
base.OnValueChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaint
|
||||
|
||||
/// <summary>
|
||||
/// OnPaint
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
|
||||
PaintControl(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual int GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToInt32(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get { return (Text); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Value); }
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Value = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
if (constraintSize.Width == 0)
|
||||
size.Width = Dpi.Width80;
|
||||
|
||||
if (constraintSize.Height == 0)
|
||||
size.Height = Dpi.Height20;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Add:
|
||||
Value += Step;
|
||||
break;
|
||||
|
||||
case Keys.Subtract:
|
||||
Value -= Step;
|
||||
break;
|
||||
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Add:
|
||||
case Keys.Subtract:
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,593 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridSwitchButtonEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridSwitchButtonEditControl : SwitchButton, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private object _OnValue;
|
||||
private object _OffValue;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.Both;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridSwitchButtonEditControl
|
||||
///</summary>
|
||||
public GridSwitchButtonEditControl()
|
||||
{
|
||||
FocusCuesEnabled = false;
|
||||
Style = eDotNetBarStyle.StyleManagerControlled;
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region OnValue
|
||||
|
||||
///<summary>
|
||||
/// OnValue
|
||||
///</summary>
|
||||
public object OnValue
|
||||
{
|
||||
get { return (_OnValue); }
|
||||
set { _OnValue = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OffValue
|
||||
|
||||
///<summary>
|
||||
/// OffValue
|
||||
///</summary>
|
||||
public object OffValue
|
||||
{
|
||||
get { return (_OffValue); }
|
||||
set { _OffValue = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnValueChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnValueChanged(EventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
{
|
||||
_Cell.UpdateCellValue(this);
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
|
||||
base.OnValueChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
///<exception cref="Exception"></exception>
|
||||
public virtual bool GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
Type type = value.GetType();
|
||||
|
||||
if (_OnValue != null)
|
||||
{
|
||||
if (value.Equals(_OnValue))
|
||||
return (true);
|
||||
}
|
||||
|
||||
if (_OffValue != null)
|
||||
{
|
||||
if (value.Equals(_OffValue))
|
||||
return (false);
|
||||
}
|
||||
|
||||
if (type == typeof(bool))
|
||||
return ((bool)value);
|
||||
|
||||
if (type == typeof(string))
|
||||
{
|
||||
string s = ((string)value).ToLower();
|
||||
|
||||
if (s.Equals("true") || s.Equals("yes") || s.Equals("1"))
|
||||
return (true);
|
||||
|
||||
if (s.Equals("false") || s.Equals("no") || s.Equals("0"))
|
||||
return (false);
|
||||
}
|
||||
else if (type == typeof(SqlBoolean))
|
||||
{
|
||||
SqlBoolean sb = (SqlBoolean)value;
|
||||
|
||||
if (sb.IsNull == true)
|
||||
return (false);
|
||||
|
||||
return (sb.IsTrue);
|
||||
}
|
||||
else if (type == typeof(char))
|
||||
{
|
||||
char c = (char)value;
|
||||
|
||||
switch (Char.ToLower(c))
|
||||
{
|
||||
case 't':
|
||||
case 'y':
|
||||
case '1':
|
||||
return (true);
|
||||
|
||||
case 'f':
|
||||
case 'n':
|
||||
case '0':
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int n = Convert.ToInt32(value);
|
||||
|
||||
return (n == 0 ? false : true);
|
||||
}
|
||||
|
||||
throw new Exception("Invalid checkBox cell value (" + value + ").");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.InPlace); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null)
|
||||
{
|
||||
if (_Cell.Value == null || _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (_Cell.Value.ToString());
|
||||
}
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Value); }
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(bool)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
Font = style.Font;
|
||||
ForeColor = style.TextColor;
|
||||
}
|
||||
|
||||
Value = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
size.Width += Dpi.Width4;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
OnKeyDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
OnMouseEnter(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
|
||||
CancelAnimation();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,577 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridTextBoxDropDownControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridTextBoxDropDownEditControl : TextBoxDropDown, IGridCellEditControl
|
||||
{
|
||||
#region DllImports / delegates
|
||||
|
||||
private delegate bool EnumThreadWndProc(IntPtr hWnd, IntPtr lp);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool IsWindowVisible(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool EnumThreadWindows(int tid, EnumThreadWndProc callback, IntPtr lp);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int GetClassName(IntPtr hWnd, StringBuilder buffer, int buflen);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern int GetCurrentThreadId();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
private bool _AutoSuggestDropdownOpen;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridTextBoxDropDownEditControl
|
||||
///</summary>
|
||||
public GridTextBoxDropDownEditControl()
|
||||
{
|
||||
BackgroundStyle.Class = "TextBoxBorder";
|
||||
Style = eDotNetBarStyle.StyleManagerControlled;
|
||||
}
|
||||
|
||||
#region OnTextChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnTextChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
base.OnTextChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual string GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return ("");
|
||||
}
|
||||
|
||||
if (_Cell.IsValueExpression == true)
|
||||
value = _Cell.GetExpValue((string)value);
|
||||
|
||||
return (Convert.ToString(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return (Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Text); }
|
||||
set { Text = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
ForeColor = style.TextColor;
|
||||
Font = style.Font;
|
||||
|
||||
SetTextAlign(style);
|
||||
}
|
||||
|
||||
Text = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#region SetTextAlign
|
||||
|
||||
private void SetTextAlign(CellVisualStyle style)
|
||||
{
|
||||
switch (style.Alignment)
|
||||
{
|
||||
case Alignment.TopLeft:
|
||||
case Alignment.MiddleLeft:
|
||||
case Alignment.BottomLeft:
|
||||
TextAlign = HorizontalAlignment.Left;
|
||||
break;
|
||||
|
||||
case Alignment.TopCenter:
|
||||
case Alignment.MiddleCenter:
|
||||
case Alignment.BottomCenter:
|
||||
TextAlign = HorizontalAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
case Alignment.MiddleRight:
|
||||
case Alignment.BottomRight:
|
||||
TextAlign = HorizontalAlignment.Right;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
Show();
|
||||
Focus();
|
||||
|
||||
if (selectAll == true)
|
||||
SelectAll();
|
||||
else
|
||||
Select(Text.Length, 1);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
CloseDropDown();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
CloseDropDown();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
// Let the TextBox handle the following keys
|
||||
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
case Keys.Home:
|
||||
case Keys.End:
|
||||
return (true);
|
||||
|
||||
case Keys.Down:
|
||||
case Keys.Up:
|
||||
if (IsAutoSuggestDropdownOpen())
|
||||
return (true);
|
||||
|
||||
return (gridWantsKey == false);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#region IsAutoSuggestDropdownOpen
|
||||
|
||||
private bool IsAutoSuggestDropdownOpen()
|
||||
{
|
||||
_AutoSuggestDropdownOpen = false;
|
||||
|
||||
if (AutoCompleteMode == AutoCompleteMode.Suggest ||
|
||||
AutoCompleteMode == AutoCompleteMode.SuggestAppend)
|
||||
{
|
||||
EnumThreadWndProc callback = CheckWindow;
|
||||
EnumThreadWindows(GetCurrentThreadId(), callback, IntPtr.Zero);
|
||||
}
|
||||
|
||||
return (_AutoSuggestDropdownOpen);
|
||||
}
|
||||
|
||||
#region CheckWindow
|
||||
|
||||
private bool CheckWindow(IntPtr hWnd, IntPtr lp)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(260);
|
||||
GetClassName(hWnd, sb, sb.Capacity);
|
||||
|
||||
if (sb.ToString() == "Auto-Suggest Dropdown")
|
||||
{
|
||||
_AutoSuggestDropdownOpen = IsWindowVisible(hWnd);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,587 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridTextBoxEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridTextBoxXEditControl : TextBoxX, IGridCellEditControl
|
||||
{
|
||||
///<summary>
|
||||
/// GridTextBoxXEditControl
|
||||
///</summary>
|
||||
public GridTextBoxXEditControl()
|
||||
{
|
||||
Multiline = true;
|
||||
}
|
||||
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.None;
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnTextChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnTextChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
if (_SuspendUpdate == false)
|
||||
_Cell.EditorValueChanged(this);
|
||||
|
||||
base.OnTextChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaintBackground
|
||||
|
||||
/// <summary>
|
||||
/// OnPaintBackground
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
_Cell.PaintEditorBackground(e, this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual string GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return ("");
|
||||
}
|
||||
|
||||
if (value is SqlString)
|
||||
{
|
||||
SqlString sdt = (SqlString) value;
|
||||
|
||||
if (sdt.IsNull == true)
|
||||
return ("");
|
||||
|
||||
return (sdt.Value);
|
||||
}
|
||||
|
||||
return (Convert.ToString(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.Modal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Cell != null && _Cell.IsValueNull == true)
|
||||
return (_Cell.NullString);
|
||||
|
||||
return ((PasswordChar == '\0')
|
||||
? Text : new string(PasswordChar, TextLength));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (Text); }
|
||||
set { Text = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((Multiline == true)
|
||||
? StretchBehavior.VerticalOnly : StretchBehavior.None );
|
||||
}
|
||||
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateLayout); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
Enabled = (_Cell.ReadOnly == false);
|
||||
WordWrap = (style.AllowWrap == Tbool.True);
|
||||
ForeColor = style.TextColor;
|
||||
Font = style.Font;
|
||||
Multiline = WordWrap;
|
||||
}
|
||||
|
||||
Text = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#region SetTextAlign
|
||||
|
||||
private void SetTextAlign(CellVisualStyle style)
|
||||
{
|
||||
switch (style.Alignment)
|
||||
{
|
||||
case Alignment.TopLeft:
|
||||
case Alignment.MiddleLeft:
|
||||
case Alignment.BottomLeft:
|
||||
TextAlign = HorizontalAlignment.Left;
|
||||
break;
|
||||
|
||||
case Alignment.TopCenter:
|
||||
case Alignment.MiddleCenter:
|
||||
case Alignment.BottomCenter:
|
||||
TextAlign = HorizontalAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
case Alignment.MiddleRight:
|
||||
case Alignment.BottomRight:
|
||||
TextAlign = HorizontalAlignment.Right;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
eTextFormat tf = style.GetTextFormatFlags();
|
||||
|
||||
string s = String.IsNullOrEmpty(Text) ? " " : Text;
|
||||
|
||||
SetTextAlign(style);
|
||||
|
||||
Size size = (constraintSize.IsEmpty == true)
|
||||
? TextHelper.MeasureText(g, s, style.Font, new Size(10000, 0), tf)
|
||||
: TextHelper.MeasureText(g, s, style.Font, constraintSize, tf);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
if (selectAll == true)
|
||||
SelectAll();
|
||||
else
|
||||
Select(Text.Length, 1);
|
||||
|
||||
Show();
|
||||
Focus();
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
// Let the TextBox handle the following keys
|
||||
|
||||
if (Multiline == true)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Up:
|
||||
if (GetLineFromCharIndex(SelectionStart) != 0)
|
||||
return (true);
|
||||
break;
|
||||
|
||||
case Keys.Down:
|
||||
int lastLine = GetLineFromCharIndex(int.MaxValue);
|
||||
|
||||
if (GetLineFromCharIndex(SelectionStart) < lastLine)
|
||||
return (true);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (AcceptsReturn == true)
|
||||
return (true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Left:
|
||||
case Keys.Right:
|
||||
case Keys.Home:
|
||||
case Keys.End:
|
||||
return (true);
|
||||
|
||||
case Keys.Tab:
|
||||
if (AcceptsTab == true)
|
||||
return (true);
|
||||
break;
|
||||
}
|
||||
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
/// <param name="disposing"></param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,500 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridButtXEditControl
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public class GridTrackBarEditControl : TrackBar, IGridCellEditControl
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private GridCell _Cell;
|
||||
private EditorPanel _EditorPanel;
|
||||
private Bitmap _EditorCellBitmap;
|
||||
|
||||
private bool _ValueChanged;
|
||||
private bool _SuspendUpdate;
|
||||
|
||||
private StretchBehavior _StretchBehavior = StretchBehavior.Both;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// GridTrackBarEditControl
|
||||
///</summary>
|
||||
public GridTrackBarEditControl()
|
||||
{
|
||||
AutoSize = false;
|
||||
Maximum = 100;
|
||||
TickFrequency = 10;
|
||||
}
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// OnValueChanged
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnValueChanged(EventArgs e)
|
||||
{
|
||||
if (_Cell != null && _SuspendUpdate == false)
|
||||
{
|
||||
_Cell.Value = Value;
|
||||
_Cell.EditorValueChanged(this);
|
||||
}
|
||||
|
||||
base.OnValueChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInvalidated
|
||||
|
||||
/// <summary>
|
||||
/// OnInvalidated
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInvalidated(InvalidateEventArgs e)
|
||||
{
|
||||
base.OnInvalidated(e);
|
||||
|
||||
if (_SuspendUpdate == false)
|
||||
_Cell.InvalidateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetValue
|
||||
|
||||
///<summary>
|
||||
/// GetValue
|
||||
///</summary>
|
||||
///<param name="value"></param>
|
||||
///<returns></returns>
|
||||
public virtual int GetValue(object value)
|
||||
{
|
||||
GridPanel panel = _Cell.GridPanel;
|
||||
|
||||
if (value == null ||
|
||||
(panel.NullValue == NullValue.DBNull && value == DBNull.Value))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (Convert.ToInt32(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditControl Members
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
/// <summary>
|
||||
/// CanInterrupt
|
||||
/// </summary>
|
||||
public bool CanInterrupt
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
/// <summary>
|
||||
/// CellEditMode
|
||||
/// </summary>
|
||||
public CellEditMode CellEditMode
|
||||
{
|
||||
get { return (CellEditMode.NonModal); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
/// <summary>
|
||||
/// EditorCell
|
||||
/// </summary>
|
||||
public GridCell EditorCell
|
||||
{
|
||||
get { return (_Cell); }
|
||||
set { _Cell = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// EditorCellBitmap
|
||||
///</summary>
|
||||
public Bitmap EditorCellBitmap
|
||||
{
|
||||
get { return (_EditorCellBitmap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EditorCellBitmap != null)
|
||||
_EditorCellBitmap.Dispose();
|
||||
|
||||
_EditorCellBitmap = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// EditorFormattedValue
|
||||
///</summary>
|
||||
public virtual string EditorFormattedValue
|
||||
{
|
||||
get { return (Text); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
/// <summary>
|
||||
/// EditorPanel
|
||||
/// </summary>
|
||||
public EditorPanel EditorPanel
|
||||
{
|
||||
get { return (_EditorPanel); }
|
||||
set { _EditorPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
/// <summary>
|
||||
/// EditorValue
|
||||
/// </summary>
|
||||
public virtual object EditorValue
|
||||
{
|
||||
get { return (_Cell.Value); }
|
||||
set { Value = GetValue(value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// EditorValueChanged
|
||||
/// </summary>
|
||||
public virtual bool EditorValueChanged
|
||||
{
|
||||
get { return (_ValueChanged); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueChanged != value)
|
||||
{
|
||||
_ValueChanged = value;
|
||||
|
||||
if (value == true)
|
||||
_Cell.SetEditorDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// EditorValueType
|
||||
///</summary>
|
||||
public virtual Type EditorValueType
|
||||
{
|
||||
get { return (typeof(string)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// StretchBehavior
|
||||
/// </summary>
|
||||
public virtual StretchBehavior StretchBehavior
|
||||
{
|
||||
get { return (_StretchBehavior); }
|
||||
set { _StretchBehavior = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
/// <summary>
|
||||
/// SuspendUpdate
|
||||
/// </summary>
|
||||
public bool SuspendUpdate
|
||||
{
|
||||
get { return (_SuspendUpdate); }
|
||||
set { _SuspendUpdate = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// ValueChangeBehavior
|
||||
/// </summary>
|
||||
public virtual ValueChangeBehavior ValueChangeBehavior
|
||||
{
|
||||
get { return (ValueChangeBehavior.InvalidateRender); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// InitializeContext
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
public virtual void InitializeContext(GridCell cell, CellVisualStyle style)
|
||||
{
|
||||
_Cell = cell;
|
||||
|
||||
if (style != null)
|
||||
Enabled = (_Cell.IsReadOnly == false);
|
||||
|
||||
Value = GetValue(_Cell.Value);
|
||||
|
||||
_ValueChanged = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// GetProposedSize
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
///<param name="constraintSize"></param>
|
||||
///<returns></returns>
|
||||
public virtual Size GetProposedSize(Graphics g,
|
||||
GridCell cell, CellVisualStyle style, Size constraintSize)
|
||||
{
|
||||
_SuspendUpdate = true;
|
||||
|
||||
Rectangle r = Bounds;
|
||||
|
||||
AutoSize = true;
|
||||
Size size = GetPreferredSize(constraintSize);
|
||||
AutoSize = false;
|
||||
|
||||
Bounds = r;
|
||||
|
||||
_SuspendUpdate = false;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
/// <summary>
|
||||
/// BeginEdit
|
||||
/// </summary>
|
||||
/// <param name="selectAll"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool BeginEdit(bool selectAll)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
/// <summary>
|
||||
/// EndEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool EndEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
/// <summary>
|
||||
/// CancelEdit
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool CancelEdit()
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
/// <summary>
|
||||
/// CellRender
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void CellRender(Graphics g)
|
||||
{
|
||||
_Cell.CellRender(this, g);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keyboard support
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// CellKeyDown
|
||||
///</summary>
|
||||
public virtual void CellKeyDown(KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Add:
|
||||
Value += SmallChange;
|
||||
break;
|
||||
|
||||
case Keys.Subtract:
|
||||
Value -= SmallChange;
|
||||
break;
|
||||
|
||||
default:
|
||||
OnKeyDown(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
/// <summary>
|
||||
/// WantsInputKey
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="gridWantsKey"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool WantsInputKey(Keys key, bool gridWantsKey)
|
||||
{
|
||||
switch (key & Keys.KeyCode)
|
||||
{
|
||||
case Keys.Add:
|
||||
case Keys.Subtract:
|
||||
case Keys.Space:
|
||||
return (true);
|
||||
|
||||
default:
|
||||
return (gridWantsKey == false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseMove
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseMove(MouseEventArgs e)
|
||||
{
|
||||
OnMouseMove(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseEnter
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseEnter(EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseLeave
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseLeave(EventArgs e)
|
||||
{
|
||||
OnMouseLeave(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseUp
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseUp(MouseEventArgs e)
|
||||
{
|
||||
OnMouseUp(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
///<summary>
|
||||
/// OnCellMouseDown
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
public virtual void OnCellMouseDown(MouseEventArgs e)
|
||||
{
|
||||
OnMouseDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,466 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// IGridCellEditControl
|
||||
///</summary>
|
||||
public interface IGridCellEditControl
|
||||
{
|
||||
#region Properties
|
||||
|
||||
#region CanInterrupt
|
||||
|
||||
///<summary>
|
||||
/// Specifies whether the Grid can automatically interrupt the
|
||||
/// current NonModal cell edit operation when the mouse leaves the cell.
|
||||
///
|
||||
/// This is utilized in cases, such as the ButtonX editor, where multilevel
|
||||
/// controls may be involved. In the ButtonX case this specifically enables
|
||||
/// the mouse to to leave the main cell window and not be interrupted by the
|
||||
/// grid until the current operation is complete by the editor itself.
|
||||
///
|
||||
///</summary>
|
||||
bool CanInterrupt { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
///<summary>
|
||||
/// Specifies the cell editor activation mode. There are three modes
|
||||
/// available for choice, and their usage depends upon the desired
|
||||
/// editor presentation, as well as how well the given underlying
|
||||
/// control interacts with the grid control.
|
||||
///
|
||||
/// The modes are as follows:
|
||||
///
|
||||
/// InPlace:
|
||||
/// Edit operations occur 'in place', always live, always
|
||||
/// in a state of interaction with the user. The CheckBoxEx,
|
||||
/// and ButtonX editors are examples of this.
|
||||
///
|
||||
/// Modal:
|
||||
/// Edit operations will be performed as a modal, widowed edit
|
||||
/// controlled via calls to BeginEdit, EndEdit, and CancelEdit.
|
||||
/// The TextBoxEx and IntegerInput editors are examples of this.
|
||||
///
|
||||
/// NonModal:
|
||||
/// Edit operation will be performed as a nonNodal, windowed edit
|
||||
/// automatically invoked upon entry to the cell. The ButtonEx,
|
||||
/// BubbleBar, and TrackBar are examples of this.
|
||||
///
|
||||
///</summary>
|
||||
CellEditMode CellEditMode { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCell
|
||||
|
||||
///<summary>
|
||||
/// Specifies the editor's current associated grid cell
|
||||
///</summary>
|
||||
GridCell EditorCell { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorCellBitmap
|
||||
|
||||
///<summary>
|
||||
/// Called to get or set the editor's
|
||||
/// associated cell bitmap (internal use only)
|
||||
///</summary>
|
||||
Bitmap EditorCellBitmap { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorFormattedValue
|
||||
|
||||
///<summary>
|
||||
/// Called to get the formatted editor value
|
||||
///</summary>
|
||||
string EditorFormattedValue { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorPanel
|
||||
|
||||
///<summary>
|
||||
/// Called to get or set the editor's
|
||||
/// associated cell panel (internal use only)
|
||||
///</summary>
|
||||
EditorPanel EditorPanel { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValue
|
||||
|
||||
///<summary>
|
||||
/// Called to get or set the editor value
|
||||
///</summary>
|
||||
object EditorValue { get; set;}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueChanged
|
||||
|
||||
///<summary>
|
||||
/// Called to get or set whether the editor value has changed
|
||||
///</summary>
|
||||
bool EditorValueChanged { get; set;}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditorValueType
|
||||
|
||||
///<summary>
|
||||
/// Called to get the editor's default value data type
|
||||
///</summary>
|
||||
Type EditorValueType { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
///<summary>
|
||||
/// Called to get the editor's desired 'stretch' behavior.
|
||||
///
|
||||
/// The StretchBehavior defines whether the editor wants to
|
||||
/// automatically have it's size stretched to fill the given cell.
|
||||
///
|
||||
/// Editors, such as ButtonX, want to fill the cell horizontally and
|
||||
/// vertically, whereas other editors, such as the Slider, may only
|
||||
/// want to stretch horizontally (or potentially not at all).
|
||||
///</summary>
|
||||
StretchBehavior StretchBehavior { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuspendUpdate
|
||||
|
||||
///<summary>
|
||||
/// Called to get or set whether updates to the grid
|
||||
/// state is suspended
|
||||
///</summary>
|
||||
bool SuspendUpdate { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
///<summary>
|
||||
/// Called to get the behavior
|
||||
/// needed when a value changes in the editor.
|
||||
///
|
||||
/// For instance, CheckBoxEx value changes result in only requiring
|
||||
/// the cell to be redisplayed with the new state, whereas editors such
|
||||
/// as the TextBoxEx editor, may result in a new layout when the text changes.
|
||||
///
|
||||
///</summary>
|
||||
ValueChangeBehavior ValueChangeBehavior { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellRender
|
||||
|
||||
///<summary>
|
||||
/// Called to initiate the actual rendering of the editor
|
||||
/// value into the grid cell. In most cases this can be (and is)
|
||||
/// handled by a simple call to EditorCell.CellRender(this, graphics).
|
||||
/// If additional rendering is required by the editor, then the editor
|
||||
/// can completely render the cell contents itself (and never even call
|
||||
/// Editor.CellRender) or optionally perform additional rendering before
|
||||
/// or after the default cell rendering.
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
void CellRender(Graphics g);
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellKeyDown
|
||||
|
||||
///<summary>
|
||||
/// Called when a KeyDown occurs and the
|
||||
/// CellEditMode is InPlace (otherwise the key event is
|
||||
/// automatically directed straight to the editor control).
|
||||
///
|
||||
///</summary>
|
||||
void CellKeyDown(KeyEventArgs e);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Edit support
|
||||
|
||||
#region BeginEdit
|
||||
|
||||
///<summary>
|
||||
/// Called when a Modal cell edit is about to be initiated.
|
||||
///</summary>
|
||||
///<param name="selectAll">Signifies whether to select all editable content</param>
|
||||
///<returns>true to cancel the edit operation</returns>
|
||||
bool BeginEdit(bool selectAll);
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndEdit
|
||||
|
||||
///<summary>
|
||||
/// Called when the edit operation is about to end.
|
||||
///</summary>
|
||||
///<returns>true to cancel the operation.</returns>
|
||||
bool EndEdit();
|
||||
|
||||
#endregion
|
||||
|
||||
#region CancelEdit
|
||||
|
||||
///<summary>
|
||||
/// Called when the edit operation is being cancelled.
|
||||
///</summary>
|
||||
///<returns>true to cancel the operation.</returns>
|
||||
bool CancelEdit();
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProposedSize
|
||||
|
||||
///<summary>
|
||||
/// Called to retrieve the editors proposed size
|
||||
/// for the given cell, using the provided effective
|
||||
/// style and size constraint.
|
||||
///</summary>
|
||||
///<param name="g">Graphics object</param>
|
||||
///<param name="cell">Associated grid cell</param>
|
||||
///<param name="style">Cell's effective style</param>
|
||||
///<param name="constraintSize">The constraining cell size</param>
|
||||
///<returns></returns>
|
||||
Size GetProposedSize(Graphics g, GridCell cell, CellVisualStyle style, Size constraintSize);
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeContext
|
||||
|
||||
///<summary>
|
||||
/// Called to initialize the editor's context
|
||||
/// environment (value, properties, style, etc)
|
||||
///</summary>
|
||||
///<param name="cell"></param>
|
||||
///<param name="style"></param>
|
||||
void InitializeContext(GridCell cell, CellVisualStyle style);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region OnCellMouseMove
|
||||
|
||||
///<summary>
|
||||
/// Called when a MouseMove event occurs and the
|
||||
/// CellEditMode is InPlace (otherwise the event is
|
||||
/// automatically directed straight to the editor control).
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
void OnCellMouseMove(MouseEventArgs e);
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseEnter
|
||||
|
||||
/// <summary>
|
||||
/// Called when a MouseEnter event occurs and the
|
||||
/// CellEditMode is InPlace (otherwise the event is
|
||||
/// automatically directed straight to the editor control).
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
void OnCellMouseEnter(EventArgs e);
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseLeave
|
||||
|
||||
///<summary>
|
||||
/// Called when a MouseLeave event occurs and the
|
||||
/// CellEditMode is InPlace (otherwise the event is
|
||||
/// automatically directed straight to the editor control).
|
||||
///</summary>
|
||||
///<param name="e"></param>
|
||||
void OnCellMouseLeave(EventArgs e);
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseUp
|
||||
|
||||
/// <summary>
|
||||
/// Called when a MouseUp event occurs and the
|
||||
/// CellEditMode is InPlace (otherwise the event is
|
||||
/// automatically directed straight to the editor control).
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
void OnCellMouseUp(MouseEventArgs e);
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCellMouseDown
|
||||
|
||||
/// <summary>
|
||||
/// Called when a MouseDown event occurs and the
|
||||
/// CellEditMode is InPlace (otherwise the event is
|
||||
/// automatically directed straight to the editor control).
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
void OnCellMouseDown(MouseEventArgs e);
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region WantsInputKey
|
||||
|
||||
///<summary>
|
||||
/// Called to determine if the editor wants to process and
|
||||
/// handle the given key
|
||||
///</summary>
|
||||
///<param name="key">Key in question</param>
|
||||
///<param name="gridWantsKey">Whether the grid, by default, wants the key</param>
|
||||
///<returns>true is the control wants the key</returns>
|
||||
bool WantsInputKey(Keys key, bool gridWantsKey);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region IGridCellConvertTo
|
||||
|
||||
///<summary>
|
||||
///IGridCellConvertTo
|
||||
///</summary>
|
||||
public interface IGridCellConvertTo
|
||||
{
|
||||
///<summary>
|
||||
///TryConvertTo
|
||||
///</summary>
|
||||
///<param name="value">Value to convert</param>
|
||||
///<param name="dataType">Data type to convert to</param>
|
||||
///<param name="result">Converted value</param>
|
||||
///<returns></returns>
|
||||
bool TryConvertTo(object value, Type dataType, out object result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IGridCellEditorFocus
|
||||
|
||||
///<summary>
|
||||
///IGridCellEditorFocus
|
||||
///</summary>
|
||||
public interface IGridCellEditorFocus
|
||||
{
|
||||
///<summary>
|
||||
///Indicates whether the editor has the input focus
|
||||
///</summary>
|
||||
///<returns></returns>
|
||||
bool IsEditorFocused { get; }
|
||||
|
||||
///<summary>
|
||||
///Gives the editor the input focus
|
||||
///</summary>
|
||||
void FocusEditor();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region enums
|
||||
|
||||
#region CellEditMode
|
||||
|
||||
///<summary>
|
||||
/// Specifies the mode of cell editor activation
|
||||
///</summary>
|
||||
public enum CellEditMode
|
||||
{
|
||||
///<summary>
|
||||
/// Edit operation will be performed as a modal, widowed
|
||||
/// edit controlled via BeginEdit, EndEdit, and CancelEdit.
|
||||
///</summary>
|
||||
Modal,
|
||||
|
||||
///<summary>
|
||||
/// Edit operation will be performed as a nonNodal, windowed
|
||||
/// edit automatically invoked upon entry to the cell.
|
||||
///</summary>
|
||||
NonModal,
|
||||
|
||||
///<summary>
|
||||
/// Edit operation will be performed in-place, as a non-windowed
|
||||
/// edit automatically invoked upon entry to the cell.
|
||||
///</summary>
|
||||
InPlace,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StretchBehavior
|
||||
|
||||
/// <summary>
|
||||
/// Defines how the editor is stretched to
|
||||
/// have it's size fill the given cell.
|
||||
/// </summary>
|
||||
public enum StretchBehavior
|
||||
{
|
||||
///<summary>
|
||||
/// No stretching to fill the cell
|
||||
///</summary>
|
||||
None,
|
||||
|
||||
///<summary>
|
||||
/// Auto stretch horizontally only
|
||||
///</summary>
|
||||
HorizontalOnly,
|
||||
|
||||
///<summary>
|
||||
/// Auto stretch vertically only
|
||||
///</summary>
|
||||
VerticalOnly,
|
||||
|
||||
///<summary>
|
||||
/// Auto stretch both horizontally and vertically
|
||||
///</summary>
|
||||
Both,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueChangeBehavior
|
||||
|
||||
/// <summary>
|
||||
/// Defines how the grid should respond to
|
||||
/// editor content / value changes
|
||||
/// </summary>
|
||||
public enum ValueChangeBehavior
|
||||
{
|
||||
///<summary>
|
||||
/// No action needed
|
||||
///</summary>
|
||||
None,
|
||||
|
||||
///<summary>
|
||||
/// Grid layout needs invalidated
|
||||
///</summary>
|
||||
InvalidateLayout,
|
||||
|
||||
///<summary>
|
||||
/// Cell needs rendered
|
||||
///</summary>
|
||||
InvalidateRender,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
43
PROMS/DotNetBar Source Code/DevComponents.DotNetBar.SuperGrid/SuperGrid/CellInfoWindow.Designer.cs
generated
Normal file
@@ -0,0 +1,43 @@
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
partial class CellInfoWindow
|
||||
{
|
||||
/// <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 Windows Form 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()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// CellInfoWindow
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(16, 16);
|
||||
this.Name = "CellInfoWindow";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
public partial class CellInfoWindow : FloatWindow
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private SuperGridControl _SuperGrid;
|
||||
private GridCell _Cell;
|
||||
|
||||
private System.Windows.Forms.ToolTip _ToolTip;
|
||||
|
||||
#endregion
|
||||
|
||||
public CellInfoWindow(SuperGridControl superGrid, GridCell cell)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Image image = cell.GetInfoImage();
|
||||
|
||||
if (image != null)
|
||||
Size = image.Size;
|
||||
|
||||
TopLevel = false;
|
||||
|
||||
_SuperGrid = superGrid;
|
||||
_Cell = cell;
|
||||
|
||||
_ToolTip = new System.Windows.Forms.ToolTip();
|
||||
|
||||
using (GraphicsPath path = GetImageGraphicsPath())
|
||||
Region = new Region(path);
|
||||
|
||||
Paint += CellInfoWindowPaint;
|
||||
MouseClick += CellInfoWindowMouseClick;
|
||||
MouseDoubleClick += CellInfoWindowMouseDoubleClick;
|
||||
|
||||
MouseEnter += CellInfoWindowMouseEnter;
|
||||
MouseLeave += CellInfoWindowMouseLeave;
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region ToolTip
|
||||
|
||||
public System.Windows.Forms.ToolTip ToolTip
|
||||
{
|
||||
get { return (_ToolTip); }
|
||||
internal set { _ToolTip = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellInfoWindowMouseEnter
|
||||
|
||||
void CellInfoWindowMouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
if (_SuperGrid.DoCellInfoEnterEvent(_Cell, this, _ToolTip, MousePosition) == false)
|
||||
_ToolTip.SetToolTip(this, _Cell.InfoText);
|
||||
else
|
||||
_ToolTip.SetToolTip(this, "");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellInfoWindowMouseLeave
|
||||
|
||||
void CellInfoWindowMouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
_SuperGrid.DoCellInfoLeaveEvent(_Cell, this, _ToolTip);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetImageGraphicsPath
|
||||
|
||||
private GraphicsPath GetImageGraphicsPath()
|
||||
{
|
||||
Bitmap bitmap = new Bitmap(_Cell.GetInfoImage());
|
||||
GraphicsPath graphicsPath = new GraphicsPath();
|
||||
|
||||
Color colorTransparent = bitmap.GetPixel(0, 0);
|
||||
|
||||
for (int row = 0; row < bitmap.Height; row++)
|
||||
{
|
||||
for (int col = 0; col < bitmap.Width; col++)
|
||||
{
|
||||
if (bitmap.GetPixel(col, row) != colorTransparent)
|
||||
{
|
||||
int colOpaquePixel = col;
|
||||
int colNext;
|
||||
|
||||
for (colNext = colOpaquePixel; colNext < bitmap.Width; colNext++)
|
||||
{
|
||||
if (bitmap.GetPixel(colNext, row) == colorTransparent)
|
||||
break;
|
||||
}
|
||||
|
||||
graphicsPath.AddRectangle(new Rectangle(colOpaquePixel,
|
||||
row, colNext - colOpaquePixel, 1));
|
||||
|
||||
col = colNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (graphicsPath);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellInfoWindowPaint
|
||||
|
||||
void CellInfoWindowPaint(object sender, PaintEventArgs e)
|
||||
{
|
||||
Image image = _Cell.GetInfoImage();
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
Rectangle r = Bounds;
|
||||
r.Location = Point.Empty;
|
||||
|
||||
e.Graphics.DrawImageUnscaledAndClipped(image, r);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellInfoWindowMouseClick
|
||||
|
||||
void CellInfoWindowMouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
_SuperGrid.DoCellInfoClickEvent(_Cell, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CellInfoWindowMouseDoubleClick
|
||||
|
||||
void CellInfoWindowMouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
_SuperGrid.DoCellInfoDoubleClickEvent(_Cell, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.VisualStyles;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// CheckDisplay
|
||||
///</summary>
|
||||
static public class CheckDisplay
|
||||
{
|
||||
///<summary>
|
||||
/// RenderCheckbox
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="bounds"></param>
|
||||
///<param name="cstate"></param>
|
||||
///<param name="bstate"></param>
|
||||
static public void RenderCheckbox(
|
||||
Graphics g, Rectangle bounds, CheckBoxState cstate, ButtonState bstate)
|
||||
{
|
||||
Size csize = CheckBoxRenderer.GetGlyphSize(g, cstate);
|
||||
|
||||
if (Application.RenderWithVisualStyles == true)
|
||||
{
|
||||
Point pt = bounds.Location;
|
||||
pt.Y += (bounds.Height - csize.Height) / 2;
|
||||
|
||||
CheckBoxRenderer.DrawCheckBox(g, pt, cstate);
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlPaint.DrawCheckBox(g, bounds, bstate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// CheckDisplay
|
||||
///</summary>
|
||||
static public class ExpandDisplay
|
||||
{
|
||||
#region RenderButton
|
||||
|
||||
///<summary>
|
||||
/// RenderButton
|
||||
///</summary>
|
||||
///<param name="g"></param>
|
||||
///<param name="image"></param>
|
||||
///<param name="buttonBounds"></param>
|
||||
///<param name="clipBounds"></param>
|
||||
static public Size RenderButton(Graphics g,
|
||||
Image image, Rectangle buttonBounds, Rectangle clipBounds)
|
||||
{
|
||||
if (image != null && buttonBounds.IsEmpty == false)
|
||||
{
|
||||
Rectangle r = buttonBounds;
|
||||
r.Width++;
|
||||
r.Height++;
|
||||
|
||||
Size isize = Dpi.Size(image.Size);
|
||||
|
||||
if (r.Width > isize.Width)
|
||||
{
|
||||
r.X += (r.Width - isize.Width) / 2;
|
||||
r.Width = isize.Width;
|
||||
}
|
||||
|
||||
if (r.Height > isize.Height)
|
||||
{
|
||||
r.Y += (r.Height - isize.Height) / 2;
|
||||
r.Height = isize.Height;
|
||||
}
|
||||
|
||||
r.Intersect(clipBounds);
|
||||
|
||||
g.DrawImageUnscaledAndClipped(image, r);
|
||||
|
||||
return (r.Size);
|
||||
}
|
||||
|
||||
return (Size.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
51
PROMS/DotNetBar Source Code/DevComponents.DotNetBar.SuperGrid/SuperGrid/FloatWindow.Designer.cs
generated
Normal file
@@ -0,0 +1,51 @@
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
partial class FloatWindow
|
||||
{
|
||||
/// <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 Windows Form 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()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// FloatWindow
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CausesValidation = false;
|
||||
this.ClientSize = new System.Drawing.Size(90, 23);
|
||||
this.ControlBox = false;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FloatWindow";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// FloatWindow
|
||||
///</summary>
|
||||
public partial class FloatWindow : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public FloatWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
SetStyle(ControlStyles.Selectable, false);
|
||||
}
|
||||
|
||||
const int WS_EX_NOACTIVATE = 0x08000000;
|
||||
|
||||
/// <summary>
|
||||
/// CreateParams
|
||||
/// </summary>
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
{
|
||||
CreateParams cp = base.CreateParams;
|
||||
|
||||
cp.ExStyle |= WS_EX_NOACTIVATE;
|
||||
|
||||
return (cp);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ShowWithoutActivation
|
||||
/// </summary>
|
||||
protected override bool ShowWithoutActivation
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,106 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// GridCaption
|
||||
///</summary>
|
||||
public class GridCaption : GridTextRow
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
///<summary>
|
||||
/// GridCaption
|
||||
///</summary>
|
||||
public GridCaption()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// GridCaption
|
||||
///</summary>
|
||||
///<param name="text"></param>
|
||||
public GridCaption(string text)
|
||||
: base(text)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Hidden properties
|
||||
|
||||
#region RowHeaderVisibility
|
||||
|
||||
/// <summary>
|
||||
/// RowHeaderVisibility
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new RowHeaderVisibility RowHeaderVisibility
|
||||
{
|
||||
get { return (base.RowHeaderVisibility); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderBorder
|
||||
|
||||
/// <summary>
|
||||
/// RenderBorder
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="panel"></param>
|
||||
/// <param name="pstyle"></param>
|
||||
/// <param name="r"></param>
|
||||
protected override void RenderBorder(Graphics g,
|
||||
GridPanel panel, GridPanelVisualStyle pstyle, Rectangle r)
|
||||
{
|
||||
using (Pen pen = new Pen(pstyle.HeaderLineColor))
|
||||
{
|
||||
r.Height--;
|
||||
g.DrawLine(pen, r.X, r.Bottom, r.Right - 1, r.Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CanShowRowHeader
|
||||
|
||||
/// <summary>
|
||||
/// CanShowRowHeader
|
||||
/// </summary>
|
||||
/// <param name="panel"></param>
|
||||
/// <returns></returns>
|
||||
protected override bool CanShowRowHeader(GridPanel panel)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Style support
|
||||
|
||||
/// <summary>
|
||||
/// ApplyStyleEx
|
||||
/// </summary>
|
||||
/// <param name="style"></param>
|
||||
/// <param name="css"></param>
|
||||
protected override void ApplyStyleEx(TextRowVisualStyle style, StyleType[] css)
|
||||
{
|
||||
foreach (StyleType cs in css)
|
||||
{
|
||||
style.ApplyStyle(SuperGrid.BaseVisualStyles.CaptionStyles[cs]);
|
||||
style.ApplyStyle(SuperGrid.DefaultVisualStyles.CaptionStyles[cs]);
|
||||
style.ApplyStyle(GridPanel.DefaultVisualStyles.CaptionStyles[cs]);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
using DevComponents.DotNetBar.SuperGrid.Primitives;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the collection of grid cells.
|
||||
/// </summary>
|
||||
[Editor("DevComponents.SuperGrid.Design.GridCellCollectionEditor, DevComponents.SuperGrid.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=26d81176cfa2b486", typeof(UITypeEditor))]
|
||||
public class GridCellCollection : CustomCollection<GridCell>
|
||||
{
|
||||
#region Indexer (string)
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets item at ColumnName index
|
||||
/// </summary>
|
||||
/// <param name="columnName">Name of Column containing the cell</param>
|
||||
public GridCell this[string columnName]
|
||||
{
|
||||
get
|
||||
{
|
||||
GridCell cell = FindCellItem(columnName);
|
||||
|
||||
if (cell != null)
|
||||
return (Items[cell.ColumnIndex]);
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
GridCell cell = FindCellItem(columnName);
|
||||
|
||||
if (cell == null)
|
||||
throw new Exception("Column \"" + columnName + "\" not found.");
|
||||
|
||||
Items[cell.ColumnIndex] = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Indexer (Column)
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets item at Column index
|
||||
/// </summary>
|
||||
/// <param name="column">Column containing the cell</param>
|
||||
public GridCell this[GridColumn column]
|
||||
{
|
||||
get { return (Items[column.ColumnIndex]); }
|
||||
set { Items[column.ColumnIndex] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FindCellItem
|
||||
|
||||
private GridCell FindCellItem(string columnName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(columnName) == true)
|
||||
throw new Exception("Invalid Column Name.");
|
||||
|
||||
foreach (GridCell cell in Items)
|
||||
{
|
||||
GridColumn col = cell.GridColumn;
|
||||
|
||||
if (col == null)
|
||||
break;
|
||||
|
||||
if (columnName.Equals(col.Name) == true)
|
||||
return (cell);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,787 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the collection of grid columns
|
||||
/// </summary>
|
||||
[Editor("DevComponents.SuperGrid.Design.GridColumnCollectionEditor, DevComponents.SuperGrid.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=26d81176cfa2b486", typeof(UITypeEditor))]
|
||||
public class GridColumnCollection : CollectionBase
|
||||
{
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the collection has changed
|
||||
/// </summary>
|
||||
[Description("Occurs when collection has changed.")]
|
||||
public CollectionChangeEventHandler CollectionChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Variables
|
||||
|
||||
private GridElement _ParentItem;
|
||||
private int[] _DisplayIndexMap;
|
||||
private bool _IsDisplayIndexValid;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region FirstSelectableColumn
|
||||
|
||||
/// <summary>
|
||||
/// Gets reference to first selectable column
|
||||
/// or null if there is no first selectable column.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public GridColumn FirstSelectableColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
int[] displayMap = DisplayIndexMap;
|
||||
|
||||
for (int i = 0; i < displayMap.Length; i++)
|
||||
{
|
||||
GridColumn column = this[displayMap[i]];
|
||||
|
||||
if (column.Visible == true && column.AllowSelection == true)
|
||||
return (column);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FirstVisibleColumn
|
||||
|
||||
/// <summary>
|
||||
/// Gets reference to first visible column
|
||||
/// or null if there is no first visible column.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public GridColumn FirstVisibleColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
int[] displayMap = DisplayIndexMap;
|
||||
|
||||
for (int i = 0; i < displayMap.Length; i++)
|
||||
{
|
||||
if (this[displayMap[i]].Visible)
|
||||
return (this[displayMap[i]]);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Index indexer
|
||||
|
||||
/// <summary>
|
||||
/// Returns reference to the object in collection based on it's index.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public GridColumn this[int index]
|
||||
{
|
||||
get { return (GridColumn)(List[index]); }
|
||||
set { List[index] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Name indexer
|
||||
|
||||
///<summary>
|
||||
/// Name indexer
|
||||
///</summary>
|
||||
///<param name="name"></param>
|
||||
///<exception cref="Exception"></exception>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public GridColumn this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
int index = FindIndexByName(name);
|
||||
|
||||
return (index >= 0 ? this[index] : null);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int index = FindIndexByName(name);
|
||||
|
||||
if (index < 0)
|
||||
throw new Exception("Column Name not defined (" + name + ").");
|
||||
|
||||
List[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
#region FindIndexByName
|
||||
|
||||
private int FindIndexByName(string name)
|
||||
{
|
||||
for (int i=0; i<List.Count; i++)
|
||||
{
|
||||
GridColumn item = (GridColumn)List[i];
|
||||
|
||||
if (name != null)
|
||||
name = name.ToUpper();
|
||||
|
||||
if (item.Name != null && item.Name.ToUpper().Equals(name))
|
||||
return (i);
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region LastSelectableColumn
|
||||
|
||||
/// <summary>
|
||||
/// Gets reference to last selectable column
|
||||
/// or null if there is no last selectable column.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public GridColumn LastSelectableColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
int[] displayMap = DisplayIndexMap;
|
||||
|
||||
for (int i = displayMap.Length - 1; i >= 0; i--)
|
||||
{
|
||||
GridColumn column = this[displayMap[i]];
|
||||
|
||||
if (column.Visible == true && column.AllowSelection == true)
|
||||
return (column);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LastVisibleColumn
|
||||
|
||||
/// <summary>
|
||||
/// Gets reference to last visible column
|
||||
/// or null if there is no last visible column.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public GridColumn LastVisibleColumn
|
||||
{
|
||||
get
|
||||
{
|
||||
int[] displayMap = DisplayIndexMap;
|
||||
|
||||
for (int i = displayMap.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (this[displayMap[i]].Visible)
|
||||
return (this[displayMap[i]]);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ParentItem
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the node this collection is associated with.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public GridElement ParentItem
|
||||
{
|
||||
get { return _ParentItem; }
|
||||
|
||||
internal set
|
||||
{
|
||||
_ParentItem = value;
|
||||
|
||||
OnParentItemChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnParentItemChanged()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Add
|
||||
|
||||
/// <summary>
|
||||
/// Adds new object to the collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Object to add.</param>
|
||||
/// <returns>Index of newly added object.</returns>
|
||||
public int Add(GridColumn value)
|
||||
{
|
||||
value.ColumnIndex = List.Add(value);
|
||||
|
||||
return (value.ColumnIndex);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Insert
|
||||
|
||||
/// <summary>
|
||||
/// Inserts new object into the collection.
|
||||
/// </summary>
|
||||
/// <param name="index">Position of the object.</param>
|
||||
/// <param name="value">Object to insert.</param>
|
||||
public void Insert(int index, GridColumn value)
|
||||
{
|
||||
List.Insert(index, value);
|
||||
|
||||
for (int i = 0; i < Count; i++)
|
||||
((GridColumn)List[i]).ColumnIndex = i;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IndexOf
|
||||
|
||||
/// <summary>
|
||||
/// Returns index of the object inside of the collection.
|
||||
/// </summary>
|
||||
/// <param name="value">Reference to the object.</param>
|
||||
/// <returns>Index of the object.</returns>
|
||||
public int IndexOf(GridColumn value)
|
||||
{
|
||||
return (List.IndexOf(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Contains
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether collection contains specified object.
|
||||
/// </summary>
|
||||
/// <param name="value">Object to look for.</param>
|
||||
/// <returns>true if object is part of the collection, otherwise false.</returns>
|
||||
public bool Contains(GridColumn value)
|
||||
{
|
||||
return (List.Contains(value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether collection contains specified object.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the object to look for.</param>
|
||||
/// <returns>true if object is part of the collection, otherwise false.</returns>
|
||||
public bool Contains(string name)
|
||||
{
|
||||
foreach (GridColumn column in List)
|
||||
{
|
||||
if (column.Name.Equals(name) == true)
|
||||
return (true);
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Remove
|
||||
|
||||
/// <summary>
|
||||
/// Removes specified object from the collection.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public void Remove(GridColumn value)
|
||||
{
|
||||
List.Remove(value);
|
||||
|
||||
for (int i = 0; i < Count; i++)
|
||||
((GridColumn)List[i]).ColumnIndex = i;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnRemoveComplete
|
||||
|
||||
/// <summary>
|
||||
/// Called when remove of an item is completed.
|
||||
/// </summary>
|
||||
/// <param name="index">Index of removed item</param>
|
||||
/// <param name="value">Removed item.</param>
|
||||
protected override void OnRemoveComplete(int index, object value)
|
||||
{
|
||||
if (value is GridColumn)
|
||||
{
|
||||
GridColumn column = (GridColumn)value;
|
||||
GridPanel panel = column.GridPanel;
|
||||
|
||||
ResetColumn(panel, column);
|
||||
}
|
||||
|
||||
OnCollectionChanged(CollectionChangeAction.Remove, value);
|
||||
|
||||
base.OnRemoveComplete(index, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Clear
|
||||
|
||||
/// <summary>
|
||||
/// Clears all objects from the collection.
|
||||
/// </summary>
|
||||
public new void Clear()
|
||||
{
|
||||
foreach (GridColumn column in this)
|
||||
ResetColumn(column.GridPanel, column);
|
||||
|
||||
List.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnClearComplete
|
||||
|
||||
/// <summary>
|
||||
/// OnClearComplete
|
||||
/// </summary>
|
||||
protected override void OnClearComplete()
|
||||
{
|
||||
InvalidateDisplayIndexes();
|
||||
InvalidateLayout();
|
||||
|
||||
base.OnClearComplete();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ResetColumn
|
||||
|
||||
private void ResetColumn(GridPanel panel, GridColumn column)
|
||||
{
|
||||
column.DisplayIndexChanged -= ColumnDisplayIndexChanged;
|
||||
|
||||
if (panel.DataSource != null)
|
||||
panel.DataBinder.DataResetCount++;
|
||||
|
||||
GridCell cell = column.SuperGrid.ActiveElement as GridCell;
|
||||
|
||||
if (cell != null)
|
||||
{
|
||||
if (cell.ColumnIndex == column.ColumnIndex)
|
||||
column.SuperGrid.ActiveElement = null;
|
||||
}
|
||||
|
||||
if (panel.SortColumns.Contains(column))
|
||||
panel.SortColumns.Remove(column);
|
||||
|
||||
if (panel.GroupColumns.Contains(column))
|
||||
panel.GroupColumns.Remove(column);
|
||||
|
||||
FilterPanel fp = column.SuperGrid.ActiveFilterPanel;
|
||||
|
||||
if (fp != null && fp.GridColumn == column)
|
||||
fp.EndEdit();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnInsertComplete
|
||||
|
||||
/// <summary>
|
||||
/// Called when insertion of an item is completed.
|
||||
/// </summary>
|
||||
/// <param name="index">Insert index.</param>
|
||||
/// <param name="value">Inserted item.</param>
|
||||
protected override void OnInsertComplete(int index, object value)
|
||||
{
|
||||
if (value is GridColumn)
|
||||
{
|
||||
GridColumn column = (GridColumn)value;
|
||||
|
||||
if (column.Parent != null && column.Parent != _ParentItem)
|
||||
throw new Exception("Column is already a member of another Column collection.");
|
||||
|
||||
column.DisplayIndexChanged += ColumnDisplayIndexChanged;
|
||||
|
||||
column.Parent = _ParentItem;
|
||||
}
|
||||
|
||||
OnCollectionChanged(CollectionChangeAction.Add, value);
|
||||
|
||||
base.OnInsertComplete(index, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCollectionChanged
|
||||
|
||||
private void OnCollectionChanged(
|
||||
CollectionChangeAction action, object value)
|
||||
{
|
||||
for (int i = 0; i < Count; i++)
|
||||
((GridColumn)List[i]).ColumnIndex = i;
|
||||
|
||||
if (action == CollectionChangeAction.Remove)
|
||||
{
|
||||
GridColumn rcol = (GridColumn)value;
|
||||
GridPanel panel = rcol.GridPanel;
|
||||
|
||||
if (rcol.DisplayIndex >= 0)
|
||||
{
|
||||
foreach (GridColumn col in panel.Columns)
|
||||
{
|
||||
if (col.DisplayIndex > rcol.DisplayIndex)
|
||||
col.DisplayIndex--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InvalidateDisplayIndexes();
|
||||
InvalidateLayout();
|
||||
|
||||
if (CollectionChanged != null)
|
||||
{
|
||||
CollectionChangeEventArgs e = new
|
||||
CollectionChangeEventArgs(action, value);
|
||||
|
||||
CollectionChanged(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ColumnDisplayIndexChanged
|
||||
|
||||
private void ColumnDisplayIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
InvalidateDisplayIndexes();
|
||||
InvalidateLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InvalidateDisplayIndexes
|
||||
|
||||
/// <summary>
|
||||
/// Invalidates the display indexes and
|
||||
/// causes them to be re-evaluated on next layout.
|
||||
/// </summary>
|
||||
public void InvalidateDisplayIndexes()
|
||||
{
|
||||
_IsDisplayIndexValid = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InvalidateLayout
|
||||
|
||||
private void InvalidateLayout()
|
||||
{
|
||||
if (_ParentItem != null)
|
||||
{
|
||||
_ParentItem.InvalidateLayout();
|
||||
|
||||
if (_ParentItem.SuperGrid != null)
|
||||
{
|
||||
_ParentItem.SuperGrid.NeedMergeLayout = true;
|
||||
_ParentItem.SuperGrid.DisplayedMergeLayoutCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Copies collection into the specified array.
|
||||
/// </summary>
|
||||
/// <param name="array">Array to copy collection to.</param>
|
||||
/// <param name="index">Starting index.</param>
|
||||
public void CopyTo(GridColumn[] array, int index)
|
||||
{
|
||||
List.CopyTo(array, index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies contained items to the ColumnHeader array.
|
||||
/// </summary>
|
||||
/// <param name="array">Array to copy to.</param>
|
||||
internal void CopyTo(GridColumn[] array)
|
||||
{
|
||||
List.CopyTo(array, 0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnClear
|
||||
|
||||
/// <summary>
|
||||
/// Called when collection is cleared.
|
||||
/// </summary>
|
||||
protected override void OnClear()
|
||||
{
|
||||
if (Count > 0)
|
||||
{
|
||||
GridPanel panel = this[0].Parent as GridPanel;
|
||||
|
||||
if (panel != null)
|
||||
{
|
||||
panel.SuperGrid.ActiveElement = null;
|
||||
|
||||
foreach (GridElement item in panel.Rows)
|
||||
{
|
||||
GridRow row = item as GridRow;
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
foreach (GridCell cell in row.Cells)
|
||||
{
|
||||
cell.EditControl = null;
|
||||
cell.RenderControl = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (GridColumn item in this)
|
||||
{
|
||||
item.EditControl = null;
|
||||
item.RenderControl = null;
|
||||
}
|
||||
|
||||
base.OnClear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DisplayIndexMap
|
||||
|
||||
/// <summary>
|
||||
/// A map of display index (key) to index in the column collection
|
||||
/// (value). Used to quickly find a column from its display index.
|
||||
/// </summary>
|
||||
internal int[] DisplayIndexMap
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_IsDisplayIndexValid)
|
||||
UpdateDisplayIndexMap();
|
||||
|
||||
return (_DisplayIndexMap);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDisplayIndex
|
||||
|
||||
/// <summary>
|
||||
/// Gets the display index for specified column.
|
||||
/// </summary>
|
||||
/// <param name="column">Column that is part of ColumnHeaderCollection</param>
|
||||
/// <returns>Display index or -1 column is not part of this collection.</returns>
|
||||
public int GetDisplayIndex(GridColumn column)
|
||||
{
|
||||
return (GetDisplayIndex(IndexOf(column)));
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Gets the display index for specified column.
|
||||
///</summary>
|
||||
///<param name="index">Column index</param>
|
||||
///<returns>Display index or -1 column is not part of this collection.</returns>
|
||||
public int GetDisplayIndex(int index)
|
||||
{
|
||||
UpdateDisplayIndexMap();
|
||||
|
||||
for (int i = 0; i < _DisplayIndexMap.Length; i++)
|
||||
{
|
||||
if (_DisplayIndexMap[i] == index)
|
||||
return (i);
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ColumnAtDisplayIndex
|
||||
|
||||
/// <summary>
|
||||
/// Returns the column that is displayed at specified display index.
|
||||
/// </summary>
|
||||
/// <param name="displayIndex">0 based display index.</param>
|
||||
/// <returns>ColumnHeader</returns>
|
||||
public GridColumn ColumnAtDisplayIndex(int displayIndex)
|
||||
{
|
||||
UpdateDisplayIndexMap();
|
||||
|
||||
return (this[_DisplayIndexMap[displayIndex]]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateDisplayIndexMap
|
||||
|
||||
private void UpdateDisplayIndexMap()
|
||||
{
|
||||
if (_IsDisplayIndexValid == false)
|
||||
{
|
||||
_IsDisplayIndexValid = true;
|
||||
|
||||
_DisplayIndexMap = new int[Count];
|
||||
|
||||
for (int i = 0; i < Count; i++)
|
||||
_DisplayIndexMap[i] = -1;
|
||||
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
int di = this[i].DisplayIndex;
|
||||
|
||||
if (di != -1)
|
||||
AddIndexToMap(i, di);
|
||||
}
|
||||
|
||||
int n = 0;
|
||||
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
int di = this[i].DisplayIndex;
|
||||
|
||||
if (di == -1)
|
||||
AddIndexToMap(i, n++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddIndexToMap(int i, int di)
|
||||
{
|
||||
for (int j = 0; j < Count; j++)
|
||||
{
|
||||
int n = (di + j) % Count;
|
||||
|
||||
if (_DisplayIndexMap[n] == -1)
|
||||
{
|
||||
_DisplayIndexMap[n] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetNextVisibleColumn
|
||||
|
||||
/// <summary>
|
||||
/// Gets reference to next visible column
|
||||
/// or null if there is no next visible column
|
||||
/// </summary>
|
||||
public GridColumn GetNextVisibleColumn(GridColumn column)
|
||||
{
|
||||
return (GetNextVisibleColumn(GetDisplayIndex(column)));
|
||||
}
|
||||
|
||||
internal GridColumn GetNextVisibleColumn(int displayIndex)
|
||||
{
|
||||
int[] displayMap = DisplayIndexMap;
|
||||
|
||||
while (++displayIndex < Count)
|
||||
{
|
||||
if (this[displayMap[displayIndex]].Visible)
|
||||
return (this[displayMap[displayIndex]]);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetPrevVisibleColumn
|
||||
|
||||
/// <summary>
|
||||
/// Gets reference to previous visible column
|
||||
/// or null if there is no last visible previous column
|
||||
/// </summary>
|
||||
public GridColumn GetPrevVisibleColumn(GridColumn column)
|
||||
{
|
||||
return (GetPrevVisibleColumn(GetDisplayIndex(column)));
|
||||
}
|
||||
|
||||
internal GridColumn GetPrevVisibleColumn(int displayIndex)
|
||||
{
|
||||
int[] displayMap = DisplayIndexMap;
|
||||
|
||||
while (--displayIndex >= 0)
|
||||
{
|
||||
if (this[displayMap[displayIndex]].Visible)
|
||||
return (this[displayMap[displayIndex]]);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetLastVisibleFrozenColumn
|
||||
|
||||
/// <summary>
|
||||
/// Gets reference to the last visible frozen column
|
||||
/// or null if there is none
|
||||
/// </summary>
|
||||
public GridColumn GetLastVisibleFrozenColumn()
|
||||
{
|
||||
int[] displayMap = DisplayIndexMap;
|
||||
|
||||
if (displayMap.Length > 0)
|
||||
{
|
||||
GridPanel panel = this[displayMap[0]].GridPanel;
|
||||
|
||||
if (panel != null &&
|
||||
panel.FrozenColumnCount > 0 && panel.IsSubPanel == false)
|
||||
{
|
||||
for (int i = displayMap.Length - 1; i >= 0; i--)
|
||||
{
|
||||
GridColumn column = this[displayMap[i]];
|
||||
|
||||
if (column.Visible == true)
|
||||
{
|
||||
if (column.IsHFrozen == true)
|
||||
return (column);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
partial class CustomFilter
|
||||
{
|
||||
/// <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 Windows Form 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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CustomFilter));
|
||||
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnOk = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnApply = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnClear = new DevComponents.DotNetBar.ButtonX();
|
||||
this.lblEnterText = new DevComponents.DotNetBar.LabelX();
|
||||
this.filterExprEdit1 = new DevComponents.DotNetBar.SuperGrid.FilterExprEdit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnCancel, "btnCancel");
|
||||
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnCancel.Click += new System.EventHandler(this.BtnCancelClick);
|
||||
//
|
||||
// btnOk
|
||||
//
|
||||
this.btnOk.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnOk, "btnOk");
|
||||
this.btnOk.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.btnOk.Name = "btnOk";
|
||||
this.btnOk.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnOk.Click += new System.EventHandler(this.BtnOkClick);
|
||||
//
|
||||
// btnApply
|
||||
//
|
||||
this.btnApply.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnApply, "btnApply");
|
||||
this.btnApply.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnApply.Name = "btnApply";
|
||||
this.btnApply.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnApply.Click += new System.EventHandler(this.BtnApplyClick);
|
||||
//
|
||||
// btnClear
|
||||
//
|
||||
this.btnClear.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnClear, "btnClear");
|
||||
this.btnClear.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnClear.Name = "btnClear";
|
||||
this.btnClear.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnClear.Click += new System.EventHandler(this.BtnClearClick);
|
||||
//
|
||||
// lblEnterText
|
||||
//
|
||||
resources.ApplyResources(this.lblEnterText, "lblEnterText");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.lblEnterText.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.lblEnterText.Name = "lblEnterText";
|
||||
//
|
||||
// filterExprEdit1
|
||||
//
|
||||
resources.ApplyResources(this.filterExprEdit1, "filterExprEdit1");
|
||||
this.filterExprEdit1.Name = "filterExprEdit1";
|
||||
//
|
||||
// CustomFilter
|
||||
//
|
||||
this.AcceptButton = this.btnApply;
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.Controls.Add(this.filterExprEdit1);
|
||||
this.Controls.Add(this.lblEnterText);
|
||||
this.Controls.Add(this.btnClear);
|
||||
this.Controls.Add(this.btnApply);
|
||||
this.Controls.Add(this.btnOk);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.DoubleBuffered = true;
|
||||
this.EnableGlass = false;
|
||||
this.HelpButton = true;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CustomFilter";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.TitleText = "Custom Filter";
|
||||
this.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(this.CustomFilterHelpButtonClicked);
|
||||
this.Shown += new System.EventHandler(this.CustomFilterShown);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DevComponents.DotNetBar.ButtonX btnCancel;
|
||||
private DevComponents.DotNetBar.ButtonX btnOk;
|
||||
private ButtonX btnApply;
|
||||
private ButtonX btnClear;
|
||||
private LabelX lblEnterText;
|
||||
private FilterExprEdit filterExprEdit1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// CustomFilter
|
||||
///</summary>
|
||||
public partial class CustomFilter : Office2007Form
|
||||
{
|
||||
#region Static data
|
||||
|
||||
private static bool _localizedStringsLoaded;
|
||||
|
||||
private static string _filterClearString = "Clear";
|
||||
private static string _filterCustomFilterString = "Custom Filter";
|
||||
private static string _filterEnterExprString = "Enter custom filter expression";
|
||||
private static string _filterHelpString = "Click the Title Bar help button for syntax help";
|
||||
private static string _filterHelpTitle = "SampleExpr";
|
||||
|
||||
private static Point _offset = Point.Empty;
|
||||
private static Size _size = Size.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private GridPanel _GridPanel;
|
||||
private GridColumn _GridColumn;
|
||||
|
||||
private string _FilterExpr;
|
||||
private object _FilterValue;
|
||||
private object _FilterDisplayValue;
|
||||
|
||||
private bool _LockedResize = true;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// CustomFilter
|
||||
///</summary>
|
||||
public CustomFilter(GridPanel gridPanel, GridColumn gridColumn)
|
||||
: this(gridPanel, gridColumn, gridColumn != null ? gridColumn.FilterExpr : gridPanel.FilterExpr)
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// CustomFilter
|
||||
///</summary>
|
||||
public CustomFilter(GridPanel gridPanel, GridColumn gridColumn, string filterText)
|
||||
{
|
||||
_GridPanel = gridPanel;
|
||||
_GridColumn = gridColumn;
|
||||
|
||||
InitializeComponent();
|
||||
InitializeText();
|
||||
InitializeFilter(filterText);
|
||||
|
||||
PositionWindow(_GridPanel.SuperGrid);
|
||||
|
||||
StyleManager.UpdateAmbientColors(filterExprEdit1);
|
||||
|
||||
filterExprEdit1.RtbOutput.BackColorRichTextBox = Color.White;
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region FilterExpr
|
||||
|
||||
/// <summary>
|
||||
/// FilterExpr
|
||||
/// </summary>
|
||||
public string FilterExpr
|
||||
{
|
||||
get { return (filterExprEdit1.InputText); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Initialization
|
||||
|
||||
#region InitializeText
|
||||
|
||||
private void InitializeText()
|
||||
{
|
||||
SuperGridControl superGrid = _GridPanel.SuperGrid;
|
||||
|
||||
LoadLocalizedStrings(superGrid);
|
||||
|
||||
TitleText = _filterCustomFilterString;
|
||||
|
||||
lblEnterText.Text = _filterEnterExprString;
|
||||
|
||||
btnClear.Text = _filterClearString;
|
||||
btnApply.Text = superGrid.FilterApplyString;
|
||||
btnOk.Text = superGrid.FilterOkString;
|
||||
btnCancel.Text = superGrid.FilterCancelString;
|
||||
|
||||
if (superGrid.ShowCustomFilterHelp == true)
|
||||
filterExprEdit1.WaterMarkText = _filterHelpString;
|
||||
else
|
||||
HelpButton = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeFilter
|
||||
|
||||
private void InitializeFilter(string filterText)
|
||||
{
|
||||
if (_GridColumn != null)
|
||||
{
|
||||
_FilterExpr = _GridColumn.FilterExpr;
|
||||
_FilterValue = _GridColumn.FilterValue;
|
||||
_FilterDisplayValue = _GridColumn.FilterDisplayValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_FilterExpr = _GridPanel.FilterExpr;
|
||||
_FilterValue = null;
|
||||
_FilterDisplayValue = null;
|
||||
}
|
||||
|
||||
filterExprEdit1.GridPanel = _GridPanel;
|
||||
filterExprEdit1.GridColumn = _GridColumn;
|
||||
filterExprEdit1.InputText = filterText;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PositionWindow
|
||||
|
||||
private void PositionWindow(SuperGridControl superGrid)
|
||||
{
|
||||
if (_size != Size.Empty)
|
||||
Size = _size;
|
||||
|
||||
Form form = superGrid.FindForm();
|
||||
|
||||
if (form != null)
|
||||
{
|
||||
Point pt = form.Location;
|
||||
|
||||
if (_offset != Point.Empty)
|
||||
{
|
||||
pt.Offset(_offset);
|
||||
|
||||
Location = pt;
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen screen = Screen.FromControl(form);
|
||||
|
||||
int boundWidth = screen.Bounds.Width;
|
||||
int boundHeight = screen.Bounds.Height;
|
||||
|
||||
int x = boundWidth - Width;
|
||||
int y = boundHeight - Height;
|
||||
|
||||
Location = new Point(screen.Bounds.X + x / 2, screen.Bounds.Y + y / 2);
|
||||
}
|
||||
}
|
||||
|
||||
_LockedResize = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event processong
|
||||
|
||||
#region CustomFilterShown
|
||||
|
||||
private void CustomFilterShown(object sender, EventArgs e)
|
||||
{
|
||||
filterExprEdit1.SetFocus();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnResize
|
||||
|
||||
/// <summary>
|
||||
/// Handles filter resize
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
|
||||
if (_LockedResize == false)
|
||||
_size = Size;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnLocationChanged
|
||||
|
||||
/// <summary>
|
||||
/// LocationChanged processing
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnLocationChanged(EventArgs e)
|
||||
{
|
||||
base.OnLocationChanged(e);
|
||||
|
||||
if (_LockedResize == false)
|
||||
{
|
||||
Form form = _GridPanel.SuperGrid.FindForm();
|
||||
|
||||
if (form != null)
|
||||
{
|
||||
Point pt = Location;
|
||||
|
||||
pt.Offset(-form.Location.X, -form.Location.Y);
|
||||
|
||||
_offset = pt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Button processing
|
||||
|
||||
#region BtnApplyClick
|
||||
|
||||
private void BtnApplyClick(object sender, EventArgs e)
|
||||
{
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
#region ApplyFilter
|
||||
|
||||
private void ApplyFilter()
|
||||
{
|
||||
string text = filterExprEdit1.InputText;
|
||||
|
||||
object filterValue = null;
|
||||
object filterDisplayValue = text;
|
||||
string filterExpr = text;
|
||||
|
||||
if (_GridColumn != null)
|
||||
{
|
||||
if (_GridColumn.SuperGrid.DoFilterEditValueChangedEvent(_GridPanel, _GridColumn, null,
|
||||
_GridColumn.FilterValue, ref filterValue, ref filterDisplayValue, ref filterExpr) == false)
|
||||
{
|
||||
_GridColumn.FilterExpr = text;
|
||||
_GridColumn.FilterValue = null;
|
||||
_GridColumn.FilterDisplayValue = text;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_GridPanel.SuperGrid.DoFilterEditValueChangedEvent(_GridPanel, null, null,
|
||||
_GridPanel.FilterExpr, ref filterValue, ref filterDisplayValue, ref filterExpr) == false)
|
||||
{
|
||||
_GridPanel.FilterExpr = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnOkClick
|
||||
|
||||
private void BtnOkClick(object sender, EventArgs e)
|
||||
{
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnCancelClick
|
||||
|
||||
private void BtnCancelClick(object sender, EventArgs e)
|
||||
{
|
||||
CancelFilter();
|
||||
}
|
||||
|
||||
private void CancelFilter()
|
||||
{
|
||||
if (_GridColumn != null)
|
||||
{
|
||||
_GridColumn.FilterExpr = _FilterExpr;
|
||||
_GridColumn.FilterValue = _FilterValue;
|
||||
_GridColumn.FilterDisplayValue = _FilterDisplayValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_GridPanel.FilterExpr = _FilterExpr;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnClearClick
|
||||
|
||||
private void BtnClearClick(object sender, EventArgs e)
|
||||
{
|
||||
filterExprEdit1.InputText = "";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CustomFilterHelpButtonClicked
|
||||
|
||||
/// <summary>
|
||||
/// Sample Expr variable
|
||||
/// </summary>
|
||||
static protected SampleExpr Se;
|
||||
|
||||
private void CustomFilterHelpButtonClicked(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (Se == null)
|
||||
{
|
||||
Se = new SampleExpr(_GridPanel.SuperGrid);
|
||||
Se.TitleText = _filterHelpTitle;
|
||||
|
||||
Se.FormClosed += SeFormClosed;
|
||||
}
|
||||
|
||||
if (_GridPanel.SuperGrid.DoFilterHelpOpeningEvent(_GridPanel, _GridColumn, Se) == true)
|
||||
{
|
||||
Se.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
Se.Show();
|
||||
|
||||
if (Se.WindowState == FormWindowState.Minimized)
|
||||
Se.WindowState = FormWindowState.Normal;
|
||||
|
||||
Se.BringToFront();
|
||||
}
|
||||
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
void SeFormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
_GridPanel.SuperGrid.DoFilterHelpClosingEvent(_GridPanel, _GridColumn, Se);
|
||||
|
||||
Se.FormClosed -= SeFormClosed;
|
||||
Se = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region LoadLocalizedStrings
|
||||
|
||||
private void LoadLocalizedStrings(SuperGridControl sg)
|
||||
{
|
||||
if (_localizedStringsLoaded == false)
|
||||
{
|
||||
using (LocalizationManager lm = new LocalizationManager(sg))
|
||||
{
|
||||
string s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCustomHelp)) != "")
|
||||
_filterHelpString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterEnterExpr)) != "")
|
||||
_filterEnterExprString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterClear)) != "")
|
||||
_filterClearString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCustomFilter)) != "")
|
||||
_filterCustomFilterString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterHelpTitle)) != "")
|
||||
_filterHelpTitle = s;
|
||||
}
|
||||
|
||||
_localizedStringsLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>315, 157</value>
|
||||
</data>
|
||||
<data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="btnCancel.Text" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.Name" xml:space="preserve">
|
||||
<value>btnCancel</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="btnOk.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="btnOk.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>244, 157</value>
|
||||
</data>
|
||||
<data name="btnOk.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="btnOk.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="btnOk.Text" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name=">>btnOk.Name" xml:space="preserve">
|
||||
<value>btnOk</value>
|
||||
</data>
|
||||
<data name=">>btnOk.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnOk.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnOk.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="btnApply.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="btnApply.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>164, 157</value>
|
||||
</data>
|
||||
<data name="btnApply.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="btnApply.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="btnApply.Text" xml:space="preserve">
|
||||
<value>Apply</value>
|
||||
</data>
|
||||
<data name=">>btnApply.Name" xml:space="preserve">
|
||||
<value>btnApply</value>
|
||||
</data>
|
||||
<data name=">>btnApply.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnApply.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnApply.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="btnClear.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Left</value>
|
||||
</data>
|
||||
<data name="btnClear.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 157</value>
|
||||
</data>
|
||||
<data name="btnClear.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="btnClear.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="btnClear.Text" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
<data name=">>btnClear.Name" xml:space="preserve">
|
||||
<value>btnClear</value>
|
||||
</data>
|
||||
<data name=">>btnClear.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnClear.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnClear.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="lblEnterText.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="lblEnterText.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 4</value>
|
||||
</data>
|
||||
<data name="lblEnterText.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>370, 26</value>
|
||||
</data>
|
||||
<data name="lblEnterText.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="lblEnterText.Text" xml:space="preserve">
|
||||
<value>labelX1</value>
|
||||
</data>
|
||||
<data name=">>lblEnterText.Name" xml:space="preserve">
|
||||
<value>lblEnterText</value>
|
||||
</data>
|
||||
<data name=">>lblEnterText.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.LabelX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>lblEnterText.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>lblEnterText.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="filterExprEdit1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Bottom, Left, Right</value>
|
||||
</data>
|
||||
<data name="filterExprEdit1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 34</value>
|
||||
</data>
|
||||
<data name="filterExprEdit1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>370, 112</value>
|
||||
</data>
|
||||
<data name="filterExprEdit1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name=">>filterExprEdit1.Name" xml:space="preserve">
|
||||
<value>filterExprEdit1</value>
|
||||
</data>
|
||||
<data name=">>filterExprEdit1.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.SuperGrid.FilterExprEdit, DevComponents.DotNetBar.SuperGrid, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>filterExprEdit1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>filterExprEdit1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>394, 192</value>
|
||||
</data>
|
||||
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>410, 230</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>Manual</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>CustomFilter</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Office2007Form, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,231 @@
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
partial class CustomFilterEx
|
||||
{
|
||||
/// <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 Windows Form 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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CustomFilterEx));
|
||||
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnOk = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnApply = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnReset = new DevComponents.DotNetBar.ButtonX();
|
||||
this.lblFilterName = new DevComponents.DotNetBar.LabelX();
|
||||
this.tbxDesc = new DevComponents.DotNetBar.Controls.TextBoxX();
|
||||
this.lblDesc = new DevComponents.DotNetBar.LabelX();
|
||||
this.cbFilterName = new DevComponents.DotNetBar.Controls.ComboBoxEx();
|
||||
this.btnNewFilter = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnDeleteFilter = new DevComponents.DotNetBar.ButtonX();
|
||||
this.lblEnterText = new DevComponents.DotNetBar.LabelX();
|
||||
this.cbxShowInPopup = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.btnClear = new DevComponents.DotNetBar.ButtonX();
|
||||
this.filterExprEdit1 = new DevComponents.DotNetBar.SuperGrid.FilterExprEdit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnCancel, "btnCancel");
|
||||
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnCancel.Click += new System.EventHandler(this.BtnCancelClick);
|
||||
//
|
||||
// btnOk
|
||||
//
|
||||
this.btnOk.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnOk, "btnOk");
|
||||
this.btnOk.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.btnOk.Name = "btnOk";
|
||||
this.btnOk.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnOk.Click += new System.EventHandler(this.BtnOkClick);
|
||||
//
|
||||
// btnApply
|
||||
//
|
||||
this.btnApply.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnApply, "btnApply");
|
||||
this.btnApply.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnApply.Name = "btnApply";
|
||||
this.btnApply.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnApply.Click += new System.EventHandler(this.BtnApplyClick);
|
||||
//
|
||||
// btnReset
|
||||
//
|
||||
this.btnReset.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnReset, "btnReset");
|
||||
this.btnReset.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnReset.Name = "btnReset";
|
||||
this.btnReset.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnReset.Click += new System.EventHandler(this.BtnResetClick);
|
||||
//
|
||||
// lblFilterName
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.lblFilterName.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
resources.ApplyResources(this.lblFilterName, "lblFilterName");
|
||||
this.lblFilterName.Name = "lblFilterName";
|
||||
//
|
||||
// tbxDesc
|
||||
//
|
||||
resources.ApplyResources(this.tbxDesc, "tbxDesc");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.tbxDesc.Border.Class = "TextBoxBorder";
|
||||
this.tbxDesc.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.tbxDesc.Name = "tbxDesc";
|
||||
this.tbxDesc.TextChanged += new System.EventHandler(this.TbxDescTextChanged);
|
||||
//
|
||||
// lblDesc
|
||||
//
|
||||
resources.ApplyResources(this.lblDesc, "lblDesc");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.lblDesc.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.lblDesc.Name = "lblDesc";
|
||||
//
|
||||
// cbFilterName
|
||||
//
|
||||
resources.ApplyResources(this.cbFilterName, "cbFilterName");
|
||||
this.cbFilterName.DisplayMember = "Text";
|
||||
this.cbFilterName.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.cbFilterName.FormattingEnabled = true;
|
||||
this.cbFilterName.Name = "cbFilterName";
|
||||
this.cbFilterName.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.cbFilterName.DropDown += new System.EventHandler(this.CbFilterNameDropDown);
|
||||
this.cbFilterName.SelectedIndexChanged += new System.EventHandler(this.CbFilterNameSelectedIndexChanged);
|
||||
this.cbFilterName.TextUpdate += new System.EventHandler(this.CbFilterNameTextUpdate);
|
||||
//
|
||||
// btnNewFilter
|
||||
//
|
||||
this.btnNewFilter.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnNewFilter, "btnNewFilter");
|
||||
this.btnNewFilter.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnNewFilter.Name = "btnNewFilter";
|
||||
this.btnNewFilter.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnNewFilter.Click += new System.EventHandler(this.BtnNewFilterClick);
|
||||
//
|
||||
// btnDeleteFilter
|
||||
//
|
||||
this.btnDeleteFilter.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnDeleteFilter, "btnDeleteFilter");
|
||||
this.btnDeleteFilter.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnDeleteFilter.Name = "btnDeleteFilter";
|
||||
this.btnDeleteFilter.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnDeleteFilter.Click += new System.EventHandler(this.BtnDeleteFilterClick);
|
||||
//
|
||||
// lblEnterText
|
||||
//
|
||||
resources.ApplyResources(this.lblEnterText, "lblEnterText");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.lblEnterText.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.lblEnterText.Name = "lblEnterText";
|
||||
//
|
||||
// cbxShowInPopup
|
||||
//
|
||||
resources.ApplyResources(this.cbxShowInPopup, "cbxShowInPopup");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.cbxShowInPopup.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.cbxShowInPopup.Name = "cbxShowInPopup";
|
||||
this.cbxShowInPopup.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.cbxShowInPopup.CheckedChanged += new System.EventHandler(this.CbxShowInPopupCheckedChanged);
|
||||
//
|
||||
// btnClear
|
||||
//
|
||||
this.btnClear.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnClear, "btnClear");
|
||||
this.btnClear.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnClear.Name = "btnClear";
|
||||
this.btnClear.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnClear.Click += new System.EventHandler(this.BtnClearClick);
|
||||
//
|
||||
// filterExprEdit1
|
||||
//
|
||||
resources.ApplyResources(this.filterExprEdit1, "filterExprEdit1");
|
||||
this.filterExprEdit1.Name = "filterExprEdit1";
|
||||
//
|
||||
// CustomFilterEx
|
||||
//
|
||||
this.AcceptButton = this.btnApply;
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.Controls.Add(this.btnClear);
|
||||
this.Controls.Add(this.filterExprEdit1);
|
||||
this.Controls.Add(this.tbxDesc);
|
||||
this.Controls.Add(this.lblEnterText);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.cbxShowInPopup);
|
||||
this.Controls.Add(this.btnOk);
|
||||
this.Controls.Add(this.btnNewFilter);
|
||||
this.Controls.Add(this.btnReset);
|
||||
this.Controls.Add(this.lblFilterName);
|
||||
this.Controls.Add(this.btnApply);
|
||||
this.Controls.Add(this.cbFilterName);
|
||||
this.Controls.Add(this.lblDesc);
|
||||
this.Controls.Add(this.btnDeleteFilter);
|
||||
this.DoubleBuffered = true;
|
||||
this.EnableGlass = false;
|
||||
this.HelpButton = true;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CustomFilterEx";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.TitleText = "Custom Filter";
|
||||
this.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(this.CustomFilterHelpButtonClicked);
|
||||
this.Shown += new System.EventHandler(this.CustomFilterShown);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DevComponents.DotNetBar.ButtonX btnCancel;
|
||||
private DevComponents.DotNetBar.ButtonX btnOk;
|
||||
private ButtonX btnApply;
|
||||
private ButtonX btnReset;
|
||||
private LabelX lblFilterName;
|
||||
private DevComponents.DotNetBar.Controls.TextBoxX tbxDesc;
|
||||
private LabelX lblDesc;
|
||||
private DevComponents.DotNetBar.Controls.ComboBoxEx cbFilterName;
|
||||
private ButtonX btnNewFilter;
|
||||
private ButtonX btnDeleteFilter;
|
||||
private LabelX lblEnterText;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbxShowInPopup;
|
||||
private FilterExprEdit filterExprEdit1;
|
||||
private ButtonX btnClear;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,700 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// CustomFilter
|
||||
///</summary>
|
||||
internal partial class CustomFilterEx : Office2007Form
|
||||
{
|
||||
#region Static data
|
||||
|
||||
private static bool _localizedStringsLoaded;
|
||||
|
||||
private static string _filterClearString = "Clear";
|
||||
private static string _filterResetString = "Reset";
|
||||
private static string _filterCustomFilterString = "Custom Filter";
|
||||
private static string _filterEnterExprString = "Enter custom filter expression";
|
||||
private static string _filterHelpString = "Click the Title Bar help button for syntax help";
|
||||
private static string _newFilterExprString = "NewFilter";
|
||||
private static string _filterDescriptionString = "Description";
|
||||
private static string _filterNameString = "Filter Name:";
|
||||
private static string _showInFilterPopupString = "Show in FilterPopup";
|
||||
private static string _newFilterString = "New";
|
||||
private static string _deleteFilterString = "Delete";
|
||||
private static string _filterHelpTitle = "SampleExpr";
|
||||
|
||||
private static Point _offset = Point.Empty;
|
||||
private static Size _size = Size.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private GridPanel _GridPanel;
|
||||
private GridColumn _GridColumn;
|
||||
|
||||
private string _FilterExpr;
|
||||
private object _FilterValue;
|
||||
private object _FilterDisplayValue;
|
||||
|
||||
private List<UserFilterData> _FilterData;
|
||||
private UserFilterData _CurrentFilter;
|
||||
|
||||
private bool _CancelFilterEdits;
|
||||
private bool _LockedResize = true;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// CustomFilter
|
||||
///</summary>
|
||||
public CustomFilterEx(GridPanel gridPanel, GridColumn gridColumn)
|
||||
: this(gridPanel, gridColumn, gridColumn != null ? gridColumn.FilterExpr : gridPanel.FilterExpr)
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// CustomFilter
|
||||
///</summary>
|
||||
public CustomFilterEx(GridPanel gridPanel,
|
||||
GridColumn gridColumn, string filterText)
|
||||
{
|
||||
_GridPanel = gridPanel;
|
||||
_GridColumn = gridColumn;
|
||||
|
||||
InitializeComponent();
|
||||
InitializeText();
|
||||
InitializeFilter(filterText);
|
||||
|
||||
PositionWindow(_GridPanel.SuperGrid);
|
||||
|
||||
FormClosing += CustomFilterExFormClosing;
|
||||
|
||||
filterExprEdit1.InputTextChanged += FilterExprEdit1InputTextChanged;
|
||||
|
||||
StyleManager.UpdateAmbientColors(filterExprEdit1);
|
||||
|
||||
filterExprEdit1.RtbOutput.BackColorRichTextBox = Color.White;
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region CurrentFilter
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current UserFilterData filter
|
||||
/// </summary>
|
||||
public UserFilterData CurrentFilter
|
||||
{
|
||||
get { return (_CurrentFilter); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_CurrentFilter != value)
|
||||
{
|
||||
_CurrentFilter = value;
|
||||
|
||||
UpdateDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FilterData
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of UserFilterData
|
||||
/// </summary>
|
||||
public List<UserFilterData> FilterData
|
||||
{
|
||||
get { return (_FilterData); }
|
||||
set { _FilterData = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FilterExpr
|
||||
|
||||
/// <summary>
|
||||
/// FilterExpr
|
||||
/// </summary>
|
||||
public string FilterExpr
|
||||
{
|
||||
get { return (filterExprEdit1.InputText); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ShowInPopupVisible
|
||||
|
||||
/// <summary>
|
||||
/// ShowInPopupVisible
|
||||
/// </summary>
|
||||
public bool ShowInPopupVisible
|
||||
{
|
||||
get { return (cbxShowInPopup.Visible); }
|
||||
set { cbxShowInPopup.Visible = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Initialization
|
||||
|
||||
#region InitializeText
|
||||
|
||||
private void InitializeText()
|
||||
{
|
||||
SuperGridControl superGrid = _GridPanel.SuperGrid;
|
||||
|
||||
LoadLocalizedStrings(superGrid);
|
||||
|
||||
TitleText = _filterCustomFilterString;
|
||||
|
||||
lblEnterText.Text = _filterEnterExprString;
|
||||
lblDesc.Text = _filterDescriptionString;
|
||||
lblFilterName.Text = _filterNameString;
|
||||
|
||||
btnNewFilter.Text = _newFilterString;
|
||||
btnDeleteFilter.Text = _deleteFilterString;
|
||||
btnReset.Text = _filterResetString;
|
||||
btnClear.Text = _filterClearString;
|
||||
|
||||
btnApply.Text = superGrid.FilterApplyString;
|
||||
btnOk.Text = superGrid.FilterOkString;
|
||||
btnCancel.Text = superGrid.FilterCancelString;
|
||||
|
||||
cbxShowInPopup.Text = _showInFilterPopupString;
|
||||
|
||||
if (superGrid.ShowCustomFilterHelp == true)
|
||||
filterExprEdit1.WaterMarkText = _filterHelpString;
|
||||
else
|
||||
HelpButton = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitializeFilter
|
||||
|
||||
private void InitializeFilter(string filterText)
|
||||
{
|
||||
if (_GridColumn != null)
|
||||
{
|
||||
_FilterExpr = _GridColumn.FilterExpr;
|
||||
_FilterValue = _GridColumn.FilterValue;
|
||||
_FilterDisplayValue = _GridColumn.FilterDisplayValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_FilterExpr = _GridPanel.FilterExpr;
|
||||
_FilterValue = null;
|
||||
_FilterDisplayValue = null;
|
||||
|
||||
cbxShowInPopup.Visible = false;
|
||||
}
|
||||
|
||||
filterExprEdit1.GridPanel = _GridPanel;
|
||||
filterExprEdit1.GridColumn = _GridColumn;
|
||||
filterExprEdit1.InputText = filterText;
|
||||
|
||||
CurrentFilter = GetCurrentFilter();
|
||||
}
|
||||
|
||||
#region GetCurrentFilter
|
||||
|
||||
private UserFilterData GetCurrentFilter()
|
||||
{
|
||||
_FilterData = FilterUserData.LoadFilterData(_GridPanel);
|
||||
|
||||
foreach (UserFilterData fd in _FilterData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(fd.Expression) == false)
|
||||
{
|
||||
if (fd.Expression.Equals(filterExprEdit1.InputText) == true)
|
||||
return (fd);
|
||||
}
|
||||
}
|
||||
|
||||
UserFilterData nfd = GetNewFilter();
|
||||
|
||||
nfd.Expression = filterExprEdit1.InputText;
|
||||
|
||||
return (nfd);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region PositionWindow
|
||||
|
||||
private void PositionWindow(SuperGridControl superGrid)
|
||||
{
|
||||
if (_size != Size.Empty)
|
||||
Size = _size;
|
||||
|
||||
Form form = superGrid.FindForm();
|
||||
|
||||
if (form != null)
|
||||
{
|
||||
Point pt = form.Location;
|
||||
|
||||
if (_offset != Point.Empty)
|
||||
{
|
||||
pt.Offset(_offset);
|
||||
|
||||
Location = pt;
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen screen = Screen.FromControl(form);
|
||||
|
||||
int boundWidth = screen.Bounds.Width;
|
||||
int boundHeight = screen.Bounds.Height;
|
||||
|
||||
int x = boundWidth - Width;
|
||||
int y = boundHeight - Height;
|
||||
|
||||
Location = new Point(screen.Bounds.X + x / 2, screen.Bounds.Y + y / 2);
|
||||
}
|
||||
}
|
||||
|
||||
_LockedResize = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event processong
|
||||
|
||||
#region CustomFilterExFormClosing
|
||||
|
||||
void CustomFilterExFormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (_CancelFilterEdits == false)
|
||||
FilterUserData.StoreFilterData(_GridPanel, _FilterData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CustomFilterShown
|
||||
|
||||
private void CustomFilterShown(object sender, EventArgs e)
|
||||
{
|
||||
filterExprEdit1.SetFocus();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FilterExprEdit1InputTextChanged
|
||||
|
||||
void FilterExprEdit1InputTextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CurrentFilter.Expression = filterExprEdit1.InputText;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnLocationChanged
|
||||
|
||||
protected override void OnLocationChanged(EventArgs e)
|
||||
{
|
||||
base.OnLocationChanged(e);
|
||||
|
||||
if (_LockedResize == false)
|
||||
{
|
||||
Form form = _GridPanel.SuperGrid.FindForm();
|
||||
|
||||
if (form != null)
|
||||
{
|
||||
Point pt = Location;
|
||||
|
||||
pt.Offset(-form.Location.X, -form.Location.Y);
|
||||
|
||||
_offset = pt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnResize
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
|
||||
if (_LockedResize == false)
|
||||
_size = Size;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateDisplay
|
||||
|
||||
private void UpdateDisplay()
|
||||
{
|
||||
cbFilterName.Text = CurrentFilter.Name;
|
||||
tbxDesc.Text = CurrentFilter.Description;
|
||||
|
||||
if (_GridColumn != null)
|
||||
cbxShowInPopup.Checked = CurrentFilter.ReferNames.Contains(_GridColumn.Name);
|
||||
|
||||
filterExprEdit1.InputText = CurrentFilter.Expression;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Button processing
|
||||
|
||||
#region BtnApplyClick
|
||||
|
||||
private void BtnApplyClick(object sender, EventArgs e)
|
||||
{
|
||||
ApplyFilter(filterExprEdit1.InputText);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnResetClick
|
||||
|
||||
private void BtnResetClick(object sender, EventArgs e)
|
||||
{
|
||||
ApplyFilter(null);
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnDeleteFilterClick
|
||||
|
||||
private void BtnDeleteFilterClick(object sender, EventArgs e)
|
||||
{
|
||||
if (CurrentFilter != null)
|
||||
{
|
||||
_FilterData.Remove(CurrentFilter);
|
||||
|
||||
UpdateFilterNameCombo();
|
||||
|
||||
CurrentFilter = (_FilterData.Count > 0)
|
||||
? _FilterData[0] : GetNewFilter();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnCancelClick
|
||||
|
||||
private void BtnCancelClick(object sender, EventArgs e)
|
||||
{
|
||||
if (_GridColumn != null)
|
||||
{
|
||||
_GridColumn.FilterExpr = _FilterExpr;
|
||||
_GridColumn.FilterValue = _FilterValue;
|
||||
_GridColumn.FilterDisplayValue = _FilterDisplayValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_GridPanel.FilterExpr = _FilterExpr;
|
||||
}
|
||||
|
||||
_CancelFilterEdits = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnClearClick
|
||||
|
||||
private void BtnClearClick(object sender, EventArgs e)
|
||||
{
|
||||
filterExprEdit1.InputText = "";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnNewFilterClick
|
||||
|
||||
private void BtnNewFilterClick(object sender, EventArgs e)
|
||||
{
|
||||
CurrentFilter = GetNewFilter();
|
||||
}
|
||||
|
||||
#region GetNewFilter
|
||||
|
||||
private UserFilterData GetNewFilter()
|
||||
{
|
||||
UserFilterData fd = new UserFilterData();
|
||||
|
||||
fd.Name = GetNewFilterName();
|
||||
fd.Description = "";
|
||||
|
||||
_FilterData.Add(fd);
|
||||
|
||||
return (fd);
|
||||
}
|
||||
|
||||
#region GetNewFilterName
|
||||
|
||||
private string GetNewFilterName()
|
||||
{
|
||||
for (int i = 1; i < 100; i++)
|
||||
{
|
||||
string s = _newFilterExprString + i;
|
||||
|
||||
if (FindFilterName(s) < 0)
|
||||
return(s);
|
||||
}
|
||||
|
||||
return (_newFilterExprString);
|
||||
}
|
||||
|
||||
#region FindFilterName
|
||||
|
||||
private int FindFilterName(string s)
|
||||
{
|
||||
for (int i = 0; i < _FilterData.Count; i++)
|
||||
{
|
||||
if (s.Equals(_FilterData[i].Name) == true)
|
||||
return (i);
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnOkClick
|
||||
|
||||
private void BtnOkClick(object sender, EventArgs e)
|
||||
{
|
||||
ApplyFilter(filterExprEdit1.InputText);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CustomFilterHelpButtonClicked
|
||||
|
||||
static protected SampleExpr Se;
|
||||
|
||||
private void CustomFilterHelpButtonClicked(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (Se == null)
|
||||
{
|
||||
Se = new SampleExpr(_GridPanel.SuperGrid);
|
||||
Se.TitleText = _filterHelpTitle;
|
||||
|
||||
Se.FormClosed += SeFormClosed;
|
||||
}
|
||||
|
||||
if (_GridPanel.SuperGrid.DoFilterHelpOpeningEvent(_GridPanel, _GridColumn, Se) == true)
|
||||
{
|
||||
Se.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
Se.Show();
|
||||
|
||||
if (Se.WindowState == FormWindowState.Minimized)
|
||||
Se.WindowState = FormWindowState.Normal;
|
||||
|
||||
Se.BringToFront();
|
||||
}
|
||||
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
void SeFormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
_GridPanel.SuperGrid.DoFilterHelpClosingEvent(_GridPanel, _GridColumn, Se);
|
||||
|
||||
Se.FormClosed -= SeFormClosed;
|
||||
Se = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyFilter
|
||||
|
||||
private void ApplyFilter(string text)
|
||||
{
|
||||
object filterValue = null;
|
||||
object filterDisplayValue = text;
|
||||
string filterExpr = text;
|
||||
|
||||
if (_GridColumn != null)
|
||||
{
|
||||
if (_GridColumn.SuperGrid.DoFilterEditValueChangedEvent(_GridPanel, _GridColumn, null,
|
||||
_GridColumn.FilterValue, ref filterValue, ref filterDisplayValue, ref filterExpr) == false)
|
||||
{
|
||||
_GridColumn.FilterExpr = text;
|
||||
_GridColumn.FilterValue = null;
|
||||
_GridColumn.FilterDisplayValue = text;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_GridPanel.SuperGrid.DoFilterEditValueChangedEvent(_GridPanel, null, null,
|
||||
_GridPanel.FilterExpr, ref filterValue, ref filterDisplayValue, ref filterExpr) == false)
|
||||
{
|
||||
_GridPanel.FilterExpr = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Checkbox processing
|
||||
|
||||
#region CbxShowInPopupCheckedChanged
|
||||
|
||||
private void CbxShowInPopupCheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_GridColumn != null)
|
||||
{
|
||||
if (cbxShowInPopup.Checked == true)
|
||||
{
|
||||
if (CurrentFilter.ReferNames.Contains(_GridColumn.Name) == false)
|
||||
CurrentFilter.ReferNames.Add(_GridColumn.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CurrentFilter.ReferNames.Contains(_GridColumn.Name) == true)
|
||||
CurrentFilter.ReferNames.Remove(_GridColumn.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Combobox processing
|
||||
|
||||
#region CbFilterNameDropDown
|
||||
|
||||
private void CbFilterNameDropDown(object sender, EventArgs e)
|
||||
{
|
||||
UpdateFilterNameCombo();
|
||||
}
|
||||
|
||||
#region UpdateFilterNameCombo
|
||||
|
||||
private void UpdateFilterNameCombo()
|
||||
{
|
||||
cbFilterName.Items.Clear();
|
||||
|
||||
foreach (UserFilterData fd in _FilterData)
|
||||
cbFilterName.Items.Add(fd.Name);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region CbFilterNameSelectedIndexChanged
|
||||
|
||||
private void CbFilterNameSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (cbFilterName.SelectedIndex >= 0)
|
||||
CurrentFilter = _FilterData[cbFilterName.SelectedIndex];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CbFilterNameTextUpdate
|
||||
|
||||
private void CbFilterNameTextUpdate(object sender, EventArgs e)
|
||||
{
|
||||
CurrentFilter.Name = cbFilterName.Text;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextBox processing
|
||||
|
||||
#region TbxDescTextChanged
|
||||
|
||||
private void TbxDescTextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CurrentFilter.Description = tbxDesc.Text;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region LoadLocalizedStrings
|
||||
|
||||
private void LoadLocalizedStrings(SuperGridControl sg)
|
||||
{
|
||||
if (_localizedStringsLoaded == false)
|
||||
{
|
||||
using (LocalizationManager lm = new LocalizationManager(sg))
|
||||
{
|
||||
string s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCustomHelp)) != "")
|
||||
_filterHelpString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterEnterExpr)) != "")
|
||||
_filterEnterExprString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterClear)) != "")
|
||||
_filterClearString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterReset)) != "")
|
||||
_filterResetString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCustomFilter)) != "")
|
||||
_filterCustomFilterString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridNewFilterExpr)) != "")
|
||||
_newFilterExprString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridNewFilter)) != "")
|
||||
_newFilterString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridDeleteFilter)) != "")
|
||||
_deleteFilterString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterName)) != "")
|
||||
_filterNameString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterDescription)) != "")
|
||||
_filterDescriptionString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridShowInFilterPopup)) != "")
|
||||
_showInFilterPopupString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterHelpTitle)) != "")
|
||||
_filterHelpTitle = s;
|
||||
}
|
||||
|
||||
_localizedStringsLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,516 @@
|
||||
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>256, 261</value>
|
||||
</data>
|
||||
<data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="btnCancel.Text" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.Name" xml:space="preserve">
|
||||
<value>btnCancel</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="btnOk.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="btnOk.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>327, 261</value>
|
||||
</data>
|
||||
<data name="btnOk.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="btnOk.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="btnOk.Text" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name=">>btnOk.Name" xml:space="preserve">
|
||||
<value>btnOk</value>
|
||||
</data>
|
||||
<data name=">>btnOk.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnOk.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnOk.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="btnApply.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Left</value>
|
||||
</data>
|
||||
<data name="btnApply.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>86, 261</value>
|
||||
</data>
|
||||
<data name="btnApply.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="btnApply.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="btnApply.Text" xml:space="preserve">
|
||||
<value>Apply</value>
|
||||
</data>
|
||||
<data name=">>btnApply.Name" xml:space="preserve">
|
||||
<value>btnApply</value>
|
||||
</data>
|
||||
<data name=">>btnApply.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnApply.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnApply.ZOrder" xml:space="preserve">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="btnReset.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="btnReset.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>185, 261</value>
|
||||
</data>
|
||||
<data name="btnReset.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="btnReset.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="btnReset.Text" xml:space="preserve">
|
||||
<value>Reset</value>
|
||||
</data>
|
||||
<data name=">>btnReset.Name" xml:space="preserve">
|
||||
<value>btnReset</value>
|
||||
</data>
|
||||
<data name=">>btnReset.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnReset.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnReset.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="lblFilterName.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 10</value>
|
||||
</data>
|
||||
<data name="lblFilterName.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="lblFilterName.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="lblFilterName.Text" xml:space="preserve">
|
||||
<value>Filter Name:</value>
|
||||
</data>
|
||||
<data name=">>lblFilterName.Name" xml:space="preserve">
|
||||
<value>lblFilterName</value>
|
||||
</data>
|
||||
<data name=">>lblFilterName.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.LabelX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>lblFilterName.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>lblFilterName.ZOrder" xml:space="preserve">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="tbxDesc.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="tbxDesc.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 65</value>
|
||||
</data>
|
||||
<data name="tbxDesc.Multiline" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="tbxDesc.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>232, 40</value>
|
||||
</data>
|
||||
<data name="tbxDesc.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name=">>tbxDesc.Name" xml:space="preserve">
|
||||
<value>tbxDesc</value>
|
||||
</data>
|
||||
<data name=">>tbxDesc.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.TextBoxX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>tbxDesc.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>tbxDesc.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="lblDesc.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="lblDesc.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 41</value>
|
||||
</data>
|
||||
<data name="lblDesc.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>232, 22</value>
|
||||
</data>
|
||||
<data name="lblDesc.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="lblDesc.Text" xml:space="preserve">
|
||||
<value>Description</value>
|
||||
</data>
|
||||
<data name=">>lblDesc.Name" xml:space="preserve">
|
||||
<value>lblDesc</value>
|
||||
</data>
|
||||
<data name=">>lblDesc.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.LabelX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>lblDesc.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>lblDesc.ZOrder" xml:space="preserve">
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name="cbFilterName.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="cbFilterName.ItemHeight" type="System.Int32, mscorlib">
|
||||
<value>15</value>
|
||||
</data>
|
||||
<data name="cbFilterName.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>83, 12</value>
|
||||
</data>
|
||||
<data name="cbFilterName.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>161, 21</value>
|
||||
</data>
|
||||
<data name="cbFilterName.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>cbFilterName.Name" xml:space="preserve">
|
||||
<value>cbFilterName</value>
|
||||
</data>
|
||||
<data name=">>cbFilterName.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.ComboBoxEx, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cbFilterName.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cbFilterName.ZOrder" xml:space="preserve">
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="btnNewFilter.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="btnNewFilter.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>256, 82</value>
|
||||
</data>
|
||||
<data name="btnNewFilter.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="btnNewFilter.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="btnNewFilter.Text" xml:space="preserve">
|
||||
<value>New</value>
|
||||
</data>
|
||||
<data name=">>btnNewFilter.Name" xml:space="preserve">
|
||||
<value>btnNewFilter</value>
|
||||
</data>
|
||||
<data name=">>btnNewFilter.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnNewFilter.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnNewFilter.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="btnDeleteFilter.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="btnDeleteFilter.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>327, 82</value>
|
||||
</data>
|
||||
<data name="btnDeleteFilter.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="btnDeleteFilter.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="btnDeleteFilter.Text" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name=">>btnDeleteFilter.Name" xml:space="preserve">
|
||||
<value>btnDeleteFilter</value>
|
||||
</data>
|
||||
<data name=">>btnDeleteFilter.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnDeleteFilter.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnDeleteFilter.ZOrder" xml:space="preserve">
|
||||
<value>13</value>
|
||||
</data>
|
||||
<data name="lblEnterText.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="lblEnterText.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 115</value>
|
||||
</data>
|
||||
<data name="lblEnterText.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>377, 23</value>
|
||||
</data>
|
||||
<data name="lblEnterText.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="lblEnterText.Text" xml:space="preserve">
|
||||
<value>Enter Custom Expression:</value>
|
||||
</data>
|
||||
<data name=">>lblEnterText.Name" xml:space="preserve">
|
||||
<value>lblEnterText</value>
|
||||
</data>
|
||||
<data name=">>lblEnterText.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.LabelX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>lblEnterText.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>lblEnterText.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="cbxShowInPopup.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="cbxShowInPopup.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>259, 12</value>
|
||||
</data>
|
||||
<data name="cbxShowInPopup.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>133, 23</value>
|
||||
</data>
|
||||
<data name="cbxShowInPopup.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="cbxShowInPopup.Text" xml:space="preserve">
|
||||
<value>Show in FilterPopup</value>
|
||||
</data>
|
||||
<data name=">>cbxShowInPopup.Name" xml:space="preserve">
|
||||
<value>cbxShowInPopup</value>
|
||||
</data>
|
||||
<data name=">>cbxShowInPopup.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.CheckBoxX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cbxShowInPopup.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cbxShowInPopup.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="btnClear.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Left</value>
|
||||
</data>
|
||||
<data name="btnClear.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>15, 261</value>
|
||||
</data>
|
||||
<data name="btnClear.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 23</value>
|
||||
</data>
|
||||
<data name="btnClear.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="btnClear.Text" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
<data name=">>btnClear.Name" xml:space="preserve">
|
||||
<value>btnClear</value>
|
||||
</data>
|
||||
<data name=">>btnClear.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnClear.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnClear.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="filterExprEdit1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Bottom, Left, Right</value>
|
||||
</data>
|
||||
<data name="filterExprEdit1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>10, 136</value>
|
||||
</data>
|
||||
<data name="filterExprEdit1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>383, 114</value>
|
||||
</data>
|
||||
<data name="filterExprEdit1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name=">>filterExprEdit1.Name" xml:space="preserve">
|
||||
<value>filterExprEdit1</value>
|
||||
</data>
|
||||
<data name=">>filterExprEdit1.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.SuperGrid.FilterExprEdit, DevComponents.DotNetBar.SuperGrid, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>filterExprEdit1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>filterExprEdit1.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>401, 292</value>
|
||||
</data>
|
||||
<data name="$this.MinimumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>410, 330</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>Manual</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>CustomFilterEx</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Office2007Form, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,416 @@
|
||||
using System;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// DataBinding helper class
|
||||
///</summary>
|
||||
internal static class DataFilter
|
||||
{
|
||||
#region Static data
|
||||
|
||||
private static bool _lockFilter;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// FilterData
|
||||
///</summary>
|
||||
///<param name="panel"></param>
|
||||
internal static void FilterData(GridPanel panel)
|
||||
{
|
||||
if (_lockFilter == true)
|
||||
return;
|
||||
|
||||
if (panel.SuperGrid.DoDataFilteringStartEvent(panel) == false)
|
||||
{
|
||||
_lockFilter = true;
|
||||
|
||||
try
|
||||
{
|
||||
if (panel.EnableFiltering == true &&
|
||||
panel.FilterLevel != FilterLevel.None)
|
||||
{
|
||||
bool rowFiltered = IsRowFiltered(panel);
|
||||
bool colFiltered = IsColumnFiltered(panel);
|
||||
|
||||
if (rowFiltered == true || colFiltered == true)
|
||||
{
|
||||
if (rowFiltered == true)
|
||||
rowFiltered = UpdateRowFilter(panel);
|
||||
|
||||
if (colFiltered == true)
|
||||
UpdateColumnFilter(panel);
|
||||
|
||||
UpdateFilterState(panel, rowFiltered, colFiltered);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateFilterState(panel, false, false);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_lockFilter = false;
|
||||
|
||||
panel.UpdateVisibleRowCount();
|
||||
panel.SuperGrid.DoDataFilteringCompleteEvent(panel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.UpdateVisibleRowCount();
|
||||
}
|
||||
}
|
||||
|
||||
#region UpdateRowFilter
|
||||
|
||||
private static bool UpdateRowFilter(GridPanel panel)
|
||||
{
|
||||
if (panel.FilterEval == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
panel.FilterEval = new FilterEval(
|
||||
panel, null, panel.GetFilterMatchType(), panel.FilterExpr);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateColumnFilter
|
||||
|
||||
private static void UpdateColumnFilter(GridPanel panel)
|
||||
{
|
||||
foreach (GridColumn col in panel.Columns)
|
||||
{
|
||||
if (col.IsFiltered == true)
|
||||
{
|
||||
col.FilterError = false;
|
||||
|
||||
if (col.FilterEval == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
col.FilterEval = new FilterEval(
|
||||
panel, col, col.GetFilterMatchType(), col.FilterExpr);
|
||||
}
|
||||
catch
|
||||
{
|
||||
col.FilterError = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateFilterState
|
||||
|
||||
private static void UpdateFilterState(
|
||||
GridPanel panel, bool rowFiltered, bool colFiltered)
|
||||
{
|
||||
if (IsFilteringEnabled(panel) == true)
|
||||
{
|
||||
if (panel.VirtualMode == true)
|
||||
{
|
||||
if (panel.SuperGrid.DoRefreshFilter(panel) == false)
|
||||
{
|
||||
panel.VirtualRows.Clear();
|
||||
|
||||
panel.DataBinder.UpdateFilter();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int count = panel.Rows.Count;
|
||||
|
||||
if (panel.ShowInsertRow == true)
|
||||
count--;
|
||||
|
||||
bool root = (panel.FilterLevel &
|
||||
(FilterLevel.Root | FilterLevel.RootConditional)) != 0;
|
||||
|
||||
UpdateFilterStateEx(panel, root,
|
||||
panel.Rows, count, rowFiltered, colFiltered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region UpdateFilterStateEx
|
||||
|
||||
private static void UpdateFilterStateEx(GridPanel panel, bool filter,
|
||||
GridItemsCollection items, int count, bool rowFiltered, bool colFiltered)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
GridRow row = items[i] as GridRow;
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
if (row.IsTempInsertRow == true)
|
||||
{
|
||||
row.IsRowFilteredOut = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool expanded = (panel.FilterLevel & FilterLevel.Expanded) != 0;
|
||||
|
||||
if (row.Rows.Count > 0)
|
||||
{
|
||||
UpdateFilterStateEx(panel, expanded,
|
||||
row.Rows, row.Rows.Count, rowFiltered, colFiltered);
|
||||
}
|
||||
|
||||
bool filteredOut = false;
|
||||
|
||||
if (filter == true)
|
||||
{
|
||||
if ((panel.FilterLevel & FilterLevel.RootConditional) != FilterLevel.RootConditional ||
|
||||
row.AnyVisibleItems() == false)
|
||||
{
|
||||
if (rowFiltered == true)
|
||||
{
|
||||
if (EvalRowFilterState(panel, row, ref filteredOut) == true)
|
||||
break;
|
||||
}
|
||||
|
||||
if (filteredOut == false && colFiltered == true)
|
||||
EvalColumnFilterState(panel, row, ref filteredOut);
|
||||
}
|
||||
}
|
||||
|
||||
row.RowFilteredOut = filteredOut;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GridContainer cont = items[i] as GridGroup;
|
||||
|
||||
if (cont != null)
|
||||
{
|
||||
UpdateFilterStateEx(panel,
|
||||
true, cont.Rows, cont.Rows.Count, rowFiltered, colFiltered);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EvalRowFilterState
|
||||
|
||||
private static bool EvalRowFilterState(
|
||||
GridPanel panel, GridRow row, ref bool filteredOut)
|
||||
{
|
||||
try
|
||||
{
|
||||
filteredOut = (panel.FilterEval.Evaluate(row) == false);
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
filteredOut = false;
|
||||
|
||||
bool throwException = false;
|
||||
bool postError = true;
|
||||
|
||||
if (panel.SuperGrid.DoFilterRowErrorEvent(panel,
|
||||
row, exp, ref filteredOut, ref throwException, ref postError) == true)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
if (throwException == true)
|
||||
throw;
|
||||
|
||||
if (postError == true)
|
||||
MessageBoxEx.Show(exp.Message);
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EvalColumnFilterState
|
||||
|
||||
private static bool EvalColumnFilterState(
|
||||
GridPanel panel, GridRow row, ref bool filteredOut)
|
||||
{
|
||||
foreach (GridColumn col in panel.Columns)
|
||||
{
|
||||
if (col.IsFiltered == true)
|
||||
{
|
||||
if (col.FilterError == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
filteredOut = (col.FilterEval.Evaluate(row) == false);
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
col.FilterError = true;
|
||||
|
||||
filteredOut = false;
|
||||
|
||||
bool throwException = false;
|
||||
bool postError = col.FilterEval.PostError;
|
||||
|
||||
if (panel.SuperGrid.DoFilterColumnErrorEvent(panel,
|
||||
row, col, exp, ref filteredOut, ref throwException, ref postError) == true)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
if (throwException == true)
|
||||
throw;
|
||||
|
||||
if (postError == true)
|
||||
MessageBoxEx.Show((col.Name ?? "[" + col.ColumnIndex + "]") + ":\n" + exp.Message);
|
||||
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (filteredOut == true)
|
||||
break;
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateRowFilterState
|
||||
|
||||
internal static void UpdateRowFilterState(GridPanel panel, GridRow row)
|
||||
{
|
||||
bool isPrimary = (row.Parent is GridPanel);
|
||||
|
||||
bool root = (panel.FilterLevel &
|
||||
(FilterLevel.Root | FilterLevel.RootConditional)) != 0;
|
||||
|
||||
bool expanded = (panel.FilterLevel & FilterLevel.Expanded) != 0;
|
||||
|
||||
if ((isPrimary == true && root == true) ||
|
||||
(isPrimary == false && expanded == true))
|
||||
{
|
||||
bool filteredOut = false;
|
||||
|
||||
bool rowFiltered = IsRowFiltered(panel);
|
||||
bool colFiltered = IsColumnFiltered(panel);
|
||||
|
||||
if (rowFiltered == true || colFiltered == true)
|
||||
{
|
||||
if (rowFiltered == true)
|
||||
rowFiltered = UpdateRowFilter(panel);
|
||||
|
||||
if (colFiltered == true)
|
||||
UpdateColumnFilter(panel);
|
||||
|
||||
if (rowFiltered == true)
|
||||
{
|
||||
if (EvalRowFilterState(panel, row, ref filteredOut) == true)
|
||||
return;
|
||||
}
|
||||
|
||||
if (filteredOut == false && colFiltered == true)
|
||||
{
|
||||
if (EvalColumnFilterState(panel, row, ref filteredOut) == true)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (row.RowFilteredOut != filteredOut)
|
||||
{
|
||||
row.RowFilteredOut = filteredOut;
|
||||
|
||||
panel.SuperGrid.NeedToUpdateIndicees = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsFiltered
|
||||
|
||||
internal static bool IsFiltered(GridPanel panel)
|
||||
{
|
||||
return (IsRowFiltered(panel) || IsColumnFiltered(panel));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsRowFiltered
|
||||
|
||||
internal static bool IsRowFiltered(GridPanel panel)
|
||||
{
|
||||
return (IsRowFilteringEnabled(panel) &&
|
||||
String.IsNullOrEmpty(panel.FilterExpr) == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsColumnFiltered
|
||||
|
||||
internal static bool IsColumnFiltered(GridPanel panel)
|
||||
{
|
||||
if (IsColumnFilteringEnabled(panel))
|
||||
{
|
||||
foreach (GridColumn col in panel.Columns)
|
||||
{
|
||||
if (col.IsFiltered == true)
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsFilteringEnabled
|
||||
|
||||
internal static bool IsFilteringEnabled(GridPanel panel)
|
||||
{
|
||||
return (IsRowFilteringEnabled(panel) || IsColumnFilteringEnabled(panel));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsRowFilteringEnabled
|
||||
|
||||
internal static bool IsRowFilteringEnabled(GridPanel panel)
|
||||
{
|
||||
return (panel.EnableFiltering == true &&
|
||||
panel.EnableRowFiltering == true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsColumnFilteringEnabled
|
||||
|
||||
internal static bool IsColumnFilteringEnabled(GridPanel panel)
|
||||
{
|
||||
return (panel.EnableFiltering == true &&
|
||||
panel.EnableColumnFiltering == true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,366 @@
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
partial class FilterDateTimePicker
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FilterDateTimePicker));
|
||||
this.cboDateRelative = new DevComponents.DotNetBar.Controls.ComboBoxEx();
|
||||
this.btnApply = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnCustom = new DevComponents.DotNetBar.ButtonX();
|
||||
this.cbxDateRelative = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.cbxDateRange = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.cbxShowAll = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.cbxShowNull = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.cbxShowNotNull = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.btnOk = new DevComponents.DotNetBar.ButtonX();
|
||||
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
|
||||
this.dtiFromDate = new DevComponents.Editors.DateTimeAdv.DateTimeInput();
|
||||
this.dtiToDate = new DevComponents.Editors.DateTimeAdv.DateTimeInput();
|
||||
this.cbxDateSpecific = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
this.dtiSpecificDate = new DevComponents.Editors.DateTimeAdv.DateTimeInput();
|
||||
this.cbxCustom = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dtiFromDate)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dtiToDate)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dtiSpecificDate)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cboDateRelative
|
||||
//
|
||||
resources.ApplyResources(this.cboDateRelative, "cboDateRelative");
|
||||
this.cboDateRelative.DisplayMember = "Text";
|
||||
this.cboDateRelative.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.cboDateRelative.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cboDateRelative.FormattingEnabled = true;
|
||||
this.cboDateRelative.Name = "cboDateRelative";
|
||||
this.cboDateRelative.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.cboDateRelative.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CboDateRelativeMouseDown);
|
||||
//
|
||||
// btnApply
|
||||
//
|
||||
this.btnApply.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnApply, "btnApply");
|
||||
this.btnApply.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnApply.Name = "btnApply";
|
||||
this.btnApply.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnApply.Click += new System.EventHandler(this.BtnApplyClick);
|
||||
//
|
||||
// btnCustom
|
||||
//
|
||||
this.btnCustom.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnCustom, "btnCustom");
|
||||
this.btnCustom.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnCustom.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCustom.Name = "btnCustom";
|
||||
this.btnCustom.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnCustom.Click += new System.EventHandler(this.BtnCustomClick);
|
||||
//
|
||||
// cbxDateRelative
|
||||
//
|
||||
resources.ApplyResources(this.cbxDateRelative, "cbxDateRelative");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.cbxDateRelative.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.cbxDateRelative.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton;
|
||||
this.cbxDateRelative.Name = "cbxDateRelative";
|
||||
this.cbxDateRelative.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
//
|
||||
// cbxDateRange
|
||||
//
|
||||
resources.ApplyResources(this.cbxDateRange, "cbxDateRange");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.cbxDateRange.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.cbxDateRange.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton;
|
||||
this.cbxDateRange.Name = "cbxDateRange";
|
||||
this.cbxDateRange.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
//
|
||||
// cbxShowAll
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.cbxShowAll.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.cbxShowAll.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton;
|
||||
this.cbxShowAll.Checked = true;
|
||||
this.cbxShowAll.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.cbxShowAll.CheckValue = "Y";
|
||||
resources.ApplyResources(this.cbxShowAll, "cbxShowAll");
|
||||
this.cbxShowAll.Name = "cbxShowAll";
|
||||
this.cbxShowAll.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
//
|
||||
// cbxShowNull
|
||||
//
|
||||
resources.ApplyResources(this.cbxShowNull, "cbxShowNull");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.cbxShowNull.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.cbxShowNull.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton;
|
||||
this.cbxShowNull.Name = "cbxShowNull";
|
||||
this.cbxShowNull.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
//
|
||||
// cbxShowNotNull
|
||||
//
|
||||
resources.ApplyResources(this.cbxShowNotNull, "cbxShowNotNull");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.cbxShowNotNull.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.cbxShowNotNull.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton;
|
||||
this.cbxShowNotNull.Name = "cbxShowNotNull";
|
||||
this.cbxShowNotNull.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
//
|
||||
// btnOk
|
||||
//
|
||||
this.btnOk.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnOk, "btnOk");
|
||||
this.btnOk.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnOk.Name = "btnOk";
|
||||
this.btnOk.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnOk.Click += new System.EventHandler(this.BtnOkClick);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
|
||||
resources.ApplyResources(this.btnCancel, "btnCancel");
|
||||
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnCancel.Click += new System.EventHandler(this.BtnCancelClick);
|
||||
//
|
||||
// dtiFromDate
|
||||
//
|
||||
this.dtiFromDate.AllowEmptyState = false;
|
||||
resources.ApplyResources(this.dtiFromDate, "dtiFromDate");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiFromDate.BackgroundStyle.Class = "DateTimeInputBackground";
|
||||
this.dtiFromDate.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiFromDate.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown;
|
||||
this.dtiFromDate.ButtonDropDown.Visible = true;
|
||||
this.dtiFromDate.Format = DevComponents.Editors.eDateTimePickerFormat.Long;
|
||||
this.dtiFromDate.IsPopupCalendarOpen = false;
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiFromDate.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiFromDate.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1);
|
||||
this.dtiFromDate.MonthCalendar.ClearButtonVisible = true;
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiFromDate.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2;
|
||||
this.dtiFromDate.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90;
|
||||
this.dtiFromDate.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
|
||||
this.dtiFromDate.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||
this.dtiFromDate.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
|
||||
this.dtiFromDate.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1;
|
||||
this.dtiFromDate.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiFromDate.MonthCalendar.DisplayMonth = new System.DateTime(2012, 5, 1, 0, 0, 0, 0);
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiFromDate.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
|
||||
this.dtiFromDate.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90;
|
||||
this.dtiFromDate.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
|
||||
this.dtiFromDate.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiFromDate.MonthCalendar.TodayButtonVisible = true;
|
||||
this.dtiFromDate.Name = "dtiFromDate";
|
||||
this.dtiFromDate.ShowUpDown = true;
|
||||
this.dtiFromDate.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.dtiFromDate.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DtiDateRangeMouseDown);
|
||||
//
|
||||
// dtiToDate
|
||||
//
|
||||
this.dtiToDate.AllowEmptyState = false;
|
||||
resources.ApplyResources(this.dtiToDate, "dtiToDate");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiToDate.BackgroundStyle.Class = "DateTimeInputBackground";
|
||||
this.dtiToDate.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiToDate.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown;
|
||||
this.dtiToDate.ButtonDropDown.Visible = true;
|
||||
this.dtiToDate.Format = DevComponents.Editors.eDateTimePickerFormat.Long;
|
||||
this.dtiToDate.IsPopupCalendarOpen = false;
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiToDate.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiToDate.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1);
|
||||
this.dtiToDate.MonthCalendar.ClearButtonVisible = true;
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiToDate.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2;
|
||||
this.dtiToDate.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90;
|
||||
this.dtiToDate.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
|
||||
this.dtiToDate.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||
this.dtiToDate.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
|
||||
this.dtiToDate.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1;
|
||||
this.dtiToDate.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiToDate.MonthCalendar.DisplayMonth = new System.DateTime(2012, 5, 1, 0, 0, 0, 0);
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiToDate.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
|
||||
this.dtiToDate.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90;
|
||||
this.dtiToDate.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
|
||||
this.dtiToDate.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiToDate.MonthCalendar.TodayButtonVisible = true;
|
||||
this.dtiToDate.Name = "dtiToDate";
|
||||
this.dtiToDate.ShowUpDown = true;
|
||||
this.dtiToDate.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.dtiToDate.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DtiDateRangeMouseDown);
|
||||
//
|
||||
// cbxDateSpecific
|
||||
//
|
||||
resources.ApplyResources(this.cbxDateSpecific, "cbxDateSpecific");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.cbxDateSpecific.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.cbxDateSpecific.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton;
|
||||
this.cbxDateSpecific.Name = "cbxDateSpecific";
|
||||
this.cbxDateSpecific.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
//
|
||||
// dtiSpecificDate
|
||||
//
|
||||
this.dtiSpecificDate.AllowEmptyState = false;
|
||||
resources.ApplyResources(this.dtiSpecificDate, "dtiSpecificDate");
|
||||
this.dtiSpecificDate.AutoSelectDate = true;
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiSpecificDate.BackgroundStyle.Class = "DateTimeInputBackground";
|
||||
this.dtiSpecificDate.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiSpecificDate.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown;
|
||||
this.dtiSpecificDate.ButtonDropDown.Visible = true;
|
||||
this.dtiSpecificDate.Format = DevComponents.Editors.eDateTimePickerFormat.Long;
|
||||
this.dtiSpecificDate.IsPopupCalendarOpen = false;
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiSpecificDate.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiSpecificDate.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1);
|
||||
this.dtiSpecificDate.MonthCalendar.ClearButtonVisible = true;
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiSpecificDate.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2;
|
||||
this.dtiSpecificDate.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90;
|
||||
this.dtiSpecificDate.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
|
||||
this.dtiSpecificDate.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||
this.dtiSpecificDate.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
|
||||
this.dtiSpecificDate.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1;
|
||||
this.dtiSpecificDate.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiSpecificDate.MonthCalendar.DisplayMonth = new System.DateTime(2012, 5, 1, 0, 0, 0, 0);
|
||||
//
|
||||
//
|
||||
//
|
||||
this.dtiSpecificDate.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
|
||||
this.dtiSpecificDate.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90;
|
||||
this.dtiSpecificDate.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
|
||||
this.dtiSpecificDate.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.dtiSpecificDate.MonthCalendar.TodayButtonVisible = true;
|
||||
this.dtiSpecificDate.Name = "dtiSpecificDate";
|
||||
this.dtiSpecificDate.ShowUpDown = true;
|
||||
this.dtiSpecificDate.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.dtiSpecificDate.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DtiSpecificDateMouseDown);
|
||||
//
|
||||
// cbxCustom
|
||||
//
|
||||
resources.ApplyResources(this.cbxCustom, "cbxCustom");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.cbxCustom.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.cbxCustom.CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.RadioButton;
|
||||
this.cbxCustom.Name = "cbxCustom";
|
||||
this.cbxCustom.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
//
|
||||
// FilterDateTimePicker
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Controls.Add(this.dtiToDate);
|
||||
this.Controls.Add(this.dtiFromDate);
|
||||
this.Controls.Add(this.dtiSpecificDate);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnOk);
|
||||
this.Controls.Add(this.cbxShowNotNull);
|
||||
this.Controls.Add(this.cbxShowNull);
|
||||
this.Controls.Add(this.cboDateRelative);
|
||||
this.Controls.Add(this.btnApply);
|
||||
this.Controls.Add(this.btnCustom);
|
||||
this.Controls.Add(this.cbxCustom);
|
||||
this.Controls.Add(this.cbxDateSpecific);
|
||||
this.Controls.Add(this.cbxDateRelative);
|
||||
this.Controls.Add(this.cbxDateRange);
|
||||
this.Controls.Add(this.cbxShowAll);
|
||||
this.DoubleBuffered = true;
|
||||
this.MinimumSize = new System.Drawing.Size(258, 340);
|
||||
this.Name = "FilterDateTimePicker";
|
||||
((System.ComponentModel.ISupportInitialize)(this.dtiFromDate)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dtiToDate)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dtiSpecificDate)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbxShowAll;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbxDateRange;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbxDateRelative;
|
||||
private ButtonX btnCustom;
|
||||
private DevComponents.DotNetBar.Controls.ComboBoxEx cboDateRelative;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbxShowNull;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbxShowNotNull;
|
||||
private ButtonX btnOk;
|
||||
private ButtonX btnCancel;
|
||||
internal ButtonX btnApply;
|
||||
private DevComponents.Editors.DateTimeAdv.DateTimeInput dtiFromDate;
|
||||
private DevComponents.Editors.DateTimeAdv.DateTimeInput dtiToDate;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbxDateSpecific;
|
||||
private DevComponents.Editors.DateTimeAdv.DateTimeInput dtiSpecificDate;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbxCustom;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,769 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.SuperGrid.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// FilterDateTimePicker
|
||||
///</summary>
|
||||
[ToolboxItem(false)]
|
||||
public partial class FilterDateTimePicker : UserControl
|
||||
{
|
||||
#region Events
|
||||
|
||||
#region ValueChanged
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the DateTimePicker value has changed
|
||||
/// </summary>
|
||||
[Description("Occurs when the DateTimePicker value has changed.")]
|
||||
public event EventHandler<EventArgs> ValueChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Static data
|
||||
|
||||
private static bool _localizedStringsLoaded;
|
||||
|
||||
private static string _filterByRelativeDateString = "Filter by relative date";
|
||||
private static string _filterBySpecificDateString = "Filter by specific date";
|
||||
private static string _filterByDateRangeString = "Filter by date range";
|
||||
|
||||
private static string _currentMonth = "Current month";
|
||||
private static string _currentYear = "Current year";
|
||||
|
||||
private static string _lastMonthPeriod = "Last month period";
|
||||
private static string _last3MonthPeriod = "Last 3 month period";
|
||||
private static string _last6MonthPeriod = "Last 6 month period";
|
||||
private static string _last9MonthPeriod = "Last 9 month period";
|
||||
|
||||
private static string _lastYear = "Last Year";
|
||||
private static string _last5YearPeriod = "Last 5 year period";
|
||||
private static string _last10YearPeriod = "Last 10 year period";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private GridColumn _GridColumn;
|
||||
private string _CustomExpr;
|
||||
private bool _Cancel;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// FilterDateTimePicker
|
||||
/// </summary>
|
||||
/// <param name="gridColumn"></param>
|
||||
public FilterDateTimePicker(GridColumn gridColumn)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SuperGridControl sg = gridColumn.SuperGrid;
|
||||
|
||||
LoadLocalizedStrings(sg);
|
||||
|
||||
cbxShowAll.Text = sg.FilterShowAllString;
|
||||
cbxShowNull.Text = sg.FilterShowNullString;
|
||||
cbxShowNotNull.Text = sg.FilterShowNotNullString;
|
||||
|
||||
if (string.IsNullOrEmpty(cbxShowNull.Text) == true)
|
||||
cbxShowNull.Visible = false;
|
||||
|
||||
if (string.IsNullOrEmpty(cbxShowNotNull.Text) == true)
|
||||
cbxShowNotNull.Visible = false;
|
||||
|
||||
if (cbxShowNull.Visible == false || cbxShowNotNull.Visible == false)
|
||||
{
|
||||
int y = (cbxDateRelative.Location.Y - cbxShowAll.Size.Height) / 2;
|
||||
|
||||
cbxShowAll.Location = new Point(cbxShowAll.Location.X, y);
|
||||
|
||||
if (cbxShowNull.Visible == true)
|
||||
cbxShowNull.Location = new Point(cbxShowNull.Location.X, y);
|
||||
|
||||
if (cbxShowNotNull.Visible == true)
|
||||
cbxShowNotNull.Location = new Point(cbxShowNotNull.Location.X, y);
|
||||
}
|
||||
|
||||
btnApply.Text = sg.FilterApplyString;
|
||||
|
||||
if (sg.FilterCustomString != null)
|
||||
{
|
||||
cbxCustom.Text = sg.FilterCustomString;
|
||||
btnCustom.Text = sg.FilterCustomString + "...";
|
||||
}
|
||||
else
|
||||
{
|
||||
cbxCustom.Visible = false;
|
||||
btnCustom.Visible = false;
|
||||
}
|
||||
|
||||
cbxDateRelative.Text = _filterByRelativeDateString;
|
||||
cbxDateSpecific.Text = _filterBySpecificDateString;
|
||||
cbxDateRange.Text = _filterByDateRangeString;
|
||||
|
||||
cboDateRelative.Items.Add(CurrentMonth);
|
||||
cboDateRelative.Items.Add(CurrentYear);
|
||||
cboDateRelative.Items.Add(LastMonthPeriod);
|
||||
cboDateRelative.Items.Add(Last3MonthPeriod);
|
||||
cboDateRelative.Items.Add(Last6MonthPeriod);
|
||||
cboDateRelative.Items.Add(Last9MonthPeriod);
|
||||
cboDateRelative.Items.Add(LastYear);
|
||||
cboDateRelative.Items.Add(Last5YearPeriod);
|
||||
cboDateRelative.Items.Add(Last10YearPeriod);
|
||||
|
||||
cboDateRelative.SelectedIndex = 0;
|
||||
|
||||
_GridColumn = gridColumn;
|
||||
|
||||
FilterColumnHeaderVisualStyle style = _GridColumn.GetFilterStyle(StyleType.Default);
|
||||
|
||||
Font = style.Font;
|
||||
BackColor = style.Background.Color1;
|
||||
|
||||
Cancel = false;
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AcceptButton
|
||||
|
||||
///<summary>
|
||||
/// AcceptButton
|
||||
///</summary>
|
||||
public IButtonControl AcceptButton
|
||||
{
|
||||
get { return (btnApply); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cancel
|
||||
|
||||
///<summary>
|
||||
/// Cancel
|
||||
///</summary>
|
||||
public bool Cancel
|
||||
{
|
||||
get { return (_Cancel); }
|
||||
set { _Cancel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CurrentMonth
|
||||
|
||||
///<summary>
|
||||
/// CurrentMonth
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string CurrentMonth
|
||||
{
|
||||
get { return (_currentMonth); }
|
||||
set { _currentMonth = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CurrentYear
|
||||
|
||||
///<summary>
|
||||
/// CurrentYear
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string CurrentYear
|
||||
{
|
||||
get { return (_currentYear); }
|
||||
set { _currentYear = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CustomFilter
|
||||
|
||||
///<summary>
|
||||
/// CustomFilter
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string CustomFilter
|
||||
{
|
||||
get { return ("Custom Filter"); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LastMonthPeriod
|
||||
|
||||
///<summary>
|
||||
/// LastMonthPeriod
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string LastMonthPeriod
|
||||
{
|
||||
get { return (_lastMonthPeriod); }
|
||||
set { _lastMonthPeriod = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Last3MonthPeriod
|
||||
|
||||
///<summary>
|
||||
/// Last3MonthPeriod
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string Last3MonthPeriod
|
||||
{
|
||||
get { return (_last3MonthPeriod); }
|
||||
set { _last3MonthPeriod = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Last6MonthPeriod
|
||||
|
||||
///<summary>
|
||||
/// Last6MonthPeriod
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string Last6MonthPeriod
|
||||
{
|
||||
get { return (_last6MonthPeriod); }
|
||||
set { _last6MonthPeriod = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Last9MonthPeriod
|
||||
|
||||
///<summary>
|
||||
/// Last9MonthPeriod
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string Last9MonthPeriod
|
||||
{
|
||||
get { return (_last9MonthPeriod); }
|
||||
set { _last9MonthPeriod = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LastYear
|
||||
|
||||
///<summary>
|
||||
/// LastYear
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string LastYear
|
||||
{
|
||||
get { return (_lastYear); }
|
||||
set { _lastYear = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Last5YearPeriod
|
||||
|
||||
///<summary>
|
||||
/// Last5YearPeriod
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string Last5YearPeriod
|
||||
{
|
||||
get { return (_last5YearPeriod); }
|
||||
set { _last5YearPeriod = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Last10YearPeriod
|
||||
|
||||
///<summary>
|
||||
/// Last10YearPeriod
|
||||
///</summary>
|
||||
[Localizable(true)]
|
||||
public string Last10YearPeriod
|
||||
{
|
||||
get { return (_last10YearPeriod); }
|
||||
set { _last10YearPeriod = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetFilterExpr
|
||||
|
||||
/// <summary>
|
||||
/// GetFilterExpr
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetFilterExpr()
|
||||
{
|
||||
if (cbxCustom.Checked == true)
|
||||
return (_CustomExpr);
|
||||
|
||||
if (cbxDateSpecific.Checked == true)
|
||||
return (DateSpecificExpr);
|
||||
|
||||
if (cbxDateRange.Checked == true)
|
||||
return (DateRangeExpr);
|
||||
|
||||
if (cbxDateRelative.Checked == true)
|
||||
return (DateRelativeExpr);
|
||||
|
||||
if (cbxShowNull.Checked == true)
|
||||
return (ShowNullExpr);
|
||||
|
||||
if (cbxShowNotNull.Checked == true)
|
||||
return (ShowNotNullExpr);
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#region ShowNullExpr
|
||||
|
||||
private string ShowNullExpr
|
||||
{
|
||||
get { return ("[" + _GridColumn.Name + "] = null"); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ShowNotNullExpr
|
||||
|
||||
private string ShowNotNullExpr
|
||||
{
|
||||
get { return ("[" + _GridColumn.Name + "] != null"); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DateSpecificExpr
|
||||
|
||||
private string DateSpecificExpr
|
||||
{
|
||||
get { return ("Date([" + _GridColumn.Name +"]) = Date(#" +
|
||||
dtiSpecificDate.Value.Date.ToShortDateString() + "#)"); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DateRangeExpr
|
||||
|
||||
private string DateRangeExpr
|
||||
{
|
||||
get
|
||||
{
|
||||
return ("Date([" +
|
||||
_GridColumn.Name + "]) >= #" + dtiFromDate.Value.ToShortDateString() + "# And Date([" +
|
||||
_GridColumn.Name + "]) <= #" + dtiToDate.Value.ToShortDateString() + "#");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DateRelativeExpr
|
||||
|
||||
private string DateRelativeExpr
|
||||
{
|
||||
get
|
||||
{
|
||||
string cname = "[" + _GridColumn.Name + "]";
|
||||
|
||||
switch (cboDateRelative.SelectedIndex)
|
||||
{
|
||||
case (int)RelativeFilter.CurrentMonth:
|
||||
return (CurrentMonthExpr(cname));
|
||||
|
||||
case (int)RelativeFilter.CurrentYear:
|
||||
return (CurrentYearExpr(cname));
|
||||
|
||||
case (int)RelativeFilter.LastMonthPeriod:
|
||||
return (LastMonthExpr(cname, 1));
|
||||
|
||||
case (int)RelativeFilter.Last3MonthPeriod:
|
||||
return (LastMonthExpr(cname, 3));
|
||||
|
||||
case (int)RelativeFilter.Last6MonthPeriod:
|
||||
return (LastMonthExpr(cname, 6));
|
||||
|
||||
case (int)RelativeFilter.Last9MonthPeriod:
|
||||
return (LastMonthExpr(cname, 9));
|
||||
|
||||
case (int) RelativeFilter.LastYear:
|
||||
return (LastYearExpr(cname, 1));
|
||||
|
||||
case (int)RelativeFilter.Last5YearPeriod:
|
||||
return (LastYearExpr(cname, 5));
|
||||
|
||||
case (int)RelativeFilter.Last10YearPeriod:
|
||||
return (LastYearExpr(cname, 10));
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
}
|
||||
|
||||
#region CurrentMonthExpr
|
||||
|
||||
private string CurrentMonthExpr(string cname)
|
||||
{
|
||||
string s = String.Format(
|
||||
"Year({0}) = Year() And Month({0}) = Month()", cname);
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LastMonthExpr
|
||||
|
||||
private string LastMonthExpr(string cname, int span)
|
||||
{
|
||||
string s = String.Format(
|
||||
"Date({0}) Is Between " +
|
||||
"FirstOfMonth(AddMonths(Date(), {1})) And " +
|
||||
"EndOfMonth(Date())", cname, -span);
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CurrentYearExpr
|
||||
|
||||
private string CurrentYearExpr(string cname)
|
||||
{
|
||||
string s = String.Format(
|
||||
"Year({0}) = Year()", cname);
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LastYearExpr
|
||||
|
||||
private string LastYearExpr(string cname, int span)
|
||||
{
|
||||
string s = String.Format(
|
||||
"Year({0}) Is Between " +
|
||||
"Year(AddYears(Date(), {1})) And " +
|
||||
"Year()", cname, -span);
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessTabKey
|
||||
|
||||
/// <summary>
|
||||
/// ProcessTabKey
|
||||
/// </summary>
|
||||
/// <param name="forward"></param>
|
||||
/// <returns></returns>
|
||||
protected override bool ProcessTabKey(bool forward)
|
||||
{
|
||||
return (SelectNextControl(ActiveControl, forward, false, false, true));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessDialogKey
|
||||
|
||||
/// <summary>
|
||||
/// ProcessDialogKey
|
||||
/// </summary>
|
||||
/// <param name="keyData"></param>
|
||||
/// <returns></returns>
|
||||
protected override bool ProcessDialogKey(Keys keyData)
|
||||
{
|
||||
if (keyData == Keys.Escape)
|
||||
Cancel = true;
|
||||
|
||||
else if (keyData == Keys.Enter)
|
||||
OnValueChanged();
|
||||
|
||||
return base.ProcessDialogKey(keyData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnCustomClick
|
||||
|
||||
private void BtnCustomClick(object sender, EventArgs e)
|
||||
{
|
||||
cbxCustom.Checked = true;
|
||||
|
||||
bool ok = LaunchCustomDialog(_CustomExpr);
|
||||
|
||||
_GridColumn.SuperGrid.Focus();
|
||||
|
||||
if (ok == true)
|
||||
OnValueChanged();
|
||||
}
|
||||
|
||||
#region LaunchCustomDialog
|
||||
|
||||
private bool LaunchCustomDialog(string filterExpr)
|
||||
{
|
||||
GridPanel panel = _GridColumn.GridPanel;
|
||||
|
||||
if (panel.SuperGrid.FilterUseExtendedCustomDialog == true)
|
||||
{
|
||||
CustomFilterEx cf = new CustomFilterEx(panel, _GridColumn, filterExpr);
|
||||
|
||||
cf.Text = "'" + _GridColumn.Name + "'" + CustomFilter;
|
||||
cf.ShowInPopupVisible = false;
|
||||
|
||||
DialogResult dr = cf.ShowDialog();
|
||||
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
_CustomExpr = cf.FilterExpr;
|
||||
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomFilter cf = new CustomFilter(panel, _GridColumn, filterExpr);
|
||||
|
||||
cf.Text = "'" + _GridColumn.Name + "'" + CustomFilter;
|
||||
|
||||
DialogResult dr = cf.ShowDialog();
|
||||
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
_CustomExpr = cf.FilterExpr;
|
||||
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnApplyClick
|
||||
|
||||
private void BtnApplyClick(object sender, EventArgs e)
|
||||
{
|
||||
OnValueChanged();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnOkClick
|
||||
|
||||
private void BtnOkClick(object sender, EventArgs e)
|
||||
{
|
||||
OnClose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BtnCancelClick
|
||||
|
||||
private void BtnCancelClick(object sender, EventArgs e)
|
||||
{
|
||||
OnCancel();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnValueChanged
|
||||
|
||||
private void OnValueChanged()
|
||||
{
|
||||
Parent.Invalidate();
|
||||
|
||||
if (ValueChanged != null)
|
||||
ValueChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnClose
|
||||
|
||||
private void OnClose()
|
||||
{
|
||||
OnValueChanged();
|
||||
|
||||
PopupDropDown pdd = Parent as PopupDropDown;
|
||||
|
||||
if (pdd != null)
|
||||
pdd.Hide();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnCancel
|
||||
|
||||
private void OnCancel()
|
||||
{
|
||||
_Cancel = true;
|
||||
|
||||
PopupDropDown pdd = Parent as PopupDropDown;
|
||||
|
||||
if (pdd != null)
|
||||
pdd.Hide();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DtiSpecificDateMouseDown
|
||||
|
||||
private void DtiSpecificDateMouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
cbxDateSpecific.Checked = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DtiDateRangeMouseDown
|
||||
|
||||
private void DtiDateRangeMouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
cbxDateRange.Checked = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CboDateRelativeMouseDown
|
||||
|
||||
private void CboDateRelativeMouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
cbxDateRelative.Checked = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LoadLocalizedStrings
|
||||
|
||||
private void LoadLocalizedStrings(SuperGridControl sg)
|
||||
{
|
||||
if (_localizedStringsLoaded == false)
|
||||
{
|
||||
using (LocalizationManager lm = new LocalizationManager(sg))
|
||||
{
|
||||
string s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterByRelativeDate)) != "")
|
||||
_filterByRelativeDateString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterBySpecificDate)) != "")
|
||||
_filterBySpecificDateString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterByDateRange)) != "")
|
||||
_filterByDateRangeString = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCurrentMonth)) != "")
|
||||
_currentMonth = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterCurrentYear)) != "")
|
||||
_currentYear = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLastMonthPeriod)) != "")
|
||||
_lastMonthPeriod = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast3MonthPeriod)) != "")
|
||||
_last3MonthPeriod = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast6MonthPeriod)) != "")
|
||||
_last6MonthPeriod = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast9MonthPeriod)) != "")
|
||||
_last9MonthPeriod = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLastYear)) != "")
|
||||
_lastYear = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast5YearPeriod)) != "")
|
||||
_last5YearPeriod = s;
|
||||
|
||||
if ((s = lm.GetLocalizedString(LocalizationKeys.SuperGridFilterLast10YearPeriod)) != "")
|
||||
_last10YearPeriod = s;
|
||||
}
|
||||
|
||||
_localizedStringsLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region enums
|
||||
|
||||
#region RelativeFilter
|
||||
|
||||
/// <summary>
|
||||
/// RelativeFilter
|
||||
/// </summary>
|
||||
public enum RelativeFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// CurrentMonth
|
||||
/// </summary>
|
||||
CurrentMonth,
|
||||
|
||||
/// <summary>
|
||||
/// CurrentYear
|
||||
/// </summary>
|
||||
CurrentYear,
|
||||
|
||||
/// <summary>
|
||||
/// LastMonthPeriod
|
||||
/// </summary>
|
||||
LastMonthPeriod,
|
||||
|
||||
/// <summary>
|
||||
/// Last3MonthPeriod
|
||||
/// </summary>
|
||||
Last3MonthPeriod,
|
||||
|
||||
/// <summary>
|
||||
/// Last6MonthPeriod
|
||||
/// </summary>
|
||||
Last6MonthPeriod,
|
||||
|
||||
/// <summary>
|
||||
/// Last9MonthPeriod
|
||||
/// </summary>
|
||||
Last9MonthPeriod,
|
||||
|
||||
/// <summary>
|
||||
/// LastYear,
|
||||
/// </summary>
|
||||
LastYear,
|
||||
|
||||
/// <summary>
|
||||
/// Last5YearPeriod
|
||||
/// </summary>
|
||||
Last5YearPeriod,
|
||||
|
||||
/// <summary>
|
||||
/// Last10YearPeriod
|
||||
/// </summary>
|
||||
Last10YearPeriod,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,531 @@
|
||||
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="cboDateRelative.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="cboDateRelative.ItemHeight" type="System.Int32, mscorlib">
|
||||
<value>15</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="cboDateRelative.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>25, 77</value>
|
||||
</data>
|
||||
<data name="cboDateRelative.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>219, 21</value>
|
||||
</data>
|
||||
<data name="cboDateRelative.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name=">>cboDateRelative.Name" xml:space="preserve">
|
||||
<value>cboDateRelative</value>
|
||||
</data>
|
||||
<data name=">>cboDateRelative.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.ComboBoxEx, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cboDateRelative.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cboDateRelative.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="btnApply.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Left</value>
|
||||
</data>
|
||||
<data name="btnApply.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>9, 307</value>
|
||||
</data>
|
||||
<data name="btnApply.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>69, 21</value>
|
||||
</data>
|
||||
<data name="btnApply.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name="btnApply.Text" xml:space="preserve">
|
||||
<value>Apply</value>
|
||||
</data>
|
||||
<data name=">>btnApply.Name" xml:space="preserve">
|
||||
<value>btnApply</value>
|
||||
</data>
|
||||
<data name=">>btnApply.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnApply.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnApply.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="btnCustom.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="btnCustom.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>176, 264</value>
|
||||
</data>
|
||||
<data name="btnCustom.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>69, 21</value>
|
||||
</data>
|
||||
<data name="btnCustom.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="btnCustom.Text" xml:space="preserve">
|
||||
<value>Custom...</value>
|
||||
</data>
|
||||
<data name=">>btnCustom.Name" xml:space="preserve">
|
||||
<value>btnCustom</value>
|
||||
</data>
|
||||
<data name=">>btnCustom.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnCustom.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnCustom.ZOrder" xml:space="preserve">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="cbxDateRelative.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="cbxDateRelative.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 52</value>
|
||||
</data>
|
||||
<data name="cbxDateRelative.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>241, 20</value>
|
||||
</data>
|
||||
<data name="cbxDateRelative.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="cbxDateRelative.Text" xml:space="preserve">
|
||||
<value>Filter by relative date:</value>
|
||||
</data>
|
||||
<data name=">>cbxDateRelative.Name" xml:space="preserve">
|
||||
<value>cbxDateRelative</value>
|
||||
</data>
|
||||
<data name=">>cbxDateRelative.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.CheckBoxX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cbxDateRelative.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cbxDateRelative.ZOrder" xml:space="preserve">
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name="cbxDateRange.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="cbxDateRange.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>2, 175</value>
|
||||
</data>
|
||||
<data name="cbxDateRange.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>243, 20</value>
|
||||
</data>
|
||||
<data name="cbxDateRange.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="cbxDateRange.Text" xml:space="preserve">
|
||||
<value>Filter by date range:</value>
|
||||
</data>
|
||||
<data name=">>cbxDateRange.Name" xml:space="preserve">
|
||||
<value>cbxDateRange</value>
|
||||
</data>
|
||||
<data name=">>cbxDateRange.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.CheckBoxX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cbxDateRange.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cbxDateRange.ZOrder" xml:space="preserve">
|
||||
<value>13</value>
|
||||
</data>
|
||||
<data name="cbxShowAll.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>4, 7</value>
|
||||
</data>
|
||||
<data name="cbxShowAll.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>97, 20</value>
|
||||
</data>
|
||||
<data name="cbxShowAll.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="cbxShowAll.Text" xml:space="preserve">
|
||||
<value>Show all</value>
|
||||
</data>
|
||||
<data name=">>cbxShowAll.Name" xml:space="preserve">
|
||||
<value>cbxShowAll</value>
|
||||
</data>
|
||||
<data name=">>cbxShowAll.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.CheckBoxX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cbxShowAll.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cbxShowAll.ZOrder" xml:space="preserve">
|
||||
<value>14</value>
|
||||
</data>
|
||||
<data name="cbxShowNull.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="cbxShowNull.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>107, 7</value>
|
||||
</data>
|
||||
<data name="cbxShowNull.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>138, 20</value>
|
||||
</data>
|
||||
<data name="cbxShowNull.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="cbxShowNull.Text" xml:space="preserve">
|
||||
<value>Show null</value>
|
||||
</data>
|
||||
<data name=">>cbxShowNull.Name" xml:space="preserve">
|
||||
<value>cbxShowNull</value>
|
||||
</data>
|
||||
<data name=">>cbxShowNull.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.CheckBoxX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cbxShowNull.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cbxShowNull.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="cbxShowNotNull.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="cbxShowNotNull.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>107, 28</value>
|
||||
</data>
|
||||
<data name="cbxShowNotNull.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>138, 20</value>
|
||||
</data>
|
||||
<data name="cbxShowNotNull.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="cbxShowNotNull.Text" xml:space="preserve">
|
||||
<value>Show not null</value>
|
||||
</data>
|
||||
<data name=">>cbxShowNotNull.Name" xml:space="preserve">
|
||||
<value>cbxShowNotNull</value>
|
||||
</data>
|
||||
<data name=">>cbxShowNotNull.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.CheckBoxX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cbxShowNotNull.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cbxShowNotNull.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="btnOk.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="btnOk.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>103, 307</value>
|
||||
</data>
|
||||
<data name="btnOk.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>69, 21</value>
|
||||
</data>
|
||||
<data name="btnOk.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>106</value>
|
||||
</data>
|
||||
<data name="btnOk.Text" xml:space="preserve">
|
||||
<value>Ok</value>
|
||||
</data>
|
||||
<data name=">>btnOk.Name" xml:space="preserve">
|
||||
<value>btnOk</value>
|
||||
</data>
|
||||
<data name=">>btnOk.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnOk.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnOk.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="btnCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Right</value>
|
||||
</data>
|
||||
<data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>178, 307</value>
|
||||
</data>
|
||||
<data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>69, 21</value>
|
||||
</data>
|
||||
<data name="btnCancel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>107</value>
|
||||
</data>
|
||||
<data name="btnCancel.Text" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.Name" xml:space="preserve">
|
||||
<value>btnCancel</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.ButtonX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>btnCancel.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="dtiFromDate.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="dtiFromDate.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>22, 201</value>
|
||||
</data>
|
||||
<data name="dtiFromDate.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>222, 20</value>
|
||||
</data>
|
||||
<data name="dtiFromDate.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>110</value>
|
||||
</data>
|
||||
<data name=">>dtiFromDate.Name" xml:space="preserve">
|
||||
<value>dtiFromDate</value>
|
||||
</data>
|
||||
<data name=">>dtiFromDate.Type" xml:space="preserve">
|
||||
<value>DevComponents.Editors.DateTimeAdv.DateTimeInput, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>dtiFromDate.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>dtiFromDate.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="dtiToDate.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="dtiToDate.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>22, 227</value>
|
||||
</data>
|
||||
<data name="dtiToDate.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>222, 20</value>
|
||||
</data>
|
||||
<data name="dtiToDate.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>111</value>
|
||||
</data>
|
||||
<data name=">>dtiToDate.Name" xml:space="preserve">
|
||||
<value>dtiToDate</value>
|
||||
</data>
|
||||
<data name=">>dtiToDate.Type" xml:space="preserve">
|
||||
<value>DevComponents.Editors.DateTimeAdv.DateTimeInput, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>dtiToDate.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>dtiToDate.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="cbxDateSpecific.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="cbxDateSpecific.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>2, 113</value>
|
||||
</data>
|
||||
<data name="cbxDateSpecific.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>243, 20</value>
|
||||
</data>
|
||||
<data name="cbxDateSpecific.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="cbxDateSpecific.Text" xml:space="preserve">
|
||||
<value>Filter by specific date:</value>
|
||||
</data>
|
||||
<data name=">>cbxDateSpecific.Name" xml:space="preserve">
|
||||
<value>cbxDateSpecific</value>
|
||||
</data>
|
||||
<data name=">>cbxDateSpecific.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.CheckBoxX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cbxDateSpecific.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cbxDateSpecific.ZOrder" xml:space="preserve">
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="dtiSpecificDate.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="dtiSpecificDate.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>23, 139</value>
|
||||
</data>
|
||||
<data name="dtiSpecificDate.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>221, 20</value>
|
||||
</data>
|
||||
<data name="dtiSpecificDate.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>109</value>
|
||||
</data>
|
||||
<data name=">>dtiSpecificDate.Name" xml:space="preserve">
|
||||
<value>dtiSpecificDate</value>
|
||||
</data>
|
||||
<data name=">>dtiSpecificDate.Type" xml:space="preserve">
|
||||
<value>DevComponents.Editors.DateTimeAdv.DateTimeInput, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>dtiSpecificDate.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>dtiSpecificDate.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="cbxCustom.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="cbxCustom.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>2, 264</value>
|
||||
</data>
|
||||
<data name="cbxCustom.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>170, 20</value>
|
||||
</data>
|
||||
<data name="cbxCustom.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="cbxCustom.Text" xml:space="preserve">
|
||||
<value>Custom</value>
|
||||
</data>
|
||||
<data name=">>cbxCustom.Name" xml:space="preserve">
|
||||
<value>cbxCustom</value>
|
||||
</data>
|
||||
<data name=">>cbxCustom.Type" xml:space="preserve">
|
||||
<value>DevComponents.DotNetBar.Controls.CheckBoxX, DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04</value>
|
||||
</data>
|
||||
<data name=">>cbxCustom.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>cbxCustom.ZOrder" xml:space="preserve">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>260, 340</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>FilterDateTimePicker</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,112 @@
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
partial class FilterExprEdit
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.rtbOutput = new DevComponents.DotNetBar.Controls.RichTextBoxEx();
|
||||
this.rtbInput = new DevComponents.DotNetBar.Controls.RichTextBoxEx();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.BackColor = System.Drawing.Color.White;
|
||||
this.tableLayoutPanel1.ColumnCount = 1;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.rtbOutput, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.rtbInput, 0, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 2;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(398, 92);
|
||||
this.tableLayoutPanel1.TabIndex = 2;
|
||||
//
|
||||
// rtbOutput
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.rtbOutput.BackgroundStyle.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.rtbOutput.BackgroundStyle.Class = "RichTextBoxBorder";
|
||||
this.rtbOutput.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.rtbOutput.BackgroundStyle.PaddingBottom = 4;
|
||||
this.rtbOutput.BackgroundStyle.PaddingLeft = 4;
|
||||
this.rtbOutput.BackgroundStyle.PaddingRight = 4;
|
||||
this.rtbOutput.BackgroundStyle.PaddingTop = 4;
|
||||
this.rtbOutput.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.rtbOutput.Location = new System.Drawing.Point(3, 49);
|
||||
this.rtbOutput.Name = "rtbOutput";
|
||||
this.rtbOutput.ReadOnly = true;
|
||||
this.rtbOutput.Rtf = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft S" +
|
||||
"ans Serif;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs17\\par\r\n}\r\n";
|
||||
this.rtbOutput.Size = new System.Drawing.Size(392, 40);
|
||||
this.rtbOutput.TabIndex = 2;
|
||||
//
|
||||
// rtbInput
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.rtbInput.BackgroundStyle.Class = "RichTextBoxBorder";
|
||||
this.rtbInput.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.rtbInput.BackgroundStyle.PaddingBottom = 4;
|
||||
this.rtbInput.BackgroundStyle.PaddingLeft = 4;
|
||||
this.rtbInput.BackgroundStyle.PaddingRight = 4;
|
||||
this.rtbInput.BackgroundStyle.PaddingTop = 4;
|
||||
this.rtbInput.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.rtbInput.Location = new System.Drawing.Point(3, 3);
|
||||
this.rtbInput.Name = "rtbInput";
|
||||
this.rtbInput.Rtf = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft S" +
|
||||
"ans Serif;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs17\\par\r\n}\r\n";
|
||||
this.rtbInput.Size = new System.Drawing.Size(392, 40);
|
||||
this.rtbInput.TabIndex = 1;
|
||||
this.rtbInput.TextChanged += new System.EventHandler(this.RichTextBoxEx1TextChanged);
|
||||
//
|
||||
// FilterExprEdit
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Name = "FilterExprEdit";
|
||||
this.Size = new System.Drawing.Size(398, 92);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private DevComponents.DotNetBar.Controls.RichTextBoxEx rtbOutput;
|
||||
private DevComponents.DotNetBar.Controls.RichTextBoxEx rtbInput;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
using DevComponents.DotNetBar.SuperGrid.SuperGrid;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// FilterExprEdit
|
||||
///</summary>
|
||||
internal partial class FilterExprEdit : UserControl
|
||||
{
|
||||
#region InputTextChanged
|
||||
|
||||
public event EventHandler<EventArgs> InputTextChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private GridPanel _GridPanel;
|
||||
private GridColumn _GridColumn;
|
||||
|
||||
private string[] _Fonts;
|
||||
private int _FontSize;
|
||||
|
||||
private string _WaterMarkText;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// FilterExprEdit
|
||||
///</summary>
|
||||
public FilterExprEdit()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
rtbInput.Font = SystemFonts.DialogFont;
|
||||
|
||||
_FontSize = (int)rtbInput.Font.SizeInPoints;
|
||||
_Fonts = new string[] { rtbInput.Font.Name };
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region GridColumn
|
||||
|
||||
internal GridColumn GridColumn
|
||||
{
|
||||
get { return (_GridColumn); }
|
||||
set { _GridColumn = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GridPanel
|
||||
|
||||
internal GridPanel GridPanel
|
||||
{
|
||||
get { return (_GridPanel); }
|
||||
set { _GridPanel = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InputText
|
||||
|
||||
internal string InputText
|
||||
{
|
||||
get { return (rtbInput.Text); }
|
||||
|
||||
set
|
||||
{
|
||||
rtbInput.Text = value;
|
||||
|
||||
UpdateOutput();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RtbOutput
|
||||
|
||||
internal RichTextBoxEx RtbOutput
|
||||
{
|
||||
get { return (rtbOutput); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WaterMarkText
|
||||
|
||||
internal string WaterMarkText
|
||||
{
|
||||
get { return (_WaterMarkText); }
|
||||
|
||||
set
|
||||
{
|
||||
_WaterMarkText = value;
|
||||
|
||||
UpdateOutput();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetFocus
|
||||
|
||||
public void SetFocus()
|
||||
{
|
||||
rtbInput.Focus();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RichTextBoxEx1TextChanged
|
||||
|
||||
private void RichTextBoxEx1TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (InputTextChanged != null)
|
||||
InputTextChanged(this, EventArgs.Empty);
|
||||
|
||||
UpdateOutput();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateOutput
|
||||
|
||||
private void UpdateOutput()
|
||||
{
|
||||
if (string.IsNullOrEmpty(rtbInput.Text) == true)
|
||||
{
|
||||
OutPutWaterMarkText(rtbOutput);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
FilterMatchType mtype = (_GridColumn != null)
|
||||
? _GridColumn.GetFilterMatchType()
|
||||
: _GridPanel.GetFilterMatchType();
|
||||
|
||||
FilterEval eval = new FilterEval(
|
||||
_GridPanel, _GridColumn, mtype, rtbInput.Text);
|
||||
|
||||
OutputRtf(rtbOutput,
|
||||
eval.GetInfix(_GridPanel.SuperGrid.FilterColorizeCustomExpr));
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
OutputRtfError(rtbOutput, rtbInput.Text, exp.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region OutPutWaterMarkText
|
||||
|
||||
private void OutPutWaterMarkText(RichTextBoxEx rtbOut)
|
||||
{
|
||||
if (_GridPanel != null &&
|
||||
string.IsNullOrEmpty(_WaterMarkText) == false)
|
||||
{
|
||||
Rtf myRtf = new Rtf(_Fonts,
|
||||
_GridPanel.SuperGrid.FilterExprColors.Colors);
|
||||
|
||||
myRtf.BeginGroup(true);
|
||||
|
||||
myRtf.Font = 0;
|
||||
myRtf.FontSize = _FontSize;
|
||||
myRtf.CenterAlignText();
|
||||
|
||||
myRtf.ForeColor = (int)ExprColorPart.Dim;
|
||||
|
||||
myRtf.WriteLine();
|
||||
myRtf.WriteText(_WaterMarkText);
|
||||
|
||||
myRtf.EndGroup();
|
||||
myRtf.Close();
|
||||
|
||||
rtbOut.Rtf = myRtf.RtfText;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtbOut.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OutputRtf
|
||||
|
||||
private void OutputRtf(RichTextBoxEx rtb, string s)
|
||||
{
|
||||
s = s.Trim();
|
||||
|
||||
if (string.IsNullOrEmpty(s) == false)
|
||||
{
|
||||
Rtf myRtf = new Rtf(_Fonts,
|
||||
_GridPanel.SuperGrid.FilterExprColors.Colors);
|
||||
|
||||
myRtf.BeginGroup(true);
|
||||
|
||||
myRtf.Font = 0;
|
||||
myRtf.FontSize = _FontSize;
|
||||
myRtf.ForeColor = (int)ExprColorPart.Default;
|
||||
|
||||
Regex r = new Regex("(#@@#\\d)");
|
||||
MatchCollection mc = r.Matches(s);
|
||||
|
||||
if (mc.Count > 0)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (int i = 0; i < mc.Count; i++)
|
||||
{
|
||||
Match ma = mc[i];
|
||||
|
||||
if (ma.Index > index)
|
||||
myRtf.WriteText(s.Substring(index, ma.Index - index));
|
||||
|
||||
index = ma.Index + ma.Length;
|
||||
|
||||
myRtf.ForeColor = s[index - 1] - '0';
|
||||
}
|
||||
|
||||
if (s.Length > index)
|
||||
myRtf.WriteText(s.Substring(index, s.Length - index));
|
||||
}
|
||||
else
|
||||
{
|
||||
myRtf.WriteText(s);
|
||||
}
|
||||
|
||||
myRtf.EndGroup();
|
||||
myRtf.Close();
|
||||
|
||||
rtb.Rtf = myRtf.RtfText;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtb.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OutputRtfError
|
||||
|
||||
private void OutputRtfError(
|
||||
RichTextBoxEx rtbOut, string text, string error)
|
||||
{
|
||||
Rtf myRtf = new Rtf(_Fonts,
|
||||
_GridPanel.SuperGrid.FilterExprColors.Colors);
|
||||
|
||||
myRtf.BeginGroup(true);
|
||||
|
||||
myRtf.Font = 0;
|
||||
myRtf.FontSize = _FontSize;
|
||||
myRtf.ForeColor = (int)ExprColorPart.Default;
|
||||
|
||||
myRtf.WriteText(text);
|
||||
myRtf.WriteText(" ");
|
||||
|
||||
myRtf.ForeColor = (int)ExprColorPart.Error;
|
||||
|
||||
myRtf.WriteLine();
|
||||
myRtf.WriteLine();
|
||||
myRtf.WriteText("(" + error + ")");
|
||||
|
||||
myRtf.EndGroup();
|
||||
myRtf.Close();
|
||||
|
||||
rtbOut.Rtf = myRtf.RtfText;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,276 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// FilterScan
|
||||
///</summary>
|
||||
public class FilterScan
|
||||
{
|
||||
#region Events
|
||||
|
||||
///<summary>
|
||||
/// ScanComplete
|
||||
///</summary>
|
||||
public event EventHandler ScanComplete;
|
||||
|
||||
private delegate void ScanListDelegate(List<object> items);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private GridColumn _GridColumn;
|
||||
|
||||
private bool _Scanning;
|
||||
private Thread _ScanThread;
|
||||
private EventHandler _OnScanComplete;
|
||||
private ScanListDelegate _ScanListDelegate;
|
||||
private List<object> _ScanItems;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
///<summary>
|
||||
/// ScanItems
|
||||
///</summary>
|
||||
public List<object> ScanItems
|
||||
{
|
||||
get { return (GetScanItems()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// FilterScan
|
||||
///</summary>
|
||||
///<param name="gridColumn"></param>
|
||||
public FilterScan(GridColumn gridColumn)
|
||||
{
|
||||
_GridColumn = gridColumn;
|
||||
|
||||
_OnScanComplete = new EventHandler(OnScanComplete);
|
||||
_ScanListDelegate = new ScanListDelegate(AddScanItems);
|
||||
}
|
||||
|
||||
#region BeginScan
|
||||
|
||||
///<summary>
|
||||
/// BeginScan
|
||||
///</summary>
|
||||
public void BeginScan()
|
||||
{
|
||||
if (_Scanning == false)
|
||||
{
|
||||
_Scanning = true;
|
||||
_ScanItems = null;
|
||||
|
||||
_ScanThread = new Thread(ScanThread);
|
||||
_ScanThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EndScan
|
||||
|
||||
///<summary>
|
||||
/// BeginScan
|
||||
///</summary>
|
||||
public void EndScan()
|
||||
{
|
||||
if (_Scanning == true)
|
||||
{
|
||||
if (_ScanThread.IsAlive)
|
||||
{
|
||||
_ScanThread.Abort();
|
||||
_ScanThread.Join();
|
||||
}
|
||||
|
||||
_ScanThread = null;
|
||||
_ScanItems = null;
|
||||
|
||||
_Scanning = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ScanThread
|
||||
|
||||
private void ScanThread()
|
||||
{
|
||||
GridColumn gridColumn = _GridColumn;
|
||||
GridPanel panel = gridColumn.GridPanel;
|
||||
|
||||
List<object> scanItems = new List<object>();
|
||||
|
||||
try
|
||||
{
|
||||
if (panel != null)
|
||||
{
|
||||
ScanColumn(panel.Rows, gridColumn, scanItems);
|
||||
|
||||
RemoveDuplicates(scanItems);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
_Scanning = false;
|
||||
|
||||
gridColumn.SuperGrid.BeginInvoke(
|
||||
_ScanListDelegate, new object[] { scanItems });
|
||||
|
||||
gridColumn.SuperGrid.BeginInvoke(
|
||||
_OnScanComplete, new object[] { this, EventArgs.Empty });
|
||||
}
|
||||
}
|
||||
|
||||
#region ScanColumn
|
||||
|
||||
private void ScanColumn(
|
||||
GridItemsCollection rows, GridColumn gridColumn, List<object> scanItems)
|
||||
{
|
||||
if (rows != null && rows.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < rows.Count; i++)
|
||||
{
|
||||
GridContainer cont = rows[i] as GridContainer;
|
||||
|
||||
if (cont != null)
|
||||
{
|
||||
GridRow row = cont as GridRow;
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
GridCell cell = row.GetCell(gridColumn.ColumnIndex);
|
||||
|
||||
if (cell != null)
|
||||
{
|
||||
object value = cell.ValueEx;
|
||||
|
||||
if (value != null && value != DBNull.Value)
|
||||
{
|
||||
if (value is DateTime)
|
||||
value = ((DateTime)value).Date;
|
||||
|
||||
scanItems.Add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cont is GridGroup ||
|
||||
(gridColumn.GridPanel.FilterLevel != FilterLevel.Root && cont is GridPanel == false))
|
||||
{
|
||||
ScanColumn(cont.Rows, gridColumn, scanItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RemoveDuplicates
|
||||
|
||||
private void RemoveDuplicates(List<object> scanItems)
|
||||
{
|
||||
GridColumn gridColumn = _GridColumn;
|
||||
|
||||
if (gridColumn.DataType != null)
|
||||
{
|
||||
for (int i = scanItems.Count - 1; i >= 0; --i)
|
||||
{
|
||||
if (scanItems[i].GetType() != gridColumn.DataType)
|
||||
scanItems.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
scanItems.Sort(new ScanComparer());
|
||||
|
||||
object o = null;
|
||||
|
||||
for (int i = scanItems.Count - 1; i >= 0; --i)
|
||||
{
|
||||
if (scanItems[i].Equals(o) == true)
|
||||
scanItems.RemoveAt(i);
|
||||
else
|
||||
o = scanItems[i];
|
||||
}
|
||||
}
|
||||
|
||||
private class ScanComparer : IComparer<object>
|
||||
{
|
||||
public int Compare(object val1, object val2)
|
||||
{
|
||||
return (CompareVal.CompareTo(val1, val2));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region AddScanItems
|
||||
|
||||
private void AddScanItems(List<object> items)
|
||||
{
|
||||
_ScanItems = items;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnScanComplete
|
||||
|
||||
private void OnScanComplete(object sender, EventArgs e)
|
||||
{
|
||||
if (ScanComplete != null)
|
||||
ScanComplete(sender, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetScanItems
|
||||
|
||||
internal List<object> GetScanItems()
|
||||
{
|
||||
List<object> list = null;
|
||||
|
||||
if (_GridColumn.NeedsFilterScan == true)
|
||||
{
|
||||
_GridColumn.SuperGrid.Cursor = Cursors.AppStarting;
|
||||
|
||||
_GridColumn.NeedsFilterScan = false;
|
||||
_GridColumn.FilterScan.BeginScan();
|
||||
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
Application.DoEvents();
|
||||
System.Threading.Thread.Sleep(20);
|
||||
|
||||
list = _ScanItems;
|
||||
|
||||
if (list != null)
|
||||
break;
|
||||
}
|
||||
|
||||
_GridColumn.SuperGrid.Cursor = Cursors.Default;
|
||||
}
|
||||
else
|
||||
{
|
||||
list = _ScanItems;
|
||||
}
|
||||
|
||||
return (list);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid
|
||||
{
|
||||
///<summary>
|
||||
/// FilterUserData
|
||||
///</summary>
|
||||
static public class FilterUserData
|
||||
{
|
||||
#region Static data
|
||||
|
||||
private static string _filterPath;
|
||||
private static List<UserFilterData> _filterData;
|
||||
|
||||
#endregion
|
||||
|
||||
static FilterUserData()
|
||||
{
|
||||
_filterPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
|
||||
"\\DotNetBar\\UserFilterData.xml";
|
||||
}
|
||||
|
||||
#region GetFilterData
|
||||
|
||||
///<summary>
|
||||
/// GetFilterData
|
||||
///</summary>
|
||||
///<returns></returns>
|
||||
static public List<UserFilterData> GetFilterData(GridPanel gridPanel)
|
||||
{
|
||||
if (_filterData != null)
|
||||
return (_filterData);
|
||||
|
||||
return (LoadFilterData(gridPanel));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LoadFilterData
|
||||
|
||||
///<summary>
|
||||
/// LoadFilterData
|
||||
///</summary>
|
||||
///<returns></returns>
|
||||
static public List<UserFilterData> LoadFilterData(GridPanel gridPanel)
|
||||
{
|
||||
_filterData = new List<UserFilterData>();
|
||||
|
||||
string path = _filterPath;
|
||||
|
||||
if (gridPanel.SuperGrid.DoFilterLoadUserDataEvent(
|
||||
gridPanel, ref path, ref _filterData) == false)
|
||||
{
|
||||
if (File.Exists(path) == true)
|
||||
{
|
||||
using (XmlReader reader = XmlReader.Create(path))
|
||||
{
|
||||
UserFilterData fd = null;
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.IsStartElement())
|
||||
{
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "Filter":
|
||||
fd = new UserFilterData();
|
||||
_filterData.Add(fd);
|
||||
break;
|
||||
|
||||
case "Name":
|
||||
if (reader.Read())
|
||||
{
|
||||
if (fd != null)
|
||||
fd.Name = reader.Value.Trim();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Description":
|
||||
if (reader.Read())
|
||||
{
|
||||
if (fd != null)
|
||||
fd.Description = reader.Value.Trim();
|
||||
}
|
||||
break;
|
||||
|
||||
case "Expression":
|
||||
if (reader.Read())
|
||||
{
|
||||
if (fd != null)
|
||||
fd.Expression = reader.Value.Trim();
|
||||
}
|
||||
break;
|
||||
|
||||
case "ReferNames":
|
||||
if (reader.Read())
|
||||
{
|
||||
if (fd != null)
|
||||
fd.ReferNamesString = reader.Value.Trim();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (_filterData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StoreFilterData
|
||||
|
||||
///<summary>
|
||||
/// StoreFilterData
|
||||
///</summary>
|
||||
///<param name="gridPanel"></param>
|
||||
///<param name="filterData"></param>
|
||||
static public void StoreFilterData(GridPanel gridPanel, List<UserFilterData> filterData)
|
||||
{
|
||||
for (int i = filterData.Count - 1; i >= 0; --i)
|
||||
{
|
||||
UserFilterData fd = filterData[i];
|
||||
|
||||
if (fd.Expression != null)
|
||||
{
|
||||
string expr = fd.Expression.Trim();
|
||||
|
||||
if (expr.Length <= 0)
|
||||
filterData.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
string path = _filterPath;
|
||||
|
||||
if (gridPanel.SuperGrid.DoFilterStoreUserDataEvent(
|
||||
gridPanel, ref path, ref _filterData) == false)
|
||||
{
|
||||
string dir = Path.GetDirectoryName(path);
|
||||
|
||||
if (dir != null)
|
||||
{
|
||||
if (Directory.Exists(dir) == false)
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(path))
|
||||
{
|
||||
writer.WriteStartDocument();
|
||||
writer.WriteStartElement("FilterData");
|
||||
|
||||
foreach (UserFilterData fd in filterData)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fd.Expression) == false)
|
||||
{
|
||||
if (String.IsNullOrEmpty(fd.Name) == false)
|
||||
{
|
||||
writer.WriteStartElement("Filter");
|
||||
writer.WriteElementString("Name", fd.Name);
|
||||
|
||||
if (String.IsNullOrEmpty(fd.Description) == false)
|
||||
writer.WriteElementString("Description", fd.Description);
|
||||
|
||||
writer.WriteElementString("Expression", fd.Expression);
|
||||
|
||||
if (String.IsNullOrEmpty(fd.ReferNamesString) == false)
|
||||
writer.WriteElementString("ReferNames", fd.ReferNamesString);
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
writer.WriteEndDocument();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// User Filter expression data
|
||||
///</summary>
|
||||
public class UserFilterData
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private string _Name;
|
||||
private string _Description;
|
||||
private string _Expression;
|
||||
|
||||
private List<string> _ReferNames = new List<string>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Description
|
||||
|
||||
///<summary>
|
||||
/// Description
|
||||
///</summary>
|
||||
public string Description
|
||||
{
|
||||
get { return (_Description); }
|
||||
set { _Description = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Expression
|
||||
|
||||
///<summary>
|
||||
/// Expression
|
||||
///</summary>
|
||||
public string Expression
|
||||
{
|
||||
get { return (_Expression); }
|
||||
set { _Expression = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Name
|
||||
|
||||
///<summary>
|
||||
/// Name
|
||||
///</summary>
|
||||
public string Name
|
||||
{
|
||||
get { return (_Name); }
|
||||
set { _Name = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReferNames
|
||||
|
||||
///<summary>
|
||||
/// ReferNames
|
||||
///</summary>
|
||||
public List<string> ReferNames
|
||||
{
|
||||
get { return (_ReferNames); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReferNamesString
|
||||
|
||||
///<summary>
|
||||
/// ReferNamesString
|
||||
///</summary>
|
||||
public string ReferNamesString
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (string s in _ReferNames)
|
||||
{
|
||||
sb.Append(s);
|
||||
sb.Append(",");
|
||||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
sb.Length--;
|
||||
|
||||
return (sb.ToString());
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_ReferNames.Clear();
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
string[] names = value.Split(',');
|
||||
|
||||
foreach (string s in names)
|
||||
_ReferNames.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||