Exemplo n.º 1
0
 private void UpdateCtrlBtnContent()
 {
     if (data.Count == 1)
     {
         tw_ctrlbutton.FontSize = 18;
         tw_ctrlbutton.Content  = nowdata.GetName();
     }
     else
     {
         tw_ctrlbutton.FontSize = 30;
         tw_ctrlbutton.Content  = data.Count.ToString();
     }
 }
Exemplo n.º 2
0
        private Canvas CreateButton(TagBase tag)
        {
            int    tagindex = data.IndexOf(tag);
            Canvas cv       = new Canvas();

            cv.Height     = CtrlButtonSize;
            cv.Width      = CtrlButtonSize;
            cv.Background = new SolidColorBrush(Color.FromArgb(1, 1, 1, 1));
            cv.Children.Add(CreatePath("M 1,10 L 1,1 L 10,1"));
            cv.Children.Add(CreatePath("M 40,1 L 49,1 L 49,10"));
            cv.Children.Add(CreatePath("M 49,40 L 49,49 L 40,49"));
            cv.Children.Add(CreatePath("M 1,40 L 1,49 L 10,49"));
            Button btn = new Button();

            btn.Style      = FindResource("btnstyle") as Style;
            btn.FontFamily = new FontFamily("Agency FB");
            btn.FontSize   = 18;
            btn.Width      = CtrlButtonSize - 4;
            btn.Height     = CtrlButtonSize - 4;
            btn.Margin     = new Thickness(2, 2, 0, 0);
            btn.FontWeight = FontWeights.Bold;
            btn.Foreground = MainWindow.MakeBrush(FontColor);
            if (tag == nowdata)
            {
                btn.Background = MainWindow.MakeBrush(SelectColor);
            }
            btn.BorderBrush                = null;
            btn.Content                    = tag.GetName();
            btn.Click                     += (s, e) => { ExchangeData(tag); };
            btn.MouseRightButtonUp        += (s, e) => { CtrlButtonRemoveData(tag); };
            cv.PreviewMouseLeftButtonDown += (s, e) =>
            {
                if (nowdata == tag)
                {
                    ((MainWindow)Application.Current.MainWindow).StartSplitBgWorker(this, tag, tagindex);
                }
            };
            cv.Children.Add(btn);
            return(cv);
        }