public DropDownList(DropDownList lst) : this() { values = lst.values == null ? null : lst.values.ToList(); Formatter = lst.Formatter; cellHeight = lst.cellHeight; paddingLeft = lst.paddingLeft; cellFont = lst.cellFont; CalcHeightAuto = lst.CalcHeightAuto; CalcWidthAuto = lst.CalcWidthAuto; startItemIndex = lst.startItemIndex; selectedCellIndex = lst.selectedCellIndex; clCellBack = lst.clCellBack; clCellFont = lst.clCellFont; clCellFontHl = lst.clCellFontHl; clCellBackHl = lst.clCellBackHl; CalcWidthAuto = lst.CalcWidthAuto; CalcHeightAuto = lst.CalcHeightAuto; MinWidth = lst.MinWidth; MaxWidth = lst.MaxWidth; Width = lst.Width; Height = lst.Height; DoubleBuffered = true; columns = lst.columns == null ? null : lst.columns.ToList(); }
public RobotTimeframesForm() { InitializeComponent(); Localizer.LocalizeControl(this); listTickers = new DropDownList { CalcHeightAuto = true, Width = 90, MaxLines = 15, Values = DalSpot.Instance.GetTickerNames().Cast<object>().ToList() }; listTimeframes = new DropDownList { CalcHeightAuto = true, Width = 90, MaxLines = 15, Values = BarSettingsStorage.Instance.GetCollection() .Select(b => BarSettingsStorage.Instance.GetBarSettingsFriendlyName(b)) .Cast<object>() .ToList() }; SetupGrid(); }
public ChartIconDropDown() { listControl = new DropDownList { CalcHeightAuto = true, Width = 150, MaxLines = 12 }; }
public ChartIconDropDownRowCells(object valueObject, DropDownList.FormatValueDel formatter) { TypeOfRow = RowType.Row; if (valueObject is IChartIconDropDownRow) { cells = ((IChartIconDropDownRow) valueObject).GetCells(); return; } cells = new[] { new ChartIconDropDownCell { CellString = formatter(valueObject), CellValue = valueObject } }; }
public DropDownListPopup(DropDownList list) { Margin = Padding.Empty; Padding = Padding.Empty; AutoSize = false; Width = list.Width; Height = list.Height; list.closeControl += Close; var host = new ToolStripControlHost(list) { Margin = Padding.Empty, Padding = Padding.Empty, AutoSize = false }; Items.Add(host); }
protected override void OnCreateControl() { base.OnCreateControl(); TrianglePadding = new Point(25, 3); trianglePointArray = triangleClosePointArray; SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); BackColor = Color.Transparent; ForeGroundBrush = Brushes.GetBrush(colors[DropDownListColor.ForeGroundBrushNormal]) as SolidBrush; TriangleBrush = Brushes.GetBrush(colors[DropDownListColor.TriangleBrushNormal]) as SolidBrush; TrianglePen = new Pen(colors[DropDownListColor.TrianglePen], 1); TextBrush = Brushes.GetBrush(colors[DropDownListColor.TextBrushNormal]) as SolidBrush; var quoteTradeControl = Parent as QuoteTradeControl; //Получаем родительский контрол, что бы узнать текущую валютную пару var currentTicker = quoteTradeControl != null ? quoteTradeControl.Ticker : string.Empty; // Задаём возможные значения объёма торгов dropList = new DropDownList { CalcHeightAuto = true, MaxLines = 15, Values = GetQuoteTradeListItemsFromXml(currentTicker).Cast<object>().ToList(), ClCellBack = Color.FromArgb(200, 128, 215, 128), ClCellBackHl = Color.FromArgb(250, 128, 155, 128), Tag = currentTicker }; dropList.cellClicked += DropListMouseUp; // В случае ошибки приведения, присваиваем текущему значению первое из списка if (quoteTradeControl == null) { CurrentSelectedItem = dropList.Values[0] as QuoteTradeListItem; return; } // Если нормально получили ссылку на родительский контрол то сохранённое значение для валютной пары этого контрола CurrentSelectedItem = dropList.Values.FirstOrDefault(x => { var quoteTradeListItem = x as QuoteTradeListItem; return quoteTradeListItem != null && quoteTradeListItem.VolumeTrade == UserSettings.Instance.FastDealSelectedVolumeDict.FirstOrDefault(y => y.Key == currentTicker).Value; }) as QuoteTradeListItem ?? dropList.Values[0] as QuoteTradeListItem; }