P
Per Cramer
i am having a vb.net problem...
I am using an activex component from plexityhide. It is the phgant
control. I am upgrading my program from vb6 to vb.net. Now i am having
a big problem. The control has got a userdraw event for the
background. It returns a hdc and left,right,top,bottom value.
Now the problem is with the hdc. I contacted the manufacturer and
their sollution works good, but it is in C#. It is :
private void axphSchemaX1_OnUserDrawTime(object sender,
AxphGantXControl.IphSchemaXEvents_OnUserDrawTimeEvent e)
{
Graphics gr=System.Drawing.Graphics.FromHdc((IntPtr)e.theHDC);
gr.DrawLine(new Pen(Color.Beige,5),e.left,e.top,e.right,e.bottom);
gr.DrawLine(new Pen(Color.BlueViolet,5),e.right,e.top,e.left,e.bottom);
}
So it tried to convert this to vb.net and used :
Dim G As Graphics = Graphics.FromHdc(CType(e.theHDC, System.IntPtr))
G.DrawRectangle(New Pen(Color.Red, 5), e.left, e.top, e.right,
e.bottom)
But this doesn't work. Whatever i try i tells me that "Value of type
'integer' cannott be converted to 'System.IntPtr'
I am using an activex component from plexityhide. It is the phgant
control. I am upgrading my program from vb6 to vb.net. Now i am having
a big problem. The control has got a userdraw event for the
background. It returns a hdc and left,right,top,bottom value.
Now the problem is with the hdc. I contacted the manufacturer and
their sollution works good, but it is in C#. It is :
private void axphSchemaX1_OnUserDrawTime(object sender,
AxphGantXControl.IphSchemaXEvents_OnUserDrawTimeEvent e)
{
Graphics gr=System.Drawing.Graphics.FromHdc((IntPtr)e.theHDC);
gr.DrawLine(new Pen(Color.Beige,5),e.left,e.top,e.right,e.bottom);
gr.DrawLine(new Pen(Color.BlueViolet,5),e.right,e.top,e.left,e.bottom);
}
So it tried to convert this to vb.net and used :
Dim G As Graphics = Graphics.FromHdc(CType(e.theHDC, System.IntPtr))
G.DrawRectangle(New Pen(Color.Red, 5), e.left, e.top, e.right,
e.bottom)
But this doesn't work. Whatever i try i tells me that "Value of type
'integer' cannott be converted to 'System.IntPtr'
.