Click here to Skip to main content
15,905,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I cant convert OLE_COLOR, Collection and StdPicture type of VB6 to C#? What are they in C#? Thanks.
Posted
Updated 19-Oct-12 4:09am
v3

1 solution

C#
//OLE color
// Create an instance of a Color structure.
Color myColor = Color.Red;

// Translate myColor to an OLE color.
int oleColor = ColorTranslator.ToOle(myColor);

// Translate oleColor to a GDI+ Color structure.
Color myColorAgain = ColorTranslator.FromOle(oleColor);

/*-------------------------------------------------------*/
//Collection 
System.Collection.ObjectModel.Collection<T>

/*Ref : http://msdn.microsoft.com/en-us/library/ms132397(v=vs.90).aspx */

/*-------------------------------------------------------*/
//StdPicture
IntPtr iconHandle = (IntPtr)GetHandleFromYourCOMMethod(); // assuming the COM(VB6) method returns StdPicture
Icon myIcon = Icon.FromHandle(icnoHandle);


/*-------------------------------------------------------*/
//FormWindowStateConstants
VB              .Net(C#)
vbNormal    (0)	System.Windows.Forms.FormWindowState.Normal
vbMinimized (1)	System.Windows.Forms.FormWindowState.Minimized
vbMaximized (2)	System.Windows.Forms.FormWindowState.Maximized

/* Ref: http://msdn.microsoft.com/en-us/library/system.windows.forms.formwindowstate.aspx */
 
Share this answer
 
v6
Comments
Andrewpeter 19-Oct-12 10:15am    
Thanks you, Kuthuparakkal. What are "Collection, StdPicture and FormWindowStateConstants" in C#? Can you help me about this? My vote is 5.
Kuthuparakkal 19-Oct-12 10:32am    
updated see now
Andrewpeter 19-Oct-12 10:45am    
Thanks. I dont understand Collection from your link, i have a declare in VB6 as following:

Private z_Funk As Collection 'hWnd/thunk-address collection

I want to convert Collection type above to C# code, help me convert completely this code. Thank you very much.
Kuthuparakkal 19-Oct-12 11:57am    
A collection is an ordered set of items that you can refer to as a unit. VB6 makes use of collections in many ways, such as keeping track of controls on a form and system printers. VB6 also provides a generic Collection object for you to use in your programs. What makes the Collection object so useful is that the items it contains can be essentially anything—variables, literal numbers or text, objects, and so on. And, they don't have to be the same data type.

List<T> represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists, read:
http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900