Rank: Advanced Member
Groups: Guest
Joined: 3/29/2010(UTC) Posts: 81
Thanks: 10 times
|
Hello.. I would like to give gradient color to mulilayer object's fill color & pen color (Objcts-Ellips,Rectangle, Line,text and polygon) is it possible? pls help me with sample codes.... Edited by user Wednesday, February 9, 2011 3:30:01 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 5/29/2010(UTC) Posts: 1,310
Thanks: 8 times Was thanked: 111 time(s) in 111 post(s)
|
Hello, Here is the code snippet which illustrates how to set gradient color for rectangle vector object: Code:Aurigma.GraphicsMill.WinControls.RectangleVObject rectangle = new Aurigma.GraphicsMill.WinControls.RectangleVObject(0F, 0F,multiLayerViewer1.WorkspaceWidth/10, multiLayerViewer1.WorkspaceHeight/10);
//Modify stroke and fill parameters
rectangle.Pen = new System.Drawing.Pen(System.Drawing.Color.BlanchedAlmond, 10F);
//Fill gradient
rectangle.Brush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point(0, 10),new Point(200, 10), System.Drawing.Color.Wheat, System.Drawing.Color.Black);
//Add the rectangle to a layer
multiLayerViewer1.Layers[0].VObjects.Add(rectangle);
|
Best regards, Dmitry Obukhov
Technical Support. Aurigma, Inc.
|
1 user thanked Dmitry.Obukhov for this useful post.
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/29/2010(UTC) Posts: 81
Thanks: 10 times
|
Thanx.. its pretty good... but, i did not able to set pen color as gradient color. is it possible? pls help me..
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 5/29/2010(UTC) Posts: 1,310
Thanks: 8 times Was thanked: 111 time(s) in 111 post(s)
|
Hi, It is possible too: Code:
...
using (Brush aGradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point(0, 10), new Point(200, 10), Color.Blue, Color.Red))
rectangle.Pen = new System.Drawing.Pen(aGradientBrush, 10F);
...
Edited by user Wednesday, February 9, 2011 11:31:03 PM(UTC)
| Reason: Not specified |
Best regards, Dmitry Obukhov
Technical Support. Aurigma, Inc.
|
1 user thanked Dmitry.Obukhov for this useful post.
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/29/2010(UTC) Posts: 81
Thanks: 10 times
|
Thanx.... Is it possible to apply gradient color to multilayer image objects? how? pls help me... Edited by user Thursday, February 10, 2011 1:54:15 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 5/29/2010(UTC) Posts: 1,310
Thanks: 8 times Was thanked: 111 time(s) in 111 post(s)
|
Hi,
Sorry, but it is impossible. Pen and brush use standard LinearGradientBrush class to set the gradient color. Unfortunately, there is no way to apply it to ImageVObject of Graphics Mill. |
Best regards, Dmitry Obukhov
Technical Support. Aurigma, Inc.
|
1 user thanked Dmitry.Obukhov for this useful post.
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/29/2010(UTC) Posts: 81
Thanks: 10 times
|
I am using following code to apply gradient color in multilayer background object's color. but it shows error. Using (Brush aGradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point(0, 10), new Point(200, 10), Color.Blue, Color.Red)) background.Color = new System.Drawing.Pen(aGradientBrush).Color;How can i solve this? pls help me .... . Edited by user Thursday, February 10, 2011 4:09:14 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 5/29/2010(UTC) Posts: 1,310
Thanks: 8 times Was thanked: 111 time(s) in 111 post(s)
|
Hello,
Could you please post the error details? Also, please share more code snippet with me since it is not quite clear what the background is. |
Best regards, Dmitry Obukhov
Technical Support. Aurigma, Inc.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/29/2010(UTC) Posts: 81
Thanks: 10 times
|
Hello. background is "SolidBackgroundVObject", how can i set the gradient color for this object ? error of above code: System.ArgumentException: Parameter is not valid. at System.Drawing.Pen.get_Color()
Edited by user Thursday, February 10, 2011 8:47:45 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 5/29/2010(UTC) Posts: 1,310
Thanks: 8 times Was thanked: 111 time(s) in 111 post(s)
|
Okay, thank you for the details. I checked it, and confirm that it is impossible to set gradient color of SolidBackgroundVObject. I recommend you to use lock RectangleVObject as a background, and set the gradient color in the way described above of this thread. |
Best regards, Dmitry Obukhov
Technical Support. Aurigma, Inc.
|
1 user thanked Dmitry.Obukhov for this useful post.
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/29/2010(UTC) Posts: 81
Thanks: 10 times
|
I have used the code
"using (Brush aGradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(new Point(0, 10), new Point(200, 10), Color.Blue, Color.Red)) rectangle.Pen = new System.Drawing.Pen(aGradientBrush, 10F);" to make gradient pen color. but its making error with "multiLayerViewer.SaveState()". pls provide me a solution...
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 5/29/2010(UTC) Posts: 1,310
Thanks: 8 times Was thanked: 111 time(s) in 111 post(s)
|
Hello,
Please share complete code snippet where the error occurs. I will test it. Also, please provide me with error details. |
Best regards, Dmitry Obukhov
Technical Support. Aurigma, Inc.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 3/29/2010(UTC) Posts: 81
Thanks: 10 times
|
I attached a sample, you please add a rectangle or ellips to multilayerviewer and change its settings (by changing brush or....).. it will make error... in this, i added the above code for pen. After setting the pen , moving objects making a unhandled exception .... Edited by user Monday, February 14, 2011 8:41:08 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 5/29/2010(UTC) Posts: 1,310
Thanks: 8 times Was thanked: 111 time(s) in 111 post(s)
|
Hello,
Okay, I tried the sample, and got the error. Unfortunately, here setting gradient color for Pen is impossible. There is Pen is a class of System.Drawing, which has its own Color property. It cannot be gradient color. Therefore, you face the exception. |
Best regards, Dmitry Obukhov
Technical Support. Aurigma, Inc.
|
1 user thanked Dmitry.Obukhov for this useful post.
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.