Rank: Member
Groups: Member
Joined: 6/23/2005(UTC) Posts: 4
|
Hi, when i use Graphics.Engine property with value 1 (GDI+) i can not draw a line., but with 0 value i can do it. I am Visual Foxpro 7 developer. My code for this situation is: Code:thisform.bitmapviewer1.Bitmap.loadfromfile("sample1.jpg")
thisform.BitmapViewer1.AutoUpdate = .f.
thisform.BitmapViewer1.Bitmap.Graphics.Engine=1 && DrawingEngineGdiplus
thisform.BitmapViewer1.Bitmap.Graphics.Antialiasing=.t.
thisform.BitmapViewer1.Bitmap.Graphics.Unit=0 && pixel
thisform.BitmapViewer1.Bitmap.Unit=0 && pixel
thisform.BitmapViewer1.Bitmap.Graphics.Pen.ForeColor = rgb(230, 55, 80)
thisform.BitmapViewer1.Bitmap.Graphics.Pen.style = 3
thisform.BitmapViewer1.Bitmap.Graphics.Pen.Weight = 10
thisform.BitmapViewer1.Bitmap.Graphics.DrawLine(20,20,150,150)
thisform.BitmapViewer1.AutoUpdate = .t.
thisform.BitmapViewer1.Bitmap.Graphics.Engine=0 && DrawingEngineGdiplus
thisform.BitmapViewer1.Bitmap.Graphics.DrawLine(300,300,100,100)
With this code only the last line is draw. Can you help me? My GM ActiveX version is Single Workstation. Thanks Orlando R. Bogota - Colombia Edited by user Sunday, December 23, 2007 5:58:03 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
Hello Orlando,
Do you have GDI+ installed on your machine? What is your Windows version?
|
|
|
|
Rank: Member
Groups: Member
Joined: 6/23/2005(UTC) Posts: 4
|
Hi Andrew, Thanks for your answer.
Yes, my computer is XP professional SP 2. At the moment the file gdiplus.dll is present in some directories. Some of them have the same version.
Where i need to locate this file and which version? According with your help documentation the file must be in the same directorio of GM. I traied it, but the problem continue.
Thanks
Orlando
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
If you are on XP, gdiplus.dll is available by default...
Do you get any error message?
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
Oh, I have found out what is a reason of this problem. To specify a color you are using RGB() function. This function returns the RGB triad in OLE_COLOR format (in WinAPI it is known as COLORREF). OLE_COLOR is a 4-byte integer value, each byte represents one of RGB channels, and high byte contains zero. By default, Graphics Mill interprets color values in the format used in GDI+. There are two differences between that formats: 1. Red and blue channels are swapped. 2. High byte contains alpha channel (information about transparency). This is a reason why you do not see anything when draw with GDI+. When alpha = 0, it considers that the color is absolutely transparent. You can resolve this problem in two ways: 1. You can create color value using Graphics Mill utilities rather than RGB() function: Code:' VB6 syntax - unfortunately I am not familiar with FoxPro
Dim objColor As New Color
Me.BitmapViewer1.Bitmap.Graphics.Pen.ForeColor = objColor.CreateRgb(230, 55, 80)
2. If you prefer using OLE_COLOR values, you can change the way how Graphics Mill interprets color values passed into its parameters. To do it, use the ColorTreatment property of the Bitmap: Code:Me.BitmapViewer1.Bitmap.ColorTreatment = 1 ' ColorTreatmentColorref
This should help. Edited by user Sunday, December 23, 2007 6:06:29 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Member
Joined: 6/23/2005(UTC) Posts: 4
|
Thank you very much, that worked perfectly.
Best Regards Orlando R Bogota Colombia
|
|
|
|
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.