public CompactScrap(ScrapBase scrap, CCompactStyleItem item, Point clickpoint) { this.InitializeComponent(); this._scrap = scrap; this._thumbnail = scrap.GetViewImage(); this._dragmode = false; if (clickpoint == Point.Empty) { this._clickpoint = new Point(base.Width / 2, base.Height / 2); } else { this._clickpoint = clickpoint; } this._pen = new Pen(Color.FromArgb(item.LineColor), 1f); if (!item.SoldLine) { this._pen.DashStyle = DashStyle.Dash; this._pen.DashPattern = new float[] { 4f, 4f }; } else { this._pen.DashStyle = DashStyle.Solid; } if (item.LineColor == Color.Fuchsia.ToArgb()) { this.BackColor = Color.Magenta; base.TransparencyKey = Color.Magenta; } base.Opacity = ((double)item.Opacity) / 100.0; }
protected override void SetStyleToForm(object style) { CCompactStyleItem item = (CCompactStyleItem)style; this.InitializeComponent(); this.Text = item.GetDisplayName(); this.numOpacity.Minimum = CCompactStyleItem.OpacityMinValue; this.numOpacity.Maximum = CCompactStyleItem.OpacityMaxValue; this.numOpacity.Value = item.Opacity; this.barOpacity.Minimum = CCompactStyleItem.OpacityMinValue; this.barOpacity.Maximum = CCompactStyleItem.OpacityMaxValue; this.barOpacity.Value = item.Opacity; this.picLineColor.BackColor = Color.FromArgb(item.LineColor); this.rdoSolid.Checked = item.SoldLine; this.rdoDashed.Checked = !item.SoldLine; this.cm = new ColorMatrix(); this.cm.Matrix00 = 1f; this.cm.Matrix11 = 1f; this.cm.Matrix22 = 1f; this.cm.Matrix33 = (float)(this.numOpacity.Value / 100M); this.cm.Matrix44 = 1f; this.ia = new ImageAttributes(); this.ia.SetColorMatrix(this.cm); this.imgBackground = new Bitmap(this.picPreview.Width, this.picPreview.Height, PixelFormat.Format24bppRgb); using (Graphics graphics = Graphics.FromImage(this.imgBackground)) { graphics.CopyFromScreen(new Point(0, 0), new Point(0, 0), this.imgBackground.Size); } this.imgScrap = new Bitmap(50, 50, PixelFormat.Format24bppRgb); using (Graphics graphics2 = Graphics.FromImage(this.imgScrap)) { graphics2.DrawImageUnscaled(Properties.Image.SampleImage, (this.imgScrap.Width / 2) - (Properties.Image.SampleImage.Width / 2), (this.imgScrap.Height / 2) - (Properties.Image.SampleImage.Height / 2)); } this.UpdateLine(); }
protected override void SetTunedStyleItem(CStyleItem newOwn) { CCompactStyleItem item = (CCompactStyleItem)newOwn; this.Opacity = item.Opacity; this.LineColor = item.LineColor; this.SoldLine = item.SoldLine; }
public CompactStyleItemPanel(CCompactStyleItem item) : base(item) { }