 |
|
C# WinApp ช่วยอธิบาย โค้ด นี้อย่างละเอียดหน่อยครับ |
|
 |
|
|
 |
 |
|
เข้าใจว่ามันน่าจะเป็นหลายๆ ค่า ครับ เหมือนกับกำหนดคุณสมบัติ
|
 |
 |
 |
 |
Date :
2017-06-28 18:26:39 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โค้ดเป็นแบบนี้ครับ
Code (C#)
protected override CreateParams CreateParams {
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
get {
CreateParams cp = base.CreateParams;
cp.ClassName = "COMBOBOX";
cp.Style |= NativeMethods.WS_VSCROLL | NativeMethods.CBS_HASSTRINGS | NativeMethods.CBS_AUTOHSCROLL;
cp.ExStyle |= NativeMethods.WS_EX_CLIENTEDGE;
if (!integralHeight) cp.Style |= NativeMethods.CBS_NOINTEGRALHEIGHT;
switch (DropDownStyle) {
case ComboBoxStyle.Simple:
cp.Style |= NativeMethods.CBS_SIMPLE;
break;
case ComboBoxStyle.DropDown:
cp.Style |= NativeMethods.CBS_DROPDOWN;
// Make sure we put the height back or we won't be able to size the dropdown!
cp.Height = PreferredHeight;
break;
case ComboBoxStyle.DropDownList:
cp.Style |= NativeMethods.CBS_DROPDOWNLIST;
// Comment above...
cp.Height = PreferredHeight;
break;
}
switch (DrawMode) {
case DrawMode.OwnerDrawFixed:
cp.Style |= NativeMethods.CBS_OWNERDRAWFIXED;
break;
case DrawMode.OwnerDrawVariable:
cp.Style |= NativeMethods.CBS_OWNERDRAWVARIABLE;
break;
}
return cp;
}
}
ทำไมผมเอามาลองเล่นดู เล่นไม่ได้เหมือนเขาละครับ
รึต้องมีอะไรซับซ้อนกว่านี้รึ
|
 |
 |
 |
 |
Date :
2017-06-28 19:40:24 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้วอย่างตัวเลขในโค้ดนี้ละครับ ใช่ฐาน 16 หรือป่าวครับ สงสัยว่าทำไม เขาไม่เขียนเป็น Int 1 2 3 4 รึครับ
Code (C#)
public const int SHGFI_ICON = 0x000000100 , // get icon
SHGFI_DISPLAYNAME = 0x000000200, // get display name
SHGFI_TYPENAME = 0x000000400, // get type name
SHGFI_ATTRIBUTES = 0x000000800, // get attributes
SHGFI_ICONLOCATION = 0x000001000, // get icon location
SHGFI_EXETYPE = 0x000002000, // return exe type
SHGFI_SYSICONINDEX = 0x000004000, // get system icon index
SHGFI_LINKOVERLAY = 0x000008000, // put a link overlay on icon
SHGFI_SELECTED = 0x000010000, // show icon in selected state
SHGFI_ATTR_SPECIFIED = 0x000020000, // get only specified attributes
SHGFI_LARGEICON = 0x000000000, // get large icon
SHGFI_SMALLICON = 0x000000001, // get small icon
SHGFI_OPENICON = 0x000000002, // get open icon
SHGFI_SHELLICONSIZE = 0x000000004, // get shell size icon
SHGFI_PIDL = 0x000000008, // pszPath is a pidl
SHGFI_USEFILEATTRIBUTES = 0x000000010, // use passed dwFileAttribute
SHGFI_ADDOVERLAYS = 0x000000020, // apply the appropriate overlays
SHGFI_OVERLAYINDEX = 0x000000040; // Get the index of the overlay
|
 |
 |
 |
 |
Date :
2017-06-29 08:54:24 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|