/// <summary> /// Adds pattern to the list /// </summary> internal void AddPattern(MapWinGIS.LinePattern pattern) { if (pattern != null && pattern.Count > 0) { _patterns.Add(pattern); this.ItemCount = _patterns.Count; } }
/// <summary> /// Draws the next icon from the list /// </summary> void Control_OnDrawItem(Graphics graphics, RectangleF rect, int itemIndex, bool selected) { IntPtr ptr = graphics.GetHdc(); MapWinGIS.LinePattern pattern = _patterns[itemIndex]; pattern.Draw(ptr.ToInt32(), rect.X + 1.0f, rect.Y + 1.0f, (int)rect.Width - 2, (int)rect.Height - 2, Colors.ColorToUInteger(this.BackColor)); graphics.ReleaseHdc(); }
/// <summary> /// Adds default patterns to the list /// </summary> private void AddDefaultPatterns() { _patterns.Clear(); MapWinGIS.LinePattern pattern = new MapWinGIS.LinePattern(); MapWinGIS.Utils utils = new MapWinGIS.Utils(); pattern.AddLine(utils.ColorByName(MapWinGIS.tkMapColor.Red), 1, MapWinGIS.tkDashStyle.dsSolid); _patterns.Add(pattern); // TODO: mode patterns can be added this.ItemCount = _patterns.Count; }
/// <summary> /// Loads all the icons form the current path /// </summary> /// <param name="path"></param> public void LoadFromXML() { _patterns.Clear(); XmlDocument xmlDoc = new XmlDocument(); string filename = this.get_FileName(); // reading from the file if (System.IO.File.Exists(filename)) { xmlDoc.Load(filename); XmlElement xelSchemes = xmlDoc.DocumentElement["LinePatters"]; if (xelSchemes != null) { foreach (XmlNode nodePatter in xelSchemes.ChildNodes) { MapWinGIS.LinePattern pattern = new MapWinGIS.LinePattern(); pattern.Deserialize(nodePatter.InnerText); if (pattern.Count > 0) { _patterns.Add(pattern); } } } } // load some default ones if none were loaded if (_patterns.Count == 0) { this.AddDefaultPatterns(); } this.ItemCount = _patterns.Count; if (this.ItemCount > 0) { this.SelectedIndex = 0; } }