コード例 #1
0
 void SetUpSortList()
 {
     SortButtons.Clear();
     if (m_SortDialog.m_MainSortList != null)
     {
         for (int i = 0; i < m_SortDialog.m_MainSortList.Length; i++)
         {
             AddSortData(m_SortDialog.m_MainSortList[i]);
         }
     }
 }
コード例 #2
0
        private void CreateSortButton(Control ctr, string name, IFactor factor = null,
                                      SortingModes sortMode = SortingModes.PositionAll)
        {
            Button btn = new Button
            {
                Text    = @"S",
                Size    = new Size(15, 20),
                Enabled = Stock.AllStocksInListAnalyzed
            };

            SortButtons.Add(btn);
            ctr.Parent.Controls.Add(btn);
            btn.BringToFront();
            btn.Location = new Point(ctr.Location.X + ctr.Width + (factor == null ? 12 : factor is Metric ? 30 : 40),
                                     ctr.Location.Y - 2);
            btn.Click += (o, args) =>
            {
                sortMode = factor is Coefficient ? SortingModes.Coefficeint :
                           factor is Metric ? SortingModes.Metric : sortMode;
                SortList(sortMode, m_selectedList.StList.ToList(), factor);
            };
            var text = "Sort";

            Label tb = null;

            btn.MouseEnter += (o, args) =>
            {
                var sender = o as Control ?? throw new ArgumentNullException();
                if (tb == null)
                {
                    tb = new Label
                    {
                        Margin      = new Padding(4),
                        Name        = $"textBoxHelp_{name}",
                        BorderStyle = BorderStyle.Fixed3D,
                        Text        = text,
                        AutoSize    = true
                    };
                    int x = sender.Location.X;
                    int y = sender.Location.Y;
                    tb.Font     = new Font(tb.Font.FontFamily, tb.Font.Size + 1);
                    tb.Location = new Point(x - sender.Width / 2, y - sender.Height + 1);
                    btn.Parent.Controls.Add(tb);
                    tb.BringToFront();
                }
                else
                {
                    tb.Visible = true;
                    tb.BringToFront();
                }
            };
            btn.MouseLeave += (o, args) => { tb.Visible = false; };
        }
コード例 #3
0
    void AddSortData(MAINMENU_SORT_SEQ sortType)
    {
        SortDialogTextButtonListContext sortButton = new SortDialogTextButtonListContext();

        sortButton.SortType      = sortType;
        sortButton.OffNameText   = GameTextUtil.GetSortDialogSortText(sortType);
        sortButton.OnNameText    = string.Format(GameTextUtil.GetText("filter_choice"), GameTextUtil.GetSortDialogSortText(sortType));
        sortButton.OffTextColor  = ColorUtil.COLOR_WHITE;
        sortButton.OnTextColor   = ColorUtil.COLOR_YELLOW;
        sortButton.DidSelectItem = OnClickSortButton;
        SortButtons.Add(sortButton);
    }