public void PutBox() { boxBrush.ResetTransform(); boxBrush.TranslateTransform(posX, posY); boxRectangle.X = posX; boxRectangle.Y = posY; }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); this.SynchronizePreview(); bool linkBroken = this.ReferenceBroken; Color bgColorBright = Color.White; if (this.dragHover) { bgColorBright = bgColorBright.MixWith(Color.FromArgb(192, 255, 0), 0.4f); } else if (this.multiple) { bgColorBright = Color.Bisque; } else if (linkBroken) { bgColorBright = Color.FromArgb(255, 128, 128); } bool darkBg = false; Rectangle rectImage = new Rectangle(this.rectPanel.X + 2, this.rectPanel.Y + 2, this.rectPanel.Width - 4, this.rectPanel.Height - 4); if (this.prevImage == null) { if (this.ReadOnly || !this.Enabled) { e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(64, bgColorBright)), rectImage); } else { e.Graphics.FillRectangle(new SolidBrush(bgColorBright), rectImage); } } else { Color brightChecker = this.prevImageLum > 0.5f ? Color.FromArgb(48, 48, 48) : Color.FromArgb(224, 224, 224); Color darkChecker = this.prevImageLum > 0.5f ? Color.FromArgb(32, 32, 32) : Color.FromArgb(192, 192, 192); if (this.dragHover) { brightChecker = brightChecker.MixWith(Color.FromArgb(192, 255, 0), 0.4f); darkChecker = darkChecker.MixWith(Color.FromArgb(192, 255, 0), 0.4f); } else if (this.multiple) { brightChecker = brightChecker.MixWith(Color.FromArgb(255, 200, 128), 0.4f); darkChecker = darkChecker.MixWith(Color.FromArgb(255, 200, 128), 0.4f); } else if (linkBroken) { brightChecker = brightChecker.MixWith(Color.FromArgb(255, 128, 128), 0.4f); darkChecker = darkChecker.MixWith(Color.FromArgb(255, 128, 128), 0.4f); } e.Graphics.FillRectangle(new HatchBrush(HatchStyle.LargeCheckerBoard, brightChecker, darkChecker), rectImage); TextureBrush bgImageBrush = new TextureBrush(this.prevImage); bgImageBrush.ResetTransform(); bgImageBrush.TranslateTransform(rectImage.X, rectImage.Y); e.Graphics.FillRectangle(bgImageBrush, rectImage); darkBg = this.prevImageLum > 0.5f; if (this.ReadOnly || !this.Enabled) { e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(128, SystemColors.Control)), rectImage); darkBg = (this.prevImageLum + SystemColors.Control.GetLuminance()) * 0.5f < 0.5f; } } if (this.prevSound != null) { if (this.prevSoundInst != null) { e.Graphics.DrawImage(darkBg ? EditorBaseResCache.IconSpeakerWhite : EditorBaseResCache.IconSpeakerBlack, this.rectPrevSound.X, this.rectPrevSound.Y); } else { e.Graphics.DrawImageAlpha(darkBg ? EditorBaseResCache.IconSpeakerWhite : EditorBaseResCache.IconSpeakerBlack, 0.5f, this.rectPrevSound.X, this.rectPrevSound.Y); } } StringFormat format = StringFormat.GenericDefault; format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; format.Trimming = StringTrimming.EllipsisPath; SizeF textSize = e.Graphics.MeasureString( this.ReferenceName ?? "null", SystemFonts.DefaultFont, new SizeF(this.rectPanel.Width, this.rectPanel.Height), format); Rectangle rectText; if (this.prevImage == null) { rectText = this.rectPanel; } else { rectText = new Rectangle( this.rectPanel.X, this.rectPanel.Bottom - (int)textSize.Height - 2, this.rectPanel.Width, (int)textSize.Height); } if (this.prevImage != null) { e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(192, bgColorBright)), rectText.X + rectText.Width / 2 - textSize.Width / 2 - 1, rectText.Y + rectText.Height / 2 - textSize.Height / 2 - 2, textSize.Width + 1, textSize.Height + 2); } e.Graphics.DrawString( this.ReferenceName ?? "null", SystemFonts.DefaultFont, new SolidBrush(this.Enabled ? SystemColors.ControlText : SystemColors.GrayText), rectText, format); this.ControlRenderer.DrawBorder(e.Graphics, this.rectPanel, BorderStyle.ContentBox, (this.ReadOnly || !this.Enabled) ? BorderState.Disabled : BorderState.Normal); ButtonState buttonStateReset = ButtonState.Disabled; if (!this.ReadOnly && this.Enabled && this.ReferenceName != null) { if (this.buttonResetPressed) { buttonStateReset = ButtonState.Pressed; } else if (this.buttonResetHovered) { buttonStateReset = ButtonState.Hot; } else { buttonStateReset = ButtonState.Normal; } } this.ControlRenderer.DrawButton( e.Graphics, this.rectButtonReset, buttonStateReset, null, iconReset); ButtonState buttonStateSelect = ButtonState.Disabled; if (!this.ReadOnly && this.Enabled) { if (this.buttonSelectPressed) { buttonStateSelect = ButtonState.Pressed; } else if (this.buttonSelectHovered || this.Focused) { buttonStateSelect = ButtonState.Hot; } else { buttonStateSelect = ButtonState.Normal; } } this.ControlRenderer.DrawButton( e.Graphics, this.rectButtonSelect, buttonStateSelect, null, iconSelect); }
public void Draw(Graphics graphics, Rectangle bounds) { if (_disposed) { throw new ObjectDisposedException(GetType().Name); } if (graphics == null) { throw new ArgumentNullException("graphics"); } _n.ResetTransform(); _n.TranslateTransform(0, bounds.Top - Size.Top); graphics.FillRectangle( _n, bounds.Left + (_nw.Width - Size.Left), bounds.Top - Size.Top, bounds.Width - (_nw.Width - Size.Left) - (_nw.Width - Size.Right), Size.Top ); _e.ResetTransform(); _e.TranslateTransform(bounds.Right, 0); graphics.FillRectangle( _e, bounds.Right, bounds.Top + (_ne.Height - Size.Top), Size.Right, bounds.Height - (_ne.Height - Size.Top) - (_se.Height - Size.Bottom) ); _s.ResetTransform(); _s.TranslateTransform(0, bounds.Bottom); graphics.FillRectangle( _s, bounds.Left + (_sw.Width - Size.Left), bounds.Bottom, bounds.Width - (_sw.Width - Size.Left) - (_sw.Width - Size.Right), Size.Bottom ); _w.ResetTransform(); _w.TranslateTransform(bounds.Left - Size.Left, 0); graphics.FillRectangle( _w, bounds.Left - Size.Left, bounds.Top + (_nw.Height - Size.Top), Size.Left, bounds.Height - (_nw.Height - Size.Top) - (_sw.Height - Size.Bottom) ); graphics.DrawImageUnscaled( _ne, (bounds.Right + Size.Right) - _ne.Width, bounds.Top - Size.Top ); graphics.DrawImageUnscaled( _se, (bounds.Right + Size.Right) - _se.Width, (bounds.Bottom + Size.Bottom) - _se.Height ); graphics.DrawImageUnscaled( _sw, bounds.Left - Size.Left, (bounds.Bottom + Size.Bottom) - _sw.Height ); graphics.DrawImageUnscaled( _nw, bounds.Left - Size.Left, bounds.Top - Size.Top ); }
private void select_img_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = @"(*.gif;*.jpg;*.jpeg;*.png;*.psd)|*.gif;*.jpg;*.jpeg;*.png;*.psd"; openFileDialog.RestoreDirectory = true; if (DialogResult.OK == openFileDialog.ShowDialog()) { string savePath = GetSavePath(); if (savePath == null) { this.listBox1.Items.Add("Cancel operation"); return; } this.listBox1.Items.Add(openFileDialog.FileName); PointF p1 = new PointF(0, HalfTileHeight); PointF p2 = new PointF(HalfTileWidth, 0); PointF p3 = new PointF(TileWidth, HalfTileHeight); PointF p4 = new PointF(HalfTileWidth, TileHeigth); GraphicsPath path = new GraphicsPath(); path.AddPolygon(new[] { p1, p2, p3, p4 }); try { using (Bitmap bitmap = (Bitmap)Bitmap.FromFile(openFileDialog.FileName, false)) { int column = CalculateWidthIndexCount(bitmap.Width, TileWidth); int row = CalculateHeightIndex(bitmap.Height, TileHeigth); this.listBox1.Items.Add("picture width" + bitmap.Width); this.listBox1.Items.Add("picture height" + bitmap.Height); this.listBox1.Items.Add("diamond height & width" + TileWidth + "," + TileHeigth); this.listBox1.Items.Add("column = " + column); this.listBox1.Items.Add("row = " + row); TextureBrush brush = new TextureBrush(bitmap, WrapMode.Clamp); for (int i = 0; i <= row; i++) { for (int j = 0; j < column; j++) { using (Bitmap bm = new Bitmap(TileWidth, TileHeigth)) { using (Graphics g = Graphics.FromImage(bm)) { g.CompositingQuality = CompositingQuality.HighQuality; g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBilinear; g.PixelOffsetMode = PixelOffsetMode.Half; var stage = LogicToStage(i, j); brush.ResetTransform(); brush.TranslateTransform(stage.X, stage.Y); g.FillRegion(brush, new Region(path)); g.Save(); string str = string.Format("/{0}_{1}.png", i, j); bm.Save(savePath + str, System.Drawing.Imaging.ImageFormat.Png); } } } } brush.Dispose(); path.Dispose(); } this.listBox1.Items.Add("clip finish"); this.listBox1.Items.Add("-----------------------"); MessageBox.Show("clip finish"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
protected override void OnPaintBackground(PaintEventArgs e) { if (iCurrentView < 3 || iUiOptions.MiniMode) { base.OnPaintBackground(e); if (!iOptionPageGeneral.Transparency) { e.Graphics.Clear(iViewSupport.BackColour); } else if (WindowState == FormWindowState.Maximized) { e.Graphics.Clear(iViewSupport.BackColour); } if (iUiOptions.MiniMode) { e.Graphics.DrawImage(kMiniLeft, 0, 0); e.Graphics.DrawImage(kMiniRight, ClientRectangle.Width - kMiniRight.Width, 0); int width = ClientRectangle.Width - kMiniLeft.Width - kMiniRight.Width; if (width > 0) { e.Graphics.FillRectangle(iBrushMiniFiller, kMiniLeft.Width, 0, width, kMiniFiller.Height); } } else { // draw the header e.Graphics.DrawImage(kHeaderLeft, 0, 0); e.Graphics.DrawImage(kHeaderRight, ClientRectangle.Width - kHeaderRight.Width, 0); // draw the footer e.Graphics.DrawImage(kFooterLeft, 0, ClientRectangle.Height - kFooterLeft.Height); e.Graphics.DrawImage(kFooterRight, ClientRectangle.Width - kFooterRight.Width, ClientRectangle.Height - kFooterRight.Height); int width = ClientRectangle.Width - kHeaderLeft.Width - kHeaderRight.Width; if (width > 0) { e.Graphics.FillRectangle(iBrushHeaderFiller, kHeaderLeft.Width, 0, width, kHeaderFiller.Height); } width = ClientRectangle.Width - kFooterLeft.Width - kFooterRight.Width; if (width > 0) { iBrushFooterFiller.ResetTransform(); iBrushFooterFiller.TranslateTransform(kFooterLeft.Width, ClientRectangle.Height - kFooterFiller.Height); e.Graphics.FillRectangle(iBrushFooterFiller, kFooterLeft.Width, ClientRectangle.Height - kFooterFiller.Height, width, kFooterFiller.Height); } // draw the side bars int height = ClientRectangle.Height - kHeaderLeft.Height - kFooterFiller.Height; if (height > 0) { e.Graphics.FillRectangle(iBrushLeftFiller, 0, kHeaderLeft.Height, kLeftEdgeFiller.Width, height); iBrushRightFiller.ResetTransform(); iBrushRightFiller.TranslateTransform(ClientRectangle.Width - kRightEdgeFiller.Width, kHeaderRight.Height); e.Graphics.FillRectangle(iBrushRightFiller, ClientRectangle.Width - kRightEdgeFiller.Width, kHeaderRight.Height, kRightEdgeFiller.Width, height); } } } else { e.Graphics.Clear(Color.Black); } }
private static void FillRect(Graphics g, TextureBrush brush, int[] guideX, int[] guideY, int x0, int y0, int x1, int y1) { brush.ResetTransform(); brush.TranslateTransform(guideX[x0], guideY[y0]); g.FillRectangle(brush, guideX[x0], guideY[y0], guideX[x1] - guideX[x0], guideY[y1] - guideY[y0]); }
private bool RebarMessageCaptured(ref Message m) { // Make sure the menu bar obeys the Explorer setting. // Was this really so hard, Microsoft? if (m.Msg == RB.SETBANDINFO) { REBARBANDINFO pInfo = (REBARBANDINFO)Marshal.PtrToStructure(m.LParam, typeof(REBARBANDINFO)); if ((PInvoke.GetClassName(pInfo.hwndChild) == "ToolbarWindow32") && (pInfo.wID == 1)) { if (MenuHasFocus || MenuBarShown) { pInfo.fStyle &= ~RBBS.HIDDEN; } else { pInfo.fStyle |= RBBS.HIDDEN; } Marshal.StructureToPtr(pInfo, m.LParam, false); } return(false); } if (m.Msg == WM.ERASEBKGND && (Config.Skin.UseRebarBGColor || Config.Skin.UseRebarImage)) { bool fFilled = false; using (Graphics graphics = Graphics.FromHdc(m.WParam)) { RECT rect; PInvoke.GetWindowRect(Handle, out rect); Rectangle rectRebar = new Rectangle(0, 0, rect.Width, rect.Height); // Fill the Rebar background color if (Config.Skin.UseRebarBGColor) { using (SolidBrush brush = new SolidBrush(Config.Skin.RebarColor)) { graphics.FillRectangle(brush, rectRebar); fFilled = true; } } else if (Config.Skin.RebarStretchMode == StretchMode.Real) { rebarController.DefWndProc(ref m); } // Draw the Rebar image if (VisualStyleRenderer.IsSupported && Config.Skin.UseRebarImage && Config.Skin.RebarImageFile.Length > 0) { if (bmpRebar == null) { CreateRebarImage(); } if (bmpRebar != null) { List <Rectangle> rectTargets = new List <Rectangle>(); if (Config.Skin.RebarImageSeperateBars) { int bandCount = (int)PInvoke.SendMessage(rebarController.Handle, RB.GETBANDCOUNT, IntPtr.Zero, IntPtr.Zero); graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; RECT rectBand = new RECT(); RECT rectMargin = new RECT(); for (int i = 0; i < bandCount; i++) { if (PInvoke.SendMessage(rebarController.Handle, RB.GETRECT, (IntPtr)i, ref rectBand) == IntPtr.Zero) { continue; } PInvoke.SendMessage(rebarController.Handle, RB.GETBANDBORDERS, (IntPtr)i, ref rectMargin); rectBand.left -= !QTUtility.IsXP ? 4 : rectMargin.left; rectBand.top -= rectMargin.top; rectBand.right += rectMargin.right; rectBand.bottom += rectMargin.bottom; rectTargets.Add(rectBand.ToRectangle()); } } else { rectTargets.Add(rectRebar); } foreach (Rectangle destRect in rectTargets) { switch (Config.Skin.RebarStretchMode) { case StretchMode.Real: Rectangle rectDest2 = new Rectangle(new Point(0, 0), destRect.Size); Rectangle rectBmp = new Rectangle(new Point(0, 0), bmpRebar.Size); rectBmp.Intersect(rectDest2); rectDest2.Intersect(rectBmp); rectDest2.Offset(destRect.Location); graphics.DrawImage(bmpRebar, rectDest2, rectBmp, GraphicsUnit.Pixel); break; case StretchMode.Tile: textureBrushRebar = textureBrushRebar ?? new TextureBrush(bmpRebar); textureBrushRebar.TranslateTransform(destRect.X, destRect.Y); graphics.FillRectangle(textureBrushRebar, destRect); textureBrushRebar.ResetTransform(); break; default: // Full // todo: make this a function graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; Padding margin = Config.Skin.RebarSizeMargin; int left = margin.Left; int top = margin.Top; int right = margin.Right; int bottom = margin.Bottom; int vertical = margin.Vertical; int horizontal = margin.Horizontal; int width = bmpRebar.Width; int height = bmpRebar.Height; Rectangle[] dstRects = new Rectangle[] { new Rectangle(destRect.X, destRect.Y, left, top), new Rectangle(destRect.X + left, destRect.Y, destRect.Width - horizontal, top), new Rectangle(destRect.Right - right, destRect.Y, right, top), new Rectangle(destRect.X, destRect.Y + top, left, destRect.Height - vertical), new Rectangle(destRect.X + left, destRect.Y + top, destRect.Width - horizontal, destRect.Height - vertical), new Rectangle(destRect.Right - right, destRect.Y + top, right, destRect.Height - vertical), new Rectangle(destRect.X, destRect.Bottom - bottom, left, bottom), new Rectangle(destRect.X + left, destRect.Bottom - bottom, destRect.Width - horizontal, bottom), new Rectangle(destRect.Right - right, destRect.Bottom - bottom, right, bottom) }; Rectangle[] srcRects = new Rectangle[] { new Rectangle(0, 0, left, top), new Rectangle(left, 0, width - horizontal, top), new Rectangle(width - right, 0, right, top), new Rectangle(0, top, left, height - vertical), new Rectangle(left, top, width - horizontal, height - vertical), new Rectangle(width - right, top, right, height - vertical), new Rectangle(0, height - bottom, left, bottom), new Rectangle(left, height - bottom, width - horizontal, bottom), new Rectangle(width - right, height - bottom, right, bottom), }; for (int i = 0; i < 9; i++) { graphics.DrawImage(bmpRebar, dstRects[i], srcRects[i], GraphicsUnit.Pixel); } break; } } fFilled = true; } } } if (fFilled) { m.Result = (IntPtr)1; return(true); } } return(false); }
/// <summary> /// 马路 /// </summary> /// <param name="g"></param> /// <param name="time"></param> private void Draw2(Graphics g, int time) { if (base.DrawVisible) { Matrix matrix1 = base.Transform.Matrix.Clone(); GraphicsContainer container1 = g.BeginContainer(); g.SmoothingMode = base.OwnerDocument.SmoothingMode; Matrix matrix2 = base.GraphTransform.Matrix.Clone(); base.GraphTransform.Matrix.Multiply(matrix1, MatrixOrder.Prepend); ClipAndMask.ClipPath.Clip(g, time, this); bool flag1 = base.Visible; if (!base.Visible) { g.SetClip(Rectangle.Empty); } float single1 = this.StrokeOpacity; if (this.svgAnimAttributes.ContainsKey("fill-opacity")) { single1 = Math.Min(single1, (float)this.svgAnimAttributes["fill-opacity"]); } ISvgBrush brush1 = this.GraphBrush; using (GraphicsPath path1 = (GraphicsPath)this.GPath.Clone()) { path1.Transform(base.GraphTransform.Matrix); if (!base.ShowBound) { float width1 = Width * GraphTransform.Matrix.Elements[0]; Stroke stroke = Stroke.GetStroke(this); Color color1 = Color.FromArgb(75, 75, 75); if (stroke.StrokeColor.ToArgb() != Color.Black.ToArgb()) { color1 = stroke.StrokeColor; } using (Pen p = new Pen(Color.FromArgb((int)(single1 * 255), color1))) { p.Width = width1; g.DrawPath(p, path1); } if (LineType == "3") { using (Pen p = new Pen(Color.Yellow)) { if (width1 > 30) { p.Width = 2; } else { p.Width = 1; } //p.DashPattern = new float[] { 10, 10 }; g.DrawPath(p, path1); } } else { //using (Pen p = new Pen(Color.Yellow)) { // if (width1 > 30) // p.Width = 2; // else // p.Width = 1; // g.DrawPath(p, path1); //} } if (LineType == "4") { using (Pen p = new Pen(Color.FromArgb((int)(single1 * 255), color1))) { p.Width = width1; float f22 = width1 / 4f; ImageAttributes imageAttributes = new ImageAttributes(); ColorMatrix cmatrix1 = new ColorMatrix(); cmatrix1.Matrix00 = 1f; cmatrix1.Matrix11 = 1f; cmatrix1.Matrix22 = 1f; cmatrix1.Matrix33 = single1;//透明度 cmatrix1.Matrix44 = 1f; //设置透明度 imageAttributes.SetColorMatrix(cmatrix1, ColorMatrixFlag.Default, ColorAdjustType.Default); if (BackgroundImage == null) { BackgroundImageFile = "road.png"; } TextureBrush tbush = new TextureBrush(BackgroundImage, new Rectangle(0, 0, BackgroundImage.Width, BackgroundImage.Height), imageAttributes); tbush.WrapMode = WrapMode.Tile; for (int i = 0; i < path1.PointCount - 1; i++) { float k = (path1.PathPoints[i + 1].Y - path1.PathPoints[i].Y) / (path1.PathPoints[i + 1].X - path1.PathPoints[i].X); float y1 = path1.PathPoints[i].Y - path1.PathPoints[i + 1].Y; float y2 = path1.PathPoints[i].X - path1.PathPoints[i + 1].X; float k2 = (float)Math.Abs(k); float angle = (float)Math.Atan(k2) * 180 / (float)Math.PI; if (k < 0) { angle = 360 - angle; } PointF[] pts = new PointF[] { new PointF(path1.PathPoints[i].X, path1.PathPoints[i].Y - 26) }; Matrix matrix11 = new Matrix(); matrix11.RotateAt(angle, path1.PathPoints[i]); matrix11.Translate(path1.PathPoints[i].X, path1.PathPoints[i].Y); matrix11.Scale(width1 / 50, width1 / 50); //tbush.ScaleTransform(width1 / 50, width1 / 50, MatrixOrder.Append); //tbush.RotateTransform(angle, MatrixOrder.Append); //tbush.TranslateTransform(path1.PathPoints[i].X, path1.PathPoints[i].Y , MatrixOrder.Append); tbush.Transform = matrix11; p.Brush = tbush.Clone() as TextureBrush; p.Alignment = PenAlignment.Center; g.DrawLine(p, path1.PathPoints[i], path1.PathPoints[i + 1]); tbush.ResetTransform(); } } if (BackgroundImageFile == "road.png") { using (Pen p = new Pen(Color.Yellow)) { if (width1 > 30) { p.Width = 2; } else { p.Width = 1; } g.DrawPath(p, path1); } } } } else { g.DrawPath(new Pen(base.BoundColor), path1); } this.DrawConnect(g); } matrix1.Dispose(); ClipAndMask.ClipPath.DrawClip(g, time, this); g.EndContainer(container1); this.pretime = time; } }
//Painting private void textureView_Paint(object sender, PaintEventArgs e) { float width = e.ClipRectangle.Width; float height = e.ClipRectangle.Height; Rectangle m_UVwindowRect = new Rectangle(0, 0, (int)width - valueSettingPanel1.Width, (int)height); Graphics gfx = e.Graphics; gfx.Clear(Color.White); TextureBrush texBrush = new TextureBrush(m_previewTexture); //UV Preview texBrush.TranslateTransform(m_UVwindowRect.Width / 2f, m_UVwindowRect.Height / 2f); float texWidth = m_previewTexture.Width; float texHeight = m_previewTexture.Height; if (texWidth > texHeight) { texBrush.ScaleTransform(m_zoomFactor * 32 / texWidth, m_zoomFactor * 32 / texWidth); } else { texBrush.ScaleTransform(m_zoomFactor * 32 / texHeight, m_zoomFactor * 32 / texHeight); } gfx.FillRectangle(texBrush, m_UVwindowRect); //UV Rectangle Pen pen = new Pen(Color.Gold, 2); double angle = m_rotation * 0.0174533f; RectangleF rect = new RectangleF(-32 * m_scale, -32 * m_scale, 64 * m_scale, 64 * m_scale); PointF center = new PointF(m_UVwindowRect.Width / 2f + m_translationX * 64 * m_zoomFactor, m_UVwindowRect.Height / 2f - m_translationY * 64 * m_zoomFactor); gfx.DrawPolygon(pen, new PointF[] { new PointF(center.X + ((float)Math.Sin(-angle) * rect.Top + (float)Math.Cos(angle) * rect.Left) * m_zoomFactor, center.Y + ((float)Math.Cos(-angle) * rect.Top + (float)Math.Sin(angle) * rect.Left) * m_zoomFactor), new PointF(center.X + ((float)Math.Sin(-angle) * rect.Top + (float)Math.Cos(angle) * rect.Right) * m_zoomFactor, center.Y + ((float)Math.Cos(-angle) * rect.Top + (float)Math.Sin(angle) * rect.Right) * m_zoomFactor), new PointF(center.X + ((float)Math.Sin(-angle) * rect.Bottom + (float)Math.Cos(angle) * rect.Right) * m_zoomFactor, center.Y + ((float)Math.Cos(-angle) * rect.Bottom + (float)Math.Sin(angle) * rect.Right) * m_zoomFactor), new PointF(center.X + ((float)Math.Sin(-angle) * rect.Bottom + (float)Math.Cos(angle) * rect.Left) * m_zoomFactor, center.Y + ((float)Math.Cos(-angle) * rect.Bottom + (float)Math.Sin(angle) * rect.Left) * m_zoomFactor) }); //off bounds cover gfx.FillRectangle(SystemBrushes.Control, new Rectangle((int)width - valueSettingPanel1.Width, 0, valueSettingPanel1.Width, (int)height)); //small Texture Preview Window texBrush.ResetTransform(); if (texWidth > texHeight) { texBrush.ScaleTransform(32 / texWidth / m_scale, 32 / texWidth / m_scale); } else { texBrush.ScaleTransform(32 / texHeight / m_scale, 32 / texHeight / m_scale); } texBrush.TranslateTransform(width - 32 - m_translationX * 64, 32 + m_translationY * 64); texBrush.RotateTransform(-m_rotation); gfx.FillRectangle(texBrush, width - 64, 0, 64, 64); }