Example #1
0
 /// <summary>
 /// 初始化 加载遍历底纹图
 /// </summary>
 private void LoadHatchBrushes()
 {
     foreach (HatchStyle style in Enum.GetValues(typeof(HatchStyle)))
     {
         HatchBrush brush = new HatchBrush(style, Color.Black, Color.White);
         FlowCell   cell  = new FlowCell(brush);
         flowLayoutPanelEx_hatch.Add(cell);
     }
 }
Example #2
0
        /// <summary>
        /// ToFlowCell("#000000")
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        FlowCell ToFlowCell(string text)
        {
            ColorConverter wcc  = new ColorConverter();
            Color          clr  = (Color)wcc.ConvertFromString(text);
            FlowCell       cell = new FlowCell(new SolidBrush(clr));

            cell.Text = text;
            return(cell);
        }
Example #3
0
        public void Add(FlowCell cell)
        {
            list.Add(cell);//添加到链表
            FlowCellUserControl CellUserControl = new FlowCellUserControl(cell);

            CellUserControl.Length          = CellLength;
            CellUserControl.EventSelectTrue = CellPresetUserControl_SelectedTrue;
            CellUserControl.EventMenuDelete = CellPresetUserControl_MenuDelete;
            Controls.Add(CellUserControl);
        }
Example #4
0
        public void Deserialize(FileStream fs, BinaryFormatter bf)
        {
            int      count = (int)bf.Deserialize(fs);
            FlowCell cell;

            for (int i = 0; i < count; i++)
            {
                cell = new FlowCell(null);
                cell.Deserialize(fs, bf);
                Data.Add(cell);
            }
        }
Example #5
0
        //添加flow按钮
        private void button_solid_add(object sender, EventArgs e)
        {
            Color        clr    = solidUserControl1.color;
            FlowCell     cell   = new FlowCell(new SolidBrush(clr));
            Form_Message fm_msg = new Form_Message();
            string       str    = clr.ToString();

            if (fm_msg.ShowDialog() == DialogResult.OK)
            {
                cell.Text = str;
                flowLayoutPanelEx_solid.Add(cell);
            }
        }
Example #6
0
        private void button_linear_add_Click(object sender, EventArgs e)
        {
            NSLinearGradientBrushInfo LinearGradientBrushInfo = linearGradientUserControl1.LinearGradientBrushInfo;
            LinearGradientBrush       br = new LinearGradientBrush(ClientRectangle, Color.Red, Color.FromArgb(255, 0, 255, 0), LinearGradientMode.Horizontal);

            br.InterpolationColors = LinearGradientBrushInfo.ColorBlend;
            FlowCell     cell   = new FlowCell(br);
            Form_Message fm_msg = new Form_Message();
            string       str    = "渐变色" + flowLayoutPanelEx_linear.Controls.Count.ToString();

            if (fm_msg.ShowDialog() == DialogResult.OK)
            {
                cell.Text = str;
                flowLayoutPanelEx_linear.Add(cell);
            }
        }
Example #7
0
        private void button_radiate_add_Click(object sender, EventArgs e)
        {
            NSLinearGradientBrushInfo LinearGradientBrushInfo = linearGradientUserControl2.LinearGradientBrushInfo;


            PathGradientBrush br = new PathGradientBrush(_pointsPathBrushExample);

            br.InterpolationColors = LinearGradientBrushInfo.ColorBlend;
            FlowCell     cell   = new FlowCell(br);
            Form_Message fm_msg = new Form_Message();
            string       str    = "渐变色" + flowLayoutPanelEx_radiate.Controls.Count.ToString();

            if (fm_msg.ShowDialog() == DialogResult.OK)
            {
                cell.Text = str;
                flowLayoutPanelEx_radiate.Add(cell);
            }
        }
Example #8
0
 void UpdateData(bool ToControl)
 {
     if (ToControl)
     {
         Controls.Clear();
         for (int i = 0; i < list.Count; i++)
         {
             FlowCell            cell            = list[i];
             FlowCellUserControl CellUserControl = new FlowCellUserControl(cell);
             CellUserControl.Length          = CellLength;
             CellUserControl.EventSelectTrue = CellPresetUserControl_SelectedTrue;
             CellUserControl.EventMenuDelete = CellPresetUserControl_MenuDelete;
             Controls.Add(CellUserControl);
         }
     }
     else
     {
         //...
     }
 }
Example #9
0
        /// <summary>
        /// 转换到 FlowCell  clrs和float ColorBlend
        /// </summary>
        /// <param name="IsLinear"> 真:渐变画刷,假:路径画刷</param>
        /// <param name="clrs"></param>
        /// <param name="floats"></param>
        /// <param name="angle"></param>
        /// <returns></returns>
        FlowCell ToFlowCell(bool IsLinear, Color[] clrs, float[] floats, float angle = 0)
        {
            ColorBlend cb = new ColorBlend(clrs.Length);

            cb.Colors = clrs; cb.Positions = floats;

            FlowCell cell;

            if (IsLinear)
            {
                LinearGradientBrush br = new LinearGradientBrush(ClientRectangle, Color.Red, Color.FromArgb(255, 0, 255, 0), LinearGradientMode.Horizontal);
                br.InterpolationColors = cb;
                cell = new FlowCell(br, angle);
            }
            else
            {
                PathGradientBrush br = new PathGradientBrush(_pointsPathBrushExample);
                br.InterpolationColors = cb;
                cell = new FlowCell(br);
            }
            return(cell);
        }
Example #10
0
 public FlowCellUserControl(FlowCell CellPreset)
 {
     InitializeComponent();
     this.CellPreset = CellPreset;
 }
Example #11
0
        private void button_radiate_flowdefault_Click(object sender, EventArgs e)
        {
            flowLayoutPanelEx_radiate.ClearAllCell();
            ColorBlend cb = new ColorBlend(3);

            Color[] clrs = new Color[3];
            clrs[0] = Color.Black;
            clrs[1] = Color.White;
            clrs[2] = Color.Black;
            float[] floats = new float[3];
            floats[0] = 0;
            floats[1] = 0.5f;
            floats[2] = 1;
            cb.Colors = clrs; cb.Positions = floats;

            PathGradientBrush br = new PathGradientBrush(_pointsPathBrushExample);

            br.InterpolationColors = cb;
            FlowCell cell1 = new FlowCell(br);

            flowLayoutPanelEx_radiate.Add(ToFlowCell(false, clrs, floats));
            clrs[0]   = Color.Red;
            clrs[1]   = Color.Yellow;
            clrs[2]   = Color.Black;
            floats[0] = 0;
            floats[1] = 0.5f;
            floats[2] = 1;
            cb.Colors = clrs; cb.Positions = floats;
            flowLayoutPanelEx_radiate.Add(ToFlowCell(false, clrs, floats));
            clrs[0]   = Color.Red;
            clrs[1]   = Color.White;
            clrs[2]   = Color.Red;
            floats[0] = 0;
            floats[1] = 0.5f;
            floats[2] = 1;
            cb.Colors = clrs; cb.Positions = floats;
            flowLayoutPanelEx_radiate.Add(ToFlowCell(false, clrs, floats));
            clrs[0]   = Color.Blue;
            clrs[1]   = Color.Yellow;
            clrs[2]   = Color.Blue;
            floats[0] = 0;
            floats[1] = 0.5f;
            floats[2] = 1;
            cb.Colors = clrs; cb.Positions = floats;
            flowLayoutPanelEx_radiate.Add(ToFlowCell(false, clrs, floats));
            clrs[0]   = Color.YellowGreen;
            clrs[1]   = Color.GreenYellow;
            clrs[2]   = Color.Green;
            floats[0] = 0;
            floats[1] = 0.5f;
            floats[2] = 1;
            cb.Colors = clrs; cb.Positions = floats;
            flowLayoutPanelEx_radiate.Add(ToFlowCell(false, clrs, floats));
            clrs[0]   = Color.White;
            clrs[1]   = Color.Black;
            clrs[2]   = Color.White;
            floats[0] = 0;
            floats[1] = 0.5f;
            floats[2] = 1;
            cb.Colors = clrs; cb.Positions = floats;
            flowLayoutPanelEx_radiate.Add(ToFlowCell(false, clrs, floats));
            clrs[0]   = Color.Pink;
            clrs[1]   = Color.SlateGray;
            clrs[2]   = Color.GreenYellow;
            floats[0] = 0;
            floats[1] = 0.5f;
            floats[2] = 1;
            cb.Colors = clrs; cb.Positions = floats;
            flowLayoutPanelEx_radiate.Add(ToFlowCell(false, clrs, floats));
            clrs[0]   = Color.SlateGray;
            clrs[1]   = Color.BlueViolet;
            clrs[2]   = Color.DimGray;
            floats[0] = 0;
            floats[1] = 0.5f;
            floats[2] = 1;
            cb.Colors = clrs; cb.Positions = floats;
            flowLayoutPanelEx_radiate.Add(ToFlowCell(false, clrs, floats));
            clrs[0]   = Color.Indigo;
            clrs[1]   = Color.Maroon;
            clrs[2]   = Color.NavajoWhite;
            floats[0] = 0;
            floats[1] = 0.5f;
            floats[2] = 1;
            cb.Colors = clrs; cb.Positions = floats;
            flowLayoutPanelEx_radiate.Add(ToFlowCell(false, clrs, floats));
        }
Example #12
0
 public void Remove(FlowCell cell)
 {
     //     cell.Brush.Dispose();
     Data.Remove(cell);
 }
Example #13
0
 public void Add(FlowCell cell)
 {
     Data.Add(cell);
 }