mariser#9767
Hello,
I want to build my own class (inherit from RectangleVObject). This class comprised follow VObjects (in this order):
RectangleVObject (for shadow) (which is the base class)
RectangleVObject (for border)
ImageVObject (for graphical border)
TextVObject (for text shadow)
TextVObject (for text)
I have made my first steps and there is my first problem. My test class comprised only a RectangleVObject and a TextVObject. If I resize the RectVObject then resizing the text too. The text of TextVobject should be constant. If I create only a TextVObject then I use following line:
and it's the behavior what I wish.
Call I this line in my class then have this line no reaction. Is there a way to get this functionality?
I can't make the TextVObject to my inherit class because the TextVObject rect (GetVObjectBounds()) can be smaller than RectangleVObject rect. And the first RectangleVObject is that with the control points.
![]()
Can anybody help me by my problem, please? Sorry for my bad english!
Mariser
My testing code:
I want to build my own class (inherit from RectangleVObject). This class comprised follow VObjects (in this order):
RectangleVObject (for shadow) (which is the base class)
RectangleVObject (for border)
ImageVObject (for graphical border)
TextVObject (for text shadow)
TextVObject (for text)
I have made my first steps and there is my first problem. My test class comprised only a RectangleVObject and a TextVObject. If I resize the RectVObject then resizing the text too. The text of TextVobject should be constant. If I create only a TextVObject then I use following line:
textVObject.SupportedActions[Aurigma.GraphicsMill.WinControls.VObjectAction.ChangeTextArea].Enabled = true;
and it's the behavior what I wish.
Call I this line in my class then have this line no reaction. Is there a way to get this functionality?
I can't make the TextVObject to my inherit class because the TextVObject rect (GetVObjectBounds()) can be smaller than RectangleVObject rect. And the first RectangleVObject is that with the control points.
Can anybody help me by my problem, please? Sorry for my bad english!
Mariser
My testing code:
public class FbTextBox : RectangleVObject
{
RectangleVObject _shadowRect;
TextVObject _textRect;
public FbTextBox(System.Drawing.RectangleF rectangle)
: base(rectangle)
{
_shadowRect = new RectangleVObject(0, 0, 1, 1);
_shadowRect.Brush = System.Drawing.Brushes.White;
_shadowRect.Pen = new System.Drawing.Pen(System.Drawing.Color.Gray, 10f);
_shadowRect.Pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset;
_textRect = new TextVObject();
_textRect.Pen = new System.Drawing.Pen(System.Drawing.Color.Black, 10f);
_textRect.Brush = new System.Drawing.SolidBrush(System.Drawing.Color.Gray);
System.Drawing.Font font=new System.Drawing.Font(new FontFamily("Arial"),32);
_textRect.Font = font;
_textRect.Text = "Test";
// this line have no effect
_textRect.SupportedActions[Aurigma.GraphicsMill.WinControls.VObjectAction.ChangeTextArea].Enabled = true;
}
public override void Draw(System.Drawing.Rectangle renderingRect, System.Drawing.Graphics g, ICoordinateMapper coordinateMapper)
{
// das unterste Rechteck zeichnen
base.Draw(renderingRect, g, coordinateMapper);
System.Drawing.RectangleF _thisObjBounds = this.GetVObjectBounds();
// Shadow
System.Drawing.RectangleF _shadowRectBounds = _shadowRect.GetVObjectBounds();
if (!_shadowRectBounds.Equals(_thisObjBounds))
{
System.Drawing.Brush tmpBrush = _shadowRect.Brush;
System.Drawing.Pen tmpPen = _shadowRect.Pen;
// _shadowObjBounds.X += 10;
// _shadowObjBounds.Y += 10;
// _shadowObjBounds.Width -= 20;
_shadowRect = new RectangleVObject(_thisObjBounds);
_shadowRect.Transform = this.Transform;
_shadowRect.Brush = tmpBrush;
_shadowRect.Pen = tmpPen;
}
_shadowRect.Transform = this.Transform;
_shadowRect.Draw(renderingRect, g, coordinateMapper);
// Text
System.Drawing.RectangleF _textRectBounds = _textRect.TextArea;
if (!_textRectBounds.Equals(_thisObjBounds))
{
System.Drawing.Brush tmpBrush = _textRect.Brush;
System.Drawing.Pen tmpPen = _textRect.Pen;
System.Drawing.Font tmpfont = _textRect.Font;
string text = _textRect.Text;
_textRect = new TextVObject(text, tmpfont.Name, 32.0f, _thisObjBounds);
_textRect.Transform = this.Transform;
_textRect.Brush = tmpBrush;
_textRect.Pen = tmpPen;
}
// draw text
_textRect.Transform = this.Transform;
_textRect.Draw(renderingRect, g, coordinateMapper);
}
public System.Drawing.Brush ShadowBrush
{
get { return _shadowRect.Brush; }
set { _shadowRect.Brush = value; }
}
public System.Drawing.Pen ShadowPen
{
get { return _shadowRect.Pen; }
set { _shadowRect.Pen = value; }
}
}