|
Thanks. Sir, if any pc has windows xp service pack 2, than i can run my project without .Net Framework.
Sir , can u give any link for learn Visual C++ 6.0. And that to do learn Visual C++ 6.0.
Thanks.
|
|
|
|
|
|
Windows XP Service Pack 2 has .NET Framework in it.
I don't know any sites for learning C++. Try to search it in google.
There are many books for C++. For example this one : http://www.bookpool.com/sm/0672312409
|
|
|
|
|
|
I believe that is impossible.
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
-- modified at 4:33 Monday 3rd July, 2006
|
|
|
|
|
hi all,
i created one form and on click of a button in that form another form will pop up... now, is it possible that only after closing the second window the control should be passed to the first window... in other words only after closing the child window i should be able to work on the parnent window..
|
|
|
|
|
instead of using window.Show() use window.ShowDialog()
|
|
|
|
|
Hi
Find below the structure am using
struct Test
{
int i;
string s;
}
struct Check
{
int intI;
Test []structArray;
}
How to convert the Check structure to byte array ?
Thanks in advance
chandru
|
|
|
|
|
That depends on what you want the byte array to contain.
---
b { font-weight: normal; }
|
|
|
|
|
The following code converts the structure to bytearray.
Hope this helps...
<br />
using System.Runtime.InteropServices;<br />
<br />
[StructLayout(LayoutKind.Sequential, Pack=1)]<br />
public struct Test<br />
{<br />
public int i;<br />
public string s;<br />
}<br />
<br />
[StructLayout(LayoutKind.Sequential, Pack=1)]<br />
public struct Check<br />
{<br />
public int I;<br />
public Test [] structArray ;<br />
<br />
public int GetMySize()<br />
{<br />
int iSize = Marshal.SizeOf( I) + Marshal.SizeOf( typeof( Test)) * structArray.Length;<br />
return iSize;<br />
}<br />
<br />
public void MarshalStructToPtr(ref IntPtr ptr)<br />
{<br />
Marshal.StructureToPtr(I ,ptr, true);<br />
ptr = (IntPtr)((int)ptr + Marshal.SizeOf( I ));<br />
<br />
for( int count = 0; count < structArray.Length; count ++ )<br />
{<br />
Marshal.StructureToPtr(structArray[count],ptr, true);<br />
ptr = (IntPtr)((int)ptr + Marshal.SizeOf( structArray[count] ));<br />
}<br />
<br />
}<br />
<br />
<br />
}<br />
<br />
class ConvertStructToByteArray<br />
{<br />
<br />
public void Convert()<br />
{<br />
Test test1 = new Test();<br />
test1.i = 2;<br />
test1.s = "test";<br />
<br />
Check objCheck = new Check();<br />
objCheck.I =10;<br />
objCheck.structArray = new Test[1];<br />
objCheck.structArray[0] = test1;<br />
<br />
int Size = objCheck.GetMySize() ;<br />
IntPtr pCheck = Marshal.AllocHGlobal((int)Size );<br />
IntPtr Temp = pCheck;<br />
objCheck.MarshalStructToPtr( ref Temp);<br />
<br />
byte[] bytearrCheck = new byte[ Size];<br />
Marshal.Copy( pCheck , bytearrCheck , 0,(int)Size);<br />
Marshal.FreeHGlobal( pCheck );<br />
}<br />
}
|
|
|
|
|
Hi,
I found a code on net which allows multiline text in the datagrid cell.
The sample code wasin VB.net, I just converted it to C#.
Now the problem is the GetMethod is returning me null instead of an object. The code snippet is attached below
<br />
MethodInfo mi = dg.GetType().GetMethod("get_DataGridRows", <br />
BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase | <br />
BindingFlags.Instance | BindingFlags.NonPublic | <br />
BindingFlags.Public | BindingFlags.Static); <br />
<br />
<br />
Array dgRowArray = (Array) mi.Invoke(this.dg, null);<br />
the mi object is not getting created. It always says undefined.
Am executing the above code in the overrided paint event of the datagrid.
Can anyone help me out
Any help is highly appreciated.
Thanks in advance
Regards,
Kais
|
|
|
|
|
Hello Kais,
I also had problems with MethodInfo.
So I changed my code too InvokeRequired, by using a delegate.
private delegate void OnPaintDelegate(System.Windows.Forms.PaintEventArgs e);
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
if(InvokeRequired)
{
OnPaintDelegate(new OnPaintDelegate(_OnPaint), new object [] { e } );
return;
}
//Your code
}
Hope that helps you.
All the best,
Martin
|
|
|
|
|
Hi Martin,
Where do we need to define "InvokeRequired" variable?
Also i have override the paint method which has 7 parameters. Is that an issue?
Please guide me if am wrong. I want to make this work.
Regards,
Kais
|
|
|
|
|
Hi Kais,
InvokeRequired is a member of System.Windows.Forms.Control.
You can have as much parameters as you whant, as long as your delagates has the same.
private delegate void xxxDelegate(..., ..., ..., ...);
Hope that helps you!
All the best,
Martin
|
|
|
|
|
Hi Martin,
Thanks for your prompt reply.
I added the peice of your code in my customized datagrid class which inherits from DataGrid.
Now it throws me the following errors
The name '_OnPaint' does not exist in the class or namespace CustomControl.CustomGrid.CustomDataGrid'
CustomControl.CustomGrid.CustomDataGrid.OnPaintDelegate' denotes a 'class' which is not valid in the given context
This might be a stupid thing i am asking. The delegate needs to be wrapped with the method. Where do i need to assign the method for it?
Thanks in advance
Regards,
Kais
|
|
|
|
|
Sorry,
Was my mistake!
private delegate void get_DataGridRowsDelegate(..., ..., ..., ...);
protected override void get_DataGridRows(..., ..., ..., ...)
{
if(InvokeRequired)
{
get_DataGridRowsDelegate(new get_DataGridRowsDelegate(get_DataGridRows), new object [] { ..., ..., ..., ..., } );
return;
}
//Your code
}
The method has to be your get_DataGridRows Method you asked for. With all the parameters you had.
If its not working, please post the code here!
Martin
-- modified at 8:08 Monday 3rd July, 2006
|
|
|
|
|
Was a little confused before.
I mixed my code to yours and forgot your actual question.
|
|
|
|
|
Martin,
Thats ok. But get_DataGridRows method is not available for override. How will this work?
Regards,
Kais
|
|
|
|
|
In your case, you can create Method like you had before.
private void get_DataGridRows(...... ;
just insert code in your Method.
Martin
Please give me feedback, if it works.
|
|
|
|
|
Again, it was code from my project.
|
|
|
|
|
Ok let me try out.
I need to leave for the day now.
Catch you tomorrow..
Thank you very much for your suggestion and time.
Regards,
Kais
|
|
|
|
|
hi Martin,
In meanwhile is it possible for you to send me the complete sample code.
I would be very greatful for you if i can get the sample code.
Thanks for all your help
Regards
Kais
|
|
|
|
|
Hello All,
We are using a third parties VB6 object resource file with icons, bitmaps, and text. Ours is completely C# and we are having trouble converting from stdole.stdpicture to C# Image. In VB6 we can access everything fine. In C# we can get the text and the bitmap to convert perfectly but the icons are giving us trouble. The VB method returns a stdpicture object and we use the System.Windows.Forms.AxHost.GetPictureFromIPicture perfectly with the bitmap but we get an error with the icons. Even though the vb method returns a stdpicture C# sees it as an icon and I know of no equivalent to GetPictureFromIPicture for icons. The error is "Unable to cast object of type 'System.Drawing.Icon' to type 'System.Drawing.Image'."
Any way around this would be greatly appreciated.
|
|
|
|
|
After using Google to search for "Converting System.Drawing.Icon to System.Drawing.Image" I found this link in about 2 minutes.
Microsoft Article[^]
It is MS -- so it is VB crap. But it should get you started.
|
|
|
|
|
I guess I wasn't clear. This is exactly what we are trying but the incoming Ipicture is seen in VS2005 as an Icon and bombs when you reach the GetPictureFromIPicture with the error mentioned originally. The one difference we are doing from the samples like the one you provided is we are using stdole.StdPicture as that is what the vb object returns so we can't use stdole.IPictureDisp. I am currently writing a quick project in 2003 to see if it is a VS2005 bug. Our other thought is to write a vb object that takes the stdPicture from the 3rd party dll turn it into something else then pass it along to C#. What a pain though.
|
|
|
|