void SetDefaultValues() { _lineCaps = new SortedDictionary <string, LineCapEx>(); foreach (LineCapEx cap in LineCapEx.GetValues()) { _lineCaps.Add(cap.Name, cap); } }
protected override void FinishDrawing() { LineShape go = new LineShape(_Points[0].layerCoord, _Points[1].layerCoord); //go.Pen.EndCap = new System.Drawing.Drawing2D.AdjustableArrowCap(2,1,true); LineCapEx cap = LineCapEx.FromName("ArrowF10"); cap.Size = 10; go.Pen.EndCap = cap; // deselect the text tool this._grac.CurrentGraphToolType = typeof(GraphControllerMouseHandlers.ObjectPointerMouseHandler); _grac.Layers[_grac.CurrentLayerNumber].GraphObjects.Add(go); _grac.RefreshGraph(); }
protected override void FinishDrawing() { LineShape go = new LineShape(_Points[0].layerCoord, _Points[1].layerCoord); //go.Pen.EndCap = new System.Drawing.Drawing2D.AdjustableArrowCap(2,1,true); LineCapEx cap = LineCapEx.FromName("ArrowF10"); cap.Size = 10; go.Pen.EndCap = cap; // deselect the text tool _grac.SetGraphToolFromInternal(Altaxo.Gui.Graph.Viewing.GraphToolType.ObjectPointer); _grac.ActiveLayer.GraphObjects.Add(go); _grac.WinFormsController.RefreshGraph(); }
void EhEndCapSize_SelectionChangeCommitted(object sender, EventArgs e) { _userChangedEndCapSize = true; if (_pen != null) { LineCapEx cap = _pen.EndCap; cap.Size = _cbEndCapSize.Thickness; BeginPenUpdate(); _pen.EndCap = cap; EndPenUpdate(); OnPenChanged(); } }
protected override void OnDrawItem(DrawItemEventArgs e) { Graphics grfx = e.Graphics; Rectangle rectColor = new Rectangle(e.Bounds.Left, e.Bounds.Top, 2 * e.Bounds.Height, e.Bounds.Height); rectColor.Inflate(-1, -1); Rectangle rectText = new Rectangle(e.Bounds.Left + 2 * e.Bounds.Height, e.Bounds.Top, e.Bounds.Width - 2 * e.Bounds.Height, e.Bounds.Height); if (this.Enabled) { e.DrawBackground(); } //grfx.DrawRectangle(new Pen(e.ForeColor), rectColor); LineCapEx item = e.Index >= 0 ? (LineCapEx)Items[e.Index] : LineCapEx.Flat; SolidBrush foreColorBrush = new SolidBrush(e.ForeColor); Pen linePen = new Pen(foreColorBrush, (float)Math.Ceiling(0.4 * e.Bounds.Height)); if (_isForEndCap) { item.SetPenEndCap(linePen); grfx.DrawLine(linePen, rectColor.Left, 0.5f * (rectColor.Top + rectColor.Bottom), rectColor.Right - 0.25f * rectColor.Width, 0.5f * (rectColor.Top + rectColor.Bottom)); } else { item.SetPenStartCap(linePen); grfx.DrawLine(linePen, rectColor.Left + 0.25f * rectColor.Width, 0.5f * (rectColor.Top + rectColor.Bottom), rectColor.Right, 0.5f * (rectColor.Top + rectColor.Bottom)); } grfx.DrawString(item.ToString(), Font, foreColorBrush, rectText); }
void EhEndCap_SelectionChangeCommitted(object sender, EventArgs e) { if (_pen != null) { LineCapEx cap = _cbEndCap.LineCapEx; if (_userChangedEndCapSize && _cbEndCapSize != null) { cap.Size = _cbEndCapSize.Thickness; } BeginPenUpdate(); _pen.EndCap = cap; EndPenUpdate(); if (_cbEndCapSize != null) { _cbEndCapSize.Thickness = cap.Size; } OnPenChanged(); } }
void SetDataSource(LineCapEx selected) { if (_lineCaps == null) { SetDefaultValues(); } if (!_lineCaps.ContainsKey(selected.Name)) { _lineCaps.Add(selected.Name, selected); } this.BeginUpdate(); Items.Clear(); foreach (KeyValuePair <string, LineCapEx> o in _lineCaps) { Items.Add(o.Value); } SelectedItem = LineCapEx.FromName(selected.Name); this.EndUpdate(); }
public LineCapComboBox(bool isForEndCap, LineCapEx selected) : this() { _isForEndCap = isForEndCap; SetDataSource(selected); }