Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Noufal123  
#1 Posted : Wednesday, February 9, 2011 3:26:01 AM(UTC)
Noufal123

Rank: Advanced Member

Groups: Member
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

Dmitry.Obukhov  
#2 Posted : Wednesday, February 9, 2011 5:19:59 AM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
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.

thanks 1 user thanked Dmitry.Obukhov for this useful post.
Noufal123 on 2/9/2011(UTC)
Noufal123  
#3 Posted : Wednesday, February 9, 2011 10:13:25 PM(UTC)
Noufal123

Rank: Advanced Member

Groups: Member
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..
Dmitry.Obukhov  
#4 Posted : Wednesday, February 9, 2011 11:30:14 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
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.

thanks 1 user thanked Dmitry.Obukhov for this useful post.
Noufal123 on 2/10/2011(UTC)
Noufal123  
#5 Posted : Thursday, February 10, 2011 12:59:48 AM(UTC)
Noufal123

Rank: Advanced Member

Groups: Member
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

Dmitry.Obukhov  
#6 Posted : Thursday, February 10, 2011 1:58:05 AM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
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.

thanks 1 user thanked Dmitry.Obukhov for this useful post.
Noufal123 on 2/10/2011(UTC)
Noufal123  
#7 Posted : Thursday, February 10, 2011 4:08:09 AM(UTC)
Noufal123

Rank: Advanced Member

Groups: Member
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

Dmitry.Obukhov  
#8 Posted : Thursday, February 10, 2011 6:34:52 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
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.

Noufal123  
#9 Posted : Thursday, February 10, 2011 7:59:45 PM(UTC)
Noufal123

Rank: Advanced Member

Groups: Member
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

Dmitry.Obukhov  
#10 Posted : Thursday, February 10, 2011 9:19:46 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
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.

thanks 1 user thanked Dmitry.Obukhov for this useful post.
Noufal123 on 2/10/2011(UTC)
Noufal123  
#11 Posted : Sunday, February 13, 2011 11:25:29 PM(UTC)
Noufal123

Rank: Advanced Member

Groups: Member
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...

Dmitry.Obukhov  
#12 Posted : Monday, February 14, 2011 3:53:43 AM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
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.

Noufal123  
#13 Posted : Monday, February 14, 2011 8:31:16 PM(UTC)
Noufal123

Rank: Advanced Member

Groups: Member
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

File Attachment(s):
MultiLayerImageEditorCS_NET20.rar (206kb) downloaded 3 time(s).
Dmitry.Obukhov  
#14 Posted : Tuesday, February 15, 2011 3:00:51 AM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Member
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.

thanks 1 user thanked Dmitry.Obukhov for this useful post.
Noufal123 on 2/15/2011(UTC)
Users browsing this topic
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.