Wha??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This structure definition works! The only difference is that it initializes all the members, which I didn't even know was legal in C#. Any clue why that would make a difference?

[ StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)
class LOGFON

public int lfHeight = 0
public int lfWidth = 0
public int lfEscapement = 0
public int lfOrientation = 0
public int lfWeight = 0
public byte lfItalic = 0
public byte lfUnderline = 0
public byte lfStrikeOut = 0
public byte lfCharSet = 0
public byte lfOutPrecision = 0
public byte lfClipPrecision = 0
public byte lfQuality = 0
public byte lfPitchAndFamily = 0
[ MarshalAs(UnmanagedType.ByValTStr, SizeConst=32) ] public string lfFaceName = null
 
Got me. The initialization is allowed because it is a class. If it was a structure I don't believe you could do that. I myself had a hard time finding the same stuff. I am currently working on converting some old C code that was used to manage style sheets into a manged C# class library. In the Framework CLR message board look under the system.drawing news group. THere is a guy that post a lot over there and he has a web site set up that is dedicated to nothing but GDI and GDI+ here is the link to that site http://www.bobpowell.net/gdiplus_faq.htm. He has responded to some of my post that I authored as "Bob". However based on abilities lately I thought I would call myself as BobTheHacker because that is what I feel I am doing at time and that is Hacking Code.
 
Back
Top