Пример #1
0
        public NSHatchBrushInfo Clone()
        {
            NSHatchBrushInfo other = new NSHatchBrushInfo();

            other.BackColor  = this.BackColor;
            other.ForeColor  = this.ForeColor;
            other.BackAValue = this.BackAValue;
            other.ForeAValue = this.ForeAValue;
            other.Style      = this.Style;
            return(other);
        }
Пример #2
0
        private void Init()
        {
            BrushType      = NSBrushType.Solid;
            SolidBrushInfo = new NSSolidBrushInfo(Color.Red);
            ColorBlend cb = new ColorBlend(2);

            Color[] clrs   = new Color[2];
            float[] floats = new float[2];
            clrs[0]   = Color.White;
            clrs[1]   = Color.Black;
            floats[0] = 0;
            floats[1] = 1;
            cb.Colors = clrs; cb.Positions = floats;
            LinearGradientBrushInfo = new NSLinearGradientBrushInfo(cb, 0);
            HatchBrushInfo          = new NSHatchBrushInfo();
            TextrueBrushInfo        = new NSTextrueBrushInfo();
            LinearGradientBrush h;
            HatchBrush          global;
            TextureBrush        a;

            PathGradientBrushInfo = new NSPathGradientBrushInfo(cb);
        }
Пример #3
0
        public void UpdateData(bool bSave)
        {
            if (brushData == null)
            {
                return;
            }
            if (bSave)
            {
                brushData.BrushType = (NSBrushType)tabControl1.SelectedIndex;
                //solid
                brushData.SolidBrushInfo.Color    = solidUserControl1.color;
                brushData.LinearGradientBrushInfo = linearGradientUserControl1.LinearGradientBrushInfo;
                brushData.HatchBrushInfo          = hatchBrushInfo;

                TextrueBrushInfo.ImageDrawMode = GetImageDrawMode();
                TextrueBrushInfo.WrapMode      = GetWrapMode();
                brushData.TextrueBrushInfo     = TextrueBrushInfo;

                PathGradientBrushInfo.LinearGradient = linearGradientUserControl2.LinearGradientBrushInfo;
                brushData.PathGradientBrushInfo      = PathGradientBrushInfo;
            }
            else//映射到窗口
            {
                tabControl1.SelectedIndex = (int)brushData.BrushType;
                //solid
                solidUserControl1.color = brushData.SolidBrushInfo.Color;
                Event_SolidBrushControl(solidUserControl1.color);


                //linear
                linearGradientUserControl1.LinearGradientBrushInfo = brushData.LinearGradientBrushInfo;

                //path
                linearGradientUserControl2.LinearGradientBrushInfo = brushData.PathGradientBrushInfo.LinearGradient;

                //hatch
                hatchBrushInfo           = brushData.HatchBrushInfo;
                buttonEx_ForeColor.Color = brushData.HatchBrushInfo.ForeColor;
                buttonEx_BackColor.Color = brushData.HatchBrushInfo.BackColor;
                HScrollBarUserControl_ForeColor.Value = brushData.HatchBrushInfo.ForeAValue;
                hScrollBarUserControl_BackColor.Value = brushData.HatchBrushInfo.BackAValue;
                if (_hatchBrushExample != null)
                {
                    _hatchBrushExample.Dispose();
                }
                _hatchBrushExample = new HatchBrush(hatchBrushInfo.Style, hatchBrushInfo.ForeColor, hatchBrushInfo.BackColor);

                //image
                TextrueBrushInfo   = brushData.TextrueBrushInfo;
                textBox_image.Text = TextrueBrushInfo.FileName;

                RadioButtonEanble();
                SetWrapMode(TextrueBrushInfo.WrapMode);
                SetImageDrawMode(TextrueBrushInfo.ImageDrawMode);
                if (brushData.BrushType == NSBrushType.Textrue)
                {
                    if (TextrueBrushInfo.IsResource)
                    {
                        if (TextrueBrushInfo.ResourceImage != "")
                        {
                            Object res = Resources.ResourceManager.GetObject(TextrueBrushInfo.ResourceImage);
                            Image  im  = res as Image;
                            _textureBrushExample = new TextureBrush(im, TextrueBrushInfo.WrapMode);
                        }
                    }
                    else
                    {
                        if (TextrueBrushInfo.FileName != "")
                        {
                            Bitmap _ImageBmp = new Bitmap(TextrueBrushInfo.FileName);
                            _textureBrushExample = new TextureBrush(_ImageBmp, TextrueBrushInfo.WrapMode);
                        }
                    }
                }
            }
        }