public override void Draw(DrawArea drawArea, System.Drawing.Graphics g, float zoom) { StrAv = true; base.Draw(drawArea, g, zoom); g.DrawString(Text, new System.Drawing.Font(FontName, FontSize, Style), new SolidBrush(FontColor), new Rectangle(X, Y, Convert.ToInt32(this.Width * zoom), Convert.ToInt32(Height * zoom))); }
public override void print(DrawArea drawArea, Graphics g, int j, bool border) { base.print(drawArea, g, j, border); g.DrawString(Text, new System.Drawing.Font(FontName, FontSize, Style), new SolidBrush(FontColor), new Rectangle(X, Y, Width, Height)); }
private void chengCurser(DrawArea drawArea, Point p) { drawArea.Cursor = GetCurser(GetSizableCor(p)); }
public override void Draw(DrawArea drawArea, Graphics g, float zoom) { try { // int zoom = Convert.ToInt32(drawArea.ZoomFactor); Matrix m = new Matrix(); RotatePoint = new PointF(X + Width / 2, Y + Height / 2); m.RotateAt(rotate, RotatePoint); g.Transform = m; if (Select) { g.DrawRectangle(Pens.Red, X, Y, zoom * Width, zoom * Height); foreach (corner c in Enum.GetValues(typeof(corner))) { g.DrawRectangle(Pens.Red, GetCorRect(c)); } g.DrawEllipse(Pens.Blue, RotatePoint.X, RotatePoint.Y, 5, 5); } // وقتی خصوصیت ترنسپرنت شی ترو باشد این قسمت اجرا میشود #region transparent if (Transparent) { if (Select) { g.DrawRectangle(Pens.Red, X, Y, zoom * Width, zoom * Height); //foreach (PosSizableRect pos in Enum.GetValues(typeof(PosSizableRect))) //{ // g.DrawRectangle(new Pen(Color.Red), GetRect(pos)); //} } else if (!Select) { g.DrawRectangle(Pens.Black, X, Y, zoom * Width, zoom * Height); } } else { if (Select) { g.FillRectangle(Brushes.White, X, Y, Width, Height); g.DrawRectangle(Pens.Red, X, Y, Width, Height); foreach (corner pos in Enum.GetValues(typeof(corner))) { g.DrawRectangle(new Pen(Color.Red), GetCorRect(pos)); } } else { g.FillRectangle(Brushes.White, X, Y, Width, Height); g.DrawRectangle(Pens.Black, X, Y, Width, Height); } } #endregion if (cheked) { Pen pen = new Pen(Color.Blue); pen.DashStyle = DashStyle.DashDot; g.DrawLine(pen, X, Y, X, 0); g.DrawLine(pen, X, Y, X, drawArea.Height); g.DrawLine(pen, X, Y, drawArea.Width, Y); g.DrawLine(pen, X, Y, 0, Y); } } catch { } }
public virtual void Draw(DrawArea drawArea, System.Drawing.Graphics g, float zoom) { }
public override void OnMouseMove(DrawArea drawArea, MouseEventArgs e) { try { chengCurser(drawArea, new Point(e.X, e.Y)); if (meClick == false) { return; } int bacWidth = Width; int bacHeight = Height; int bacX = X; int bacY = Y; switch (sizeableCor) { case corner.upLeft: X += e.X - oldPoint.X; Y += e.Y - oldPoint.Y; Width -= e.X - oldPoint.X; Height -= e.Y - oldPoint.Y; break; case corner.upRight: Y += e.Y - oldPoint.Y; Width += e.X - oldPoint.X; Height -= e.Y - oldPoint.Y; break; case corner.upMidell: Y += e.Y - oldPoint.Y; Height -= e.Y - oldPoint.Y; break; case corner.downLeft: X += e.X - oldPoint.X; Width -= e.X - oldPoint.X; Height += e.Y - oldPoint.Y; break; case corner.downRight: Width += e.X - oldPoint.X; Height += e.Y - oldPoint.Y; break; case corner.downMidell: Height += e.Y - oldPoint.Y; break; case corner.midellRight: Width += e.X - oldPoint.X; break; case corner.midellLeft: X += e.X - oldPoint.X; Width -= e.X - oldPoint.X; break; default: if (move) { int dx = e.X - oldPoint.X; int dy = e.Y - oldPoint.Y; MoveRect(dx, dy); } break; } if (Width < 5 || Height < 5) { Width = bacWidth; Height = bacHeight; X = bacX; Y = bacY; } oldPoint.X = e.X; oldPoint.Y = e.Y; drawArea.Refresh(); } catch { } }
public virtual void OnMouseMove(DrawArea drawArea, MouseEventArgs e) { }
public virtual void OnKeyDown(DrawArea drawArea, KeyEventArgs e) { }
public virtual void onKeyPress(DrawArea drawArea, KeyPressEventArgs e) { }
// رویدادهای کنترل شی public virtual void print(DrawArea drawArea, Graphics g, int j, bool border) { }
public void LeftScreenObject(DrawArea area) { X = 30; }
public void RightScreenObject(DrawArea area) { X = area.Width - 30 - Width; }
//جهت تراز بندی شی روی صفحه رسم #region aline public void CenterScreenObject(DrawArea area) { X = area.Width / 2 - Width / 2; }