This commit is contained in:
73
PROMS/Volian.Svg.Library/SvgFillSettings.cs
Normal file
73
PROMS/Volian.Svg.Library/SvgFillSettings.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Volian.Svg.Library
|
||||
{
|
||||
public class SvgFillSettings
|
||||
{
|
||||
#region ctor
|
||||
public SvgFillSettings() { ;}
|
||||
public SvgFillSettings(Color myColor)
|
||||
{
|
||||
_Fill = ColorTranslator.ToHtml(myColor);
|
||||
}
|
||||
//public SvgFillSettings(string myFill)
|
||||
//{
|
||||
// _Fill = myFill;
|
||||
//}
|
||||
#endregion
|
||||
#region Inheritance
|
||||
private SvgFillSettings _MyParentsSettings = null;
|
||||
public SvgFillSettings MyParentsSettings
|
||||
{
|
||||
get { return _MyParentsSettings; }
|
||||
set
|
||||
{
|
||||
_MyParentsSettings = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Internal Inherited Properties
|
||||
protected string InheritedFill
|
||||
{
|
||||
get
|
||||
{
|
||||
// Fill = "", "0" - Default, otherwise the value
|
||||
if (_Fill != "" && _Fill != "0" && _Fill.ToLower() != "empty") return _Fill; // Current Value
|
||||
if (_MyParentsSettings != null) return _MyParentsSettings.InheritedFill; // Inherited
|
||||
return "Black"; // Default
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Inherited Values
|
||||
public Color FillColor
|
||||
{
|
||||
get
|
||||
{
|
||||
// Fill = "None" - Eliminate, otherwise the value
|
||||
string myFill = InheritedFill;
|
||||
if (myFill.ToLower() == "none") // Eliminate
|
||||
return Color.Transparent;
|
||||
return ColorTranslator.FromHtml(myFill);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == Color.Transparent || value == Color.Empty)
|
||||
_Fill = "none";
|
||||
else
|
||||
_Fill = ColorTranslator.ToHtml(value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Properties
|
||||
private string _Fill = string.Empty; // Default value is None
|
||||
public string Fill
|
||||
{
|
||||
get { return _Fill; }
|
||||
set { _Fill = value; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user