protected override void OnMouseLeave(EventArgs e)
 {
     base.OnMouseLeave(e);
     ForeGroundBrush = Brushes.GetBrush(colors[DropDownListColor.ForeGroundBrushNormal]) as SolidBrush;
     TriangleBrush   = Brushes.GetBrush(colors[DropDownListColor.TriangleBrushNormal]) as SolidBrush;
     TextBrush       = Brushes.GetBrush(colors[DropDownListColor.TextBrushNormal]) as SolidBrush;
     Invalidate();
 }
Beispiel #2
0
        private void cboTerrain_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Terrain terrain = cboTerrain.SelectedItem as Terrain;

            if (terrain != null)
            {
                ctlTerrain.Fill  = Brushes.GetBrush(terrain.GetColor());
                _selectedTerrain = terrain;
            }
        }
Beispiel #3
0
        private UIElement CreateTileHighlight(double x, double y, double width, double height)
        {
            Rectangle obj = new Rectangle();

            obj.Width  = width;
            obj.Height = height;
            obj.Stroke = Brushes.GetBrush(Colors.Yellow);
            obj.SetValue(Canvas.LeftProperty, x);
            obj.SetValue(Canvas.TopProperty, y);
            return(obj);
        }
Beispiel #4
0
        public void Refresh(RdlPlace place)
        {
            this.Place          = new Place(place);
            this.RenderLocation = new Point(this.Place.X * this.Width, this.Place.Y * this.Height);
            this.SetExits();

            var terrain = Game.Terrain.Where(t => t.ID == place.Properties.GetValue <int>("Terrain")).FirstOrDefault();

            if (terrain != null)
            {
                this.Fill = Brushes.GetBrush(terrain.GetColor());
            }
        }
        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;
        }