以下为工作中遇到的,备注一下

先需要几个辅助类

  1. #region GripBounds
  2.  
  3. using System.Drawing;
  4. internal struct GripBounds
  5. {
  6. private const int GripSize = ;
  7. private const int CornerGripSize = GripSize << ;
  8.  
  9. public GripBounds(Rectangle clientRectangle)
  10. {
  11. this.clientRectangle = clientRectangle;
  12. }
  13.  
  14. private Rectangle clientRectangle;
  15. public Rectangle ClientRectangle
  16. {
  17. get { return clientRectangle; }
  18. //set { clientRectangle = value; }
  19. }
  20.  
  21. public Rectangle Bottom
  22. {
  23. get
  24. {
  25. Rectangle rect = ClientRectangle;
  26. rect.Y = rect.Bottom - GripSize + ;
  27. rect.Height = GripSize;
  28. return rect;
  29. }
  30. }
  31.  
  32. public Rectangle BottomRight
  33. {
  34. get
  35. {
  36. Rectangle rect = ClientRectangle;
  37. rect.Y = rect.Bottom - CornerGripSize + ;
  38. rect.Height = CornerGripSize;
  39. rect.X = rect.Width - CornerGripSize + ;
  40. rect.Width = CornerGripSize;
  41. return rect;
  42. }
  43. }
  44.  
  45. public Rectangle Top
  46. {
  47. get
  48. {
  49. Rectangle rect = ClientRectangle;
  50. rect.Height = GripSize;
  51. return rect;
  52. }
  53. }
  54.  
  55. public Rectangle TopRight
  56. {
  57. get
  58. {
  59. Rectangle rect = ClientRectangle;
  60. rect.Height = CornerGripSize;
  61. rect.X = rect.Width - CornerGripSize + ;
  62. rect.Width = CornerGripSize;
  63. return rect;
  64. }
  65. }
  66.  
  67. public Rectangle Left
  68. {
  69. get
  70. {
  71. Rectangle rect = ClientRectangle;
  72. rect.Width = GripSize;
  73. return rect;
  74. }
  75. }
  76.  
  77. public Rectangle BottomLeft
  78. {
  79. get
  80. {
  81. Rectangle rect = ClientRectangle;
  82. rect.Width = CornerGripSize;
  83. rect.Y = rect.Height - CornerGripSize + ;
  84. rect.Height = CornerGripSize;
  85. return rect;
  86. }
  87. }
  88.  
  89. public Rectangle Right
  90. {
  91. get
  92. {
  93. Rectangle rect = ClientRectangle;
  94. rect.X = rect.Right - GripSize + ;
  95. rect.Width = GripSize;
  96. return rect;
  97. }
  98. }
  99.  
  100. public Rectangle TopLeft
  101. {
  102. get
  103. {
  104. Rectangle rect = ClientRectangle;
  105. rect.Width = CornerGripSize;
  106. rect.Height = CornerGripSize;
  107. return rect;
  108. }
  109. }
  110. }
  111.  
  112. #endregion
  1. #region UnsafeMethods
  2.  
  3. using System;
  4. using System.Drawing;
  5. using System.Runtime.InteropServices;
  6. internal class UnsafeMethods
  7. {
  8. public static readonly IntPtr TRUE = new IntPtr();
  9. public static readonly IntPtr FALSE = new IntPtr();
  10.  
  11. public const int WM_LBUTTONDOWN = 0x201;
  12. public const int WM_RBUTTONDOWN = 0x204;
  13. public const int WM_MBUTTONDOWN = 0x207;
  14. public const int WM_NCLBUTTONDOWN = 0x0A1;
  15. public const int WM_NCRBUTTONDOWN = 0x0A4;
  16. public const int WM_NCMBUTTONDOWN = 0x0A7;
  17. public const int WM_NCCALCSIZE = 0x0083;
  18. public const int WM_NCHITTEST = 0x0084;
  19. public const int WM_NCPAINT = 0x0085;
  20. public const int WM_NCACTIVATE = 0x0086;
  21. public const int WM_MOUSELEAVE = 0x02A3;
  22. public const int WS_EX_NOACTIVATE = 0x08000000;
  23. public const int HTTRANSPARENT = -;
  24. public const int HTLEFT = ;
  25. public const int HTRIGHT = ;
  26. public const int HTTOP = ;
  27. public const int HTTOPLEFT = ;
  28. public const int HTTOPRIGHT = ;
  29. public const int HTBOTTOM = ;
  30. public const int HTBOTTOMLEFT = ;
  31. public const int HTBOTTOMRIGHT = ;
  32. public const int WM_USER = 0x0400;
  33. public const int WM_REFLECT = WM_USER + 0x1C00;
  34. public const int WM_COMMAND = 0x0111;
  35. public const int CBN_DROPDOWN = ;
  36. public const int WM_GETMINMAXINFO = 0x0024;
  37.  
  38. public enum TrackerEventFlags : uint
  39. {
  40. TME_HOVER = 0x00000001,
  41. TME_LEAVE = 0x00000002,
  42. TME_QUERY = 0x40000000,
  43. TME_CANCEL = 0x80000000
  44. }
  45.  
  46. [DllImport("user32.dll")]
  47. public static extern IntPtr GetWindowDC(IntPtr hWnd);
  48.  
  49. [DllImport("user32.dll")]
  50. public static extern int ReleaseDC(IntPtr hwnd, IntPtr hDC);
  51.  
  52. [DllImport("user32")]
  53. public static extern bool TrackMouseEvent(ref TRACKMOUSEEVENT lpEventTrack);
  54.  
  55. [DllImport("user32.dll")]
  56. public static extern bool SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
  57.  
  58. internal static int HIWORD(int n)
  59. {
  60. return (n >> ) & 0xffff;
  61. }
  62.  
  63. internal static int HIWORD(IntPtr n)
  64. {
  65. return HIWORD(unchecked((int)(long)n));
  66. }
  67.  
  68. internal static int LOWORD(int n)
  69. {
  70. return n & 0xffff;
  71. }
  72.  
  73. internal static int LOWORD(IntPtr n)
  74. {
  75. return LOWORD(unchecked((int)(long)n));
  76. }
  77.  
  78. [StructLayout(LayoutKind.Sequential)]
  79. internal struct TRACKMOUSEEVENT
  80. {
  81. public uint cbSize;
  82. public uint dwFlags;
  83. public IntPtr hwndTrack;
  84. public uint dwHoverTime;
  85. }
  86.  
  87. [StructLayout(LayoutKind.Sequential)]
  88. internal struct MINMAXINFO
  89. {
  90. public Point reserved;
  91. public Size maxSize;
  92. public Point maxPosition;
  93. public Size minTrackSize;
  94. public Size maxTrackSize;
  95. }
  96.  
  97. #region RECT structure
  98.  
  99. [StructLayout(LayoutKind.Sequential)]
  100. internal struct RECT
  101. {
  102. public int left;
  103. public int top;
  104. public int right;
  105. public int bottom;
  106.  
  107. public RECT(int left, int top, int right, int bottom)
  108. {
  109. this.left = left;
  110. this.top = top;
  111. this.right = right;
  112. this.bottom = bottom;
  113. }
  114.  
  115. public Rectangle Rect
  116. {
  117. get
  118. {
  119. return new Rectangle(
  120. this.left,
  121. this.top,
  122. this.right - this.left,
  123. this.bottom - this.top);
  124. }
  125. }
  126.  
  127. public static RECT FromXYWH(int x, int y, int width, int height)
  128. {
  129. return new RECT(x,
  130. y,
  131. x + width,
  132. y + height);
  133. }
  134.  
  135. public static RECT FromRectangle(Rectangle rect)
  136. {
  137. return new RECT(rect.Left,
  138. rect.Top,
  139. rect.Right,
  140. rect.Bottom);
  141. }
  142. }
  143.  
  144. #endregion RECT structure
  145.  
  146. #region WINDOWPOS
  147.  
  148. [StructLayout(LayoutKind.Sequential)]
  149. internal struct WINDOWPOS
  150. {
  151. internal IntPtr hwnd;
  152. internal IntPtr hWndInsertAfter;
  153. internal int x;
  154. internal int y;
  155. internal int cx;
  156. internal int cy;
  157. internal uint flags;
  158. }
  159. #endregion
  160.  
  161. #region NCCALCSIZE_PARAMS
  162. //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowstructures/nccalcsize_params.asp
  163. [StructLayout(LayoutKind.Sequential)]
  164. public struct NCCALCSIZE_PARAMS
  165. {
  166. /// <summary>
  167. /// Contains the new coordinates of a window that has been moved or resized, that is, it is the proposed new window coordinates.
  168. /// </summary>
  169. public RECT rectProposed;
  170. /// <summary>
  171. /// Contains the coordinates of the window before it was moved or resized.
  172. /// </summary>
  173. public RECT rectBeforeMove;
  174. /// <summary>
  175. /// Contains the coordinates of the window's client area before the window was moved or resized.
  176. /// </summary>
  177. public RECT rectClientBeforeMove;
  178. /// <summary>
  179. /// Pointer to a WINDOWPOS structure that contains the size and position values specified in the operation that moved or resized the window.
  180. /// </summary>
  181. public WINDOWPOS lpPos;
  182. }
  183.  
  184. #endregion
  185. }
  186.  
  187. #endregion
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Security.Permissions;
  10. using System.Runtime.InteropServices;
  11. using VS = System.Windows.Forms.VisualStyles;
  12.  
  13. /*
  14. <li>Base class for custom tooltips.</li>
  15. <li>Office-2007-like tooltip class.</li>
  16. */
  17. namespace ZhuoYueE.Bpc.Controls
  18. {
  19. /// <summary>
  20. /// Represents a pop-up window.
  21. /// </summary>
  22. [ToolboxItem(false)]
  23. public partial class PopupForm : ToolStripDropDown
  24. {
  25. #region " Fields & Properties "
  26.  
  27. private Control content;
  28. /// <summary>
  29. /// Gets the content of the pop-up.
  30. /// </summary>
  31. public Control Content
  32. {
  33. get { return content; }
  34. }
  35.  
  36. private bool fade;
  37. /// <summary>
  38. /// Gets a value indicating whether the <see cref="PopupControl.Popup"/> uses the fade effect.
  39. /// </summary>
  40. /// <value><c>true</c> if pop-up uses the fade effect; otherwise, <c>false</c>.</value>
  41. /// <remarks>To use the fade effect, the FocusOnOpen property also has to be set to <c>true</c>.</remarks>
  42. public bool UseFadeEffect
  43. {
  44. get { return fade; }
  45. set
  46. {
  47. if (fade == value) return;
  48. fade = value;
  49. }
  50. }
  51.  
  52. private bool focusOnOpen = true;
  53. /// <summary>
  54. /// Gets or sets a value indicating whether the content should receive the focus after the pop-up has been opened.
  55. /// </summary>
  56. /// <value><c>true</c> if the content should be focused after the pop-up has been opened; otherwise, <c>false</c>.</value>
  57. /// <remarks>If the FocusOnOpen property is set to <c>false</c>, then pop-up cannot use the fade effect.</remarks>
  58. public bool FocusOnOpen
  59. {
  60. get { return focusOnOpen; }
  61. set { focusOnOpen = value; }
  62. }
  63.  
  64. private bool acceptAlt = true;
  65. /// <summary>
  66. /// Gets or sets a value indicating whether presing the alt key should close the pop-up.
  67. /// </summary>
  68. /// <value><c>true</c> if presing the alt key does not close the pop-up; otherwise, <c>false</c>.</value>
  69. public bool AcceptAlt
  70. {
  71. get { return acceptAlt; }
  72. set { acceptAlt = value; }
  73. }
  74.  
  75. private PopupForm ownerPopup;
  76. private PopupForm childPopup;
  77.  
  78. private bool _resizable;
  79. private bool resizable;
  80. /// <summary>
  81. /// Gets or sets a value indicating whether the <see cref="PopupControl.Popup" /> is resizable.
  82. /// </summary>
  83. /// <value><c>true</c> if resizable; otherwise, <c>false</c>.</value>
  84. public bool Resizable
  85. {
  86. get { return resizable && _resizable; }
  87. set { resizable = value; }
  88. }
  89.  
  90. private ToolStripControlHost host;
  91.  
  92. private Size minSize;
  93. /// <summary>
  94. /// Gets or sets a minimum size of the pop-up.
  95. /// </summary>
  96. /// <returns>An ordered pair of type <see cref="T:System.Drawing.Size" /> representing the width and height of a rectangle.</returns>
  97. public new Size MinimumSize
  98. {
  99. get { return minSize; }
  100. set { minSize = value; }
  101. }
  102.  
  103. private Size maxSize;
  104. /// <summary>
  105. /// Gets or sets a maximum size of the pop-up.
  106. /// </summary>
  107. /// <returns>An ordered pair of type <see cref="T:System.Drawing.Size" /> representing the width and height of a rectangle.</returns>
  108. public new Size MaximumSize
  109. {
  110. get { return maxSize; }
  111. set { maxSize = value; }
  112. }
  113.  
  114. private bool _isOpen;
  115.  
  116. public bool IsOpen
  117. {
  118. get { return _isOpen; }
  119. }
  120.  
  121. /// <summary>
  122. /// Gets parameters of a new window.
  123. /// </summary>
  124. /// <returns>An object of type <see cref="T:System.Windows.Forms.CreateParams" /> used when creating a new window.</returns>
  125. protected override CreateParams CreateParams
  126. {
  127. [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
  128. get
  129. {
  130. CreateParams cp = base.CreateParams;
  131. cp.ExStyle |= UnsafeMethods.WS_EX_NOACTIVATE;
  132. return cp;
  133. }
  134. }
  135.  
  136. #endregion
  137.  
  138. #region " Constructors "
  139.  
  140. /// <summary>
  141. /// Initializes a new instance of the <see cref="PopupControl.Popup"/> class.
  142. /// </summary>
  143. /// <param name="content">The content of the pop-up.</param>
  144. /// <remarks>
  145. /// Pop-up will be disposed immediately after disposion of the content control.
  146. /// </remarks>
  147. /// <exception cref="T:System.ArgumentNullException"><paramref name="content" /> is <code>null</code>.</exception>
  148. public PopupForm(Control content)
  149. {
  150. if (content == null)
  151. {
  152. throw new ArgumentNullException("content");
  153. }
  154. this.content = content;
  155. this.fade = SystemInformation.IsMenuAnimationEnabled && SystemInformation.IsMenuFadeEnabled;
  156. this._resizable = true;
  157. AutoSize = false;
  158. DoubleBuffered = true;
  159. ResizeRedraw = true;
  160. host = new ToolStripControlHost(content);
  161. Padding = Margin = host.Padding = host.Margin = Padding.Empty;
  162. MinimumSize = content.MinimumSize;
  163. content.MinimumSize = content.Size;
  164. MaximumSize = content.MaximumSize;
  165. content.MaximumSize = content.Size;
  166. Size = content.Size;
  167. content.Location = Point.Empty;
  168. Items.Add(host);
  169. content.Disposed += delegate(object sender, EventArgs e)
  170. {
  171. content = null;
  172. Dispose(true);
  173. };
  174. content.RegionChanged += delegate(object sender, EventArgs e)
  175. {
  176. UpdateRegion();
  177. };
  178. content.Paint += delegate(object sender, PaintEventArgs e)
  179. {
  180. PaintSizeGrip(e);
  181. };
  182. UpdateRegion();
  183. }
  184.  
  185. #endregion
  186.  
  187. #region " Methods "
  188.  
  189. /// <summary>
  190. /// Processes a dialog box key.
  191. /// </summary>
  192. /// <param name="keyData">One of the <see cref="T:System.Windows.Forms.Keys" /> values that represents the key to process.</param>
  193. /// <returns>
  194. /// true if the key was processed by the control; otherwise, false.
  195. /// </returns>
  196. protected override bool ProcessDialogKey(Keys keyData)
  197. {
  198. if (acceptAlt && ((keyData & Keys.Alt) == Keys.Alt))
  199. {
  200. if ((keyData & Keys.F4) != Keys.F4)
  201. {
  202. return false;
  203. }
  204. else
  205. {
  206. this.Close();
  207. }
  208. }
  209. return base.ProcessDialogKey(keyData);
  210. }
  211.  
  212. /// <summary>
  213. /// Updates the pop-up region.
  214. /// </summary>
  215. protected void UpdateRegion()
  216. {
  217. if (this.Region != null)
  218. {
  219. this.Region.Dispose();
  220. this.Region = null;
  221. }
  222. if (content.Region != null)
  223. {
  224. this.Region = content.Region.Clone();
  225. }
  226. }
  227.  
  228. /// <summary>
  229. /// Shows the pop-up window below the specified control.
  230. /// </summary>
  231. /// <param name="control">The control below which the pop-up will be shown.</param>
  232. /// <remarks>
  233. /// When there is no space below the specified control, the pop-up control is shown above it.
  234. /// </remarks>
  235. /// <exception cref="T:System.ArgumentNullException"><paramref name="control"/> is <code>null</code>.</exception>
  236. public void Show(Control control)
  237. {
  238. Show(control, control.ClientRectangle);
  239. }
  240.  
  241. public void Show(Control control, bool center)
  242. {
  243. Show(control, control.ClientRectangle, center);
  244. }
  245.  
  246. /// <summary>
  247. /// Shows the pop-up window below the specified area of the specified control.
  248. /// </summary>
  249. /// <param name="control">The control used to compute screen location of specified area.</param>
  250. /// <param name="area">The area of control below which the pop-up will be shown.</param>
  251. /// <remarks>
  252. /// When there is no space below specified area, the pop-up control is shown above it.
  253. /// </remarks>
  254. /// <exception cref="T:System.ArgumentNullException"><paramref name="control"/> is <code>null</code>.</exception>
  255. public void Show(Control control, Rectangle area)
  256. {
  257. Show(control, area, false);
  258. }
  259.  
  260. public void Show(Control control, Rectangle area, bool center)
  261. {
  262. if (control == null)
  263. {
  264. throw new ArgumentNullException("control");
  265. }
  266. SetOwnerItem(control);
  267. resizableTop = resizableLeft = false;
  268. Point location = control.PointToScreen(new Point(area.Left, area.Top + area.Height));
  269. Rectangle screen = Screen.FromControl(control).WorkingArea;
  270. if (center)
  271. {
  272. if (location.X + (area.Width + Size.Width) / > screen.Right)
  273. {
  274. resizableLeft = true;
  275. location.X = screen.Right - Size.Width;
  276. }
  277. else
  278. {
  279. resizableLeft = true;
  280. location.X = location.X - (Size.Width - area.Width) / ;
  281. }
  282. }
  283. else
  284. {
  285. if (location.X + Size.Width > (screen.Left + screen.Width))
  286. {
  287. resizableLeft = true;
  288. location.X = (screen.Left + screen.Width) - Size.Width;
  289. }
  290. }
  291.  
  292. if (location.Y + Size.Height > (screen.Top + screen.Height))
  293. {
  294. resizableTop = true;
  295. location.Y -= Size.Height + area.Height;
  296. }
  297. location = control.PointToClient(location);
  298. Show(control, location, ToolStripDropDownDirection.BelowRight);
  299. }
  300.  
  301. private const int frames = ;
  302. private const int totalduration = ;
  303. private const int frameduration = totalduration / frames;
  304. /// <summary>
  305. /// Adjusts the size of the owner <see cref="T:System.Windows.Forms.ToolStrip" /> to accommodate the <see cref="T:System.Windows.Forms.ToolStripDropDown" /> if the owner <see cref="T:System.Windows.Forms.ToolStrip" /> is currently displayed, or clears and resets active <see cref="T:System.Windows.Forms.ToolStripDropDown" /> child controls of the <see cref="T:System.Windows.Forms.ToolStrip" /> if the <see cref="T:System.Windows.Forms.ToolStrip" /> is not currently displayed.
  306. /// </summary>
  307. /// <param name="visible">true if the owner <see cref="T:System.Windows.Forms.ToolStrip" /> is currently displayed; otherwise, false.</param>
  308. protected override void SetVisibleCore(bool visible)
  309. {
  310. double opacity = Opacity;
  311. if (visible && fade && focusOnOpen) Opacity = ;
  312. base.SetVisibleCore(visible);
  313. if (!visible || !fade || !focusOnOpen) return;
  314. for (int i = ; i <= frames; i++)
  315. {
  316. if (i > )
  317. {
  318. System.Threading.Thread.Sleep(frameduration);
  319. }
  320. Opacity = opacity * (double)i / (double)frames;
  321. }
  322. Opacity = opacity;
  323. }
  324.  
  325. private bool resizableTop;
  326. private bool resizableLeft;
  327.  
  328. private void SetOwnerItem(Control control)
  329. {
  330. if (control == null)
  331. {
  332. return;
  333. }
  334. if (control is PopupForm)
  335. {
  336. PopupForm popupControl = control as PopupForm;
  337. ownerPopup = popupControl;
  338. ownerPopup.childPopup = this;
  339. OwnerItem = popupControl.Items[];
  340. return;
  341. }
  342. if (control.Parent != null)
  343. {
  344. SetOwnerItem(control.Parent);
  345. }
  346. }
  347.  
  348. /// <summary>
  349. /// Raises the <see cref="E:System.Windows.Forms.Control.SizeChanged" /> event.
  350. /// </summary>
  351. /// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
  352. protected override void OnSizeChanged(EventArgs e)
  353. {
  354. content.MinimumSize = Size;
  355. content.MaximumSize = Size;
  356. content.Size = Size;
  357. content.Location = Point.Empty;
  358. base.OnSizeChanged(e);
  359. }
  360.  
  361. /// <summary>
  362. /// Raises the <see cref="E:System.Windows.Forms.ToolStripDropDown.Opening" /> event.
  363. /// </summary>
  364. /// <param name="e">A <see cref="T:System.ComponentModel.CancelEventArgs" /> that contains the event data.</param>
  365. protected override void OnOpening(CancelEventArgs e)
  366. {
  367. if (content.IsDisposed || content.Disposing)
  368. {
  369. e.Cancel = true;
  370. return;
  371. }
  372. UpdateRegion();
  373. base.OnOpening(e);
  374. }
  375.  
  376. /// <summary>
  377. /// Raises the <see cref="E:System.Windows.Forms.ToolStripDropDown.Opened" /> event.
  378. /// </summary>
  379. /// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
  380. protected override void OnOpened(EventArgs e)
  381. {
  382. if (ownerPopup != null)
  383. {
  384. ownerPopup._resizable = false;
  385. }
  386. if (focusOnOpen)
  387. {
  388. content.Focus();
  389. }
  390. _isOpen = true;
  391. base.OnOpened(e);
  392. }
  393.  
  394. /// <summary>
  395. /// Raises the <see cref="E:System.Windows.Forms.ToolStripDropDown.Closed"/> event.
  396. /// </summary>
  397. /// <param name="e">A <see cref="T:System.Windows.Forms.ToolStripDropDownClosedEventArgs"/> that contains the event data.</param>
  398. protected override void OnClosed(ToolStripDropDownClosedEventArgs e)
  399. {
  400. if (ownerPopup != null)
  401. {
  402. ownerPopup._resizable = true;
  403. }
  404. _isOpen = false;
  405. base.OnClosed(e);
  406. }
  407.  
  408. #endregion
  409.  
  410. #region " Resizing Support "
  411.  
  412. /// <summary>
  413. /// Processes Windows messages.
  414. /// </summary>
  415. /// <param name="m">The Windows <see cref="T:System.Windows.Forms.Message" /> to process.</param>
  416. [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
  417. protected override void WndProc(ref Message m)
  418. {
  419. if (InternalProcessResizing(ref m, false))
  420. {
  421. return;
  422. }
  423. base.WndProc(ref m);
  424. }
  425.  
  426. /// <summary>
  427. /// Processes the resizing messages.
  428. /// </summary>
  429. /// <param name="m">The message.</param>
  430. /// <returns>true, if the WndProc method from the base class shouldn't be invoked.</returns>
  431. [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
  432. public bool ProcessResizing(ref Message m)
  433. {
  434. return InternalProcessResizing(ref m, true);
  435. }
  436.  
  437. [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
  438. private bool InternalProcessResizing(ref Message m, bool contentControl)
  439. {
  440. if (m.Msg == UnsafeMethods.WM_NCACTIVATE && m.WParam != IntPtr.Zero && childPopup != null && childPopup.Visible)
  441. {
  442. childPopup.Hide();
  443. }
  444. if (!Resizable)
  445. {
  446. return false;
  447. }
  448. if (m.Msg == UnsafeMethods.WM_NCHITTEST)
  449. {
  450. return OnNcHitTest(ref m, contentControl);
  451. }
  452. else if (m.Msg == UnsafeMethods.WM_GETMINMAXINFO)
  453. {
  454. return OnGetMinMaxInfo(ref m);
  455. }
  456. return false;
  457. }
  458.  
  459. [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
  460. private bool OnGetMinMaxInfo(ref Message m)
  461. {
  462. UnsafeMethods.MINMAXINFO minmax = (UnsafeMethods.MINMAXINFO)Marshal.PtrToStructure(m.LParam, typeof(UnsafeMethods.MINMAXINFO));
  463. minmax.maxTrackSize = this.MaximumSize;
  464. minmax.minTrackSize = this.MinimumSize;
  465. Marshal.StructureToPtr(minmax, m.LParam, false);
  466. return true;
  467. }
  468.  
  469. private bool OnNcHitTest(ref Message m, bool contentControl)
  470. {
  471. int x = UnsafeMethods.LOWORD(m.LParam);
  472. int y = UnsafeMethods.HIWORD(m.LParam);
  473. Point clientLocation = PointToClient(new Point(x, y));
  474.  
  475. GripBounds gripBouns = new GripBounds(contentControl ? content.ClientRectangle : ClientRectangle);
  476. IntPtr transparent = new IntPtr(UnsafeMethods.HTTRANSPARENT);
  477.  
  478. if (resizableTop)
  479. {
  480. if (resizableLeft && gripBouns.TopLeft.Contains(clientLocation))
  481. {
  482. m.Result = contentControl ? transparent : (IntPtr)UnsafeMethods.HTTOPLEFT;
  483. return true;
  484. }
  485. if (!resizableLeft && gripBouns.TopRight.Contains(clientLocation))
  486. {
  487. m.Result = contentControl ? transparent : (IntPtr)UnsafeMethods.HTTOPRIGHT;
  488. return true;
  489. }
  490. if (gripBouns.Top.Contains(clientLocation))
  491. {
  492. m.Result = contentControl ? transparent : (IntPtr)UnsafeMethods.HTTOP;
  493. return true;
  494. }
  495. }
  496. else
  497. {
  498. if (resizableLeft && gripBouns.BottomLeft.Contains(clientLocation))
  499. {
  500. m.Result = contentControl ? transparent : (IntPtr)UnsafeMethods.HTBOTTOMLEFT;
  501. return true;
  502. }
  503. if (!resizableLeft && gripBouns.BottomRight.Contains(clientLocation))
  504. {
  505. m.Result = contentControl ? transparent : (IntPtr)UnsafeMethods.HTBOTTOMRIGHT;
  506. return true;
  507. }
  508. if (gripBouns.Bottom.Contains(clientLocation))
  509. {
  510. m.Result = contentControl ? transparent : (IntPtr)UnsafeMethods.HTBOTTOM;
  511. return true;
  512. }
  513. }
  514. if (resizableLeft && gripBouns.Left.Contains(clientLocation))
  515. {
  516. m.Result = contentControl ? transparent : (IntPtr)UnsafeMethods.HTLEFT;
  517. return true;
  518. }
  519. if (!resizableLeft && gripBouns.Right.Contains(clientLocation))
  520. {
  521. m.Result = contentControl ? transparent : (IntPtr)UnsafeMethods.HTRIGHT;
  522. return true;
  523. }
  524. return false;
  525. }
  526.  
  527. private VS.VisualStyleRenderer sizeGripRenderer;
  528. /// <summary>
  529. /// Paints the sizing grip.
  530. /// </summary>
  531. /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs" /> instance containing the event data.</param>
  532. public void PaintSizeGrip(PaintEventArgs e)
  533. {
  534. if (e == null || e.Graphics == null || !resizable)
  535. {
  536. return;
  537. }
  538. Size clientSize = content.ClientSize;
  539. using (Bitmap gripImage = new Bitmap(0x10, 0x10))
  540. {
  541. using (Graphics g = Graphics.FromImage(gripImage))
  542. {
  543. if (Application.RenderWithVisualStyles)
  544. {
  545. if (this.sizeGripRenderer == null)
  546. {
  547. this.sizeGripRenderer = new VS.VisualStyleRenderer(VS.VisualStyleElement.Status.Gripper.Normal);
  548. }
  549. this.sizeGripRenderer.DrawBackground(g, new Rectangle(, , 0x10, 0x10));
  550. }
  551. else
  552. {
  553. ControlPaint.DrawSizeGrip(g, content.BackColor, , , 0x10, 0x10);
  554. }
  555. }
  556. GraphicsState gs = e.Graphics.Save();
  557. e.Graphics.ResetTransform();
  558. if (resizableTop)
  559. {
  560. if (resizableLeft)
  561. {
  562. e.Graphics.RotateTransform();
  563. e.Graphics.TranslateTransform(-clientSize.Width, -clientSize.Height);
  564. }
  565. else
  566. {
  567. e.Graphics.ScaleTransform(, -);
  568. e.Graphics.TranslateTransform(, -clientSize.Height);
  569. }
  570. }
  571. else if (resizableLeft)
  572. {
  573. e.Graphics.ScaleTransform(-, );
  574. e.Graphics.TranslateTransform(-clientSize.Width, );
  575. }
  576. e.Graphics.DrawImage(gripImage, clientSize.Width - 0x10, clientSize.Height - 0x10 + , 0x10, 0x10);
  577. e.Graphics.Restore(gs);
  578. }
  579. }
  580.  
  581. #endregion
  582. }
  583. }

然后新建一个自定义控件,代码如下


  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Collections;
  10. using System.Reflection;
  11. using Newtonsoft.Json.Linq;
  12.  
  13. namespace Controls
  14. {
  15.  
  16. /// <summary>
  17. /// 功能描述:自定义多选下拉框
  18. /// 作  者:huangzh
  19. /// 创建日期:2016-01-04 11:57:13
  20. /// 任务编号:
  21. /// </summary>
  22. public class ComboBoxEx : ComboBox
  23. {
  24. PopupForm frmhost;
  25. TreeView lst = new TreeView();
  26. /// <summary>
  27. /// 功能描述:构造方法
  28. /// 作  者:huangzh
  29. /// 创建日期:2016-01-04 11:57:27
  30. /// 任务编号:
  31. /// </summary>
  32. public ComboBoxEx()
  33. {
  34. this.DrawMode = DrawMode.OwnerDrawFixed;//只有设置这个属性为OwnerDrawFixed才可能让重画起作用
  35.  
  36. lst.Width = ListWidth == ? this.Width : ListWidth;
  37. lst.Height = ListHeight == ? : ListHeight;
  38. lst.CheckBoxes = true;
  39. lst.ShowLines = false;
  40. lst.ShowPlusMinus = false;
  41. lst.ShowRootLines = false;
  42. lst.KeyUp += new KeyEventHandler(lst_KeyUp);
  43. lst.AfterCheck += new TreeViewEventHandler(lst_AfterCheck);
  44. this.DropDownHeight = ;
  45. frmhost = new PopupForm(lst);
  46. //frmhost.Closed += new ToolStripDropDownClosedEventHandler(frmhost_Closed);
  47. //frmhost.Opened += new EventHandler(frmhost_Opened);
  48. }
  49.  
  50. void lst_KeyUp(object sender, KeyEventArgs e)
  51. {
  52. OnKeyUp(e);
  53. }
  54.  
  55. void lst_AfterCheck(object sender, TreeViewEventArgs e)
  56. {
  57. if (e.Node.Checked)
  58. {
  59. if (Text != "")
  60. {
  61. Text += ",";
  62. }
  63. Text += e.Node.Tag.ToString();
  64. }
  65. else
  66. {
  67. string strValue = e.Node.Tag.ToString().Trim();
  68. if (Text != "")
  69. {
  70. List<string> strs = Text.Split(',').ToList();
  71. strs.Remove("");
  72. if (strs.Contains(strValue))
  73. {
  74. strs.Remove(strValue);
  75. Text = string.Join(",", strs);
  76. }
  77. }
  78. }
  79. }
  80.  
  81. void frmhost_Opened(object sender, EventArgs e)
  82. {
  83.  
  84. }
  85.  
  86. void frmhost_Closed(object sender, ToolStripDropDownClosedEventArgs e)
  87. {
  88.  
  89. }
  90.  
  91. #region Property
  92. /// <summary>
  93. /// 选中项
  94. /// </summary>
  95. [Description("选定项的值"), Category("Data")]
  96. public List<TreeNode> SelectedItems
  97. {
  98. get
  99. {
  100. List<TreeNode> lsttn = new List<TreeNode>();
  101. foreach (TreeNode tn in lst.Nodes)
  102. {
  103. if (tn.Checked)
  104. {
  105. lsttn.Add(tn);
  106. }
  107. }
  108. return lsttn;
  109. }
  110. }
  111.  
  112. /// <summary>
  113. /// 数据源
  114. /// </summary>
  115. [Description("数据源"), Category("Data")]
  116. public new object DataSource
  117. {
  118. get;
  119. set;
  120. }
  121. /// <summary>
  122. /// 显示字段
  123. /// </summary>
  124. [Description("显示字段"), Category("Data")]
  125. public string DisplayFiled
  126. {
  127. get;
  128. set;
  129. }
  130. /// <summary>
  131. /// 值字段
  132. /// </summary>
  133. [Description("值字段"), Category("Data")]
  134. public string ValueFiled
  135. {
  136. get;
  137. set;
  138. }
  139. /// <summary>
  140. /// 列表高度
  141. /// </summary>
  142. [Description("列表高度"), Category("Data")]
  143. public int ListHeight
  144. {
  145. get;
  146. set;
  147. }
  148.  
  149. /// <summary>
  150. /// 列表宽度
  151. /// </summary>
  152. [Description("列表宽度"), Category("Data")]
  153. public int ListWidth
  154. {
  155. get;
  156. set;
  157. }
  158. #endregion
  159.  
  160. /// <summary>
  161. /// 功能描述:绑定数据
  162. /// 作  者:huangzh
  163. /// 创建日期:2016-01-04 10:38:51
  164. /// 任务编号:
  165. /// </summary>
  166. public void DataBind()
  167. {
  168. this.BeginUpdate();
  169. if (DataSource != null)
  170. {
  171. if (DataSource is IDataReader)
  172. {
  173. DataTable dataTable = new DataTable();
  174. dataTable.Load(DataSource as IDataReader);
  175.  
  176. DataBindToDataTable(dataTable);
  177. }
  178. else if (DataSource is DataView || DataSource is DataSet || DataSource is DataTable)
  179. {
  180. DataTable dataTable = null;
  181.  
  182. if (DataSource is DataView)
  183. {
  184. dataTable = ((DataView)DataSource).ToTable();
  185. }
  186. else if (DataSource is DataSet)
  187. {
  188. dataTable = ((DataSet)DataSource).Tables[];
  189. }
  190. else
  191. {
  192. dataTable = ((DataTable)DataSource);
  193. }
  194.  
  195. DataBindToDataTable(dataTable);
  196. }
  197. else if (DataSource is IEnumerable)
  198. {
  199. DataBindToEnumerable((IEnumerable)DataSource);
  200. }
  201. else
  202. {
  203. throw new Exception("DataSource doesn't support data type: " + DataSource.GetType().ToString());
  204. }
  205. }
  206. else
  207. {
  208. lst.Nodes.Clear();
  209. }
  210.  
  211. this.EndUpdate();
  212. }
  213.  
  214. /// <summary>
  215. /// 功能描述:绑定Table数据
  216. /// 作  者:huangzh
  217. /// 创建日期:2016-01-04 10:47:27
  218. /// 任务编号:
  219. /// </summary>
  220. /// <param name="dt">dt</param>
  221. private void DataBindToDataTable(DataTable dt)
  222. {
  223. foreach (DataRow dr in dt.Rows)
  224. {
  225. TreeNode tn = new TreeNode();
  226. if (!string.IsNullOrEmpty(DisplayFiled) && !string.IsNullOrEmpty(ValueFiled))
  227. {
  228. tn.Text = dr[DisplayFiled].ToString();
  229. tn.Tag = dr[ValueFiled].ToString();
  230. }
  231. else if (string.IsNullOrEmpty(ValueFiled))
  232. {
  233. tn.Text = dr[DisplayFiled].ToString();
  234. tn.Tag = dr[DisplayFiled].ToString();
  235. }
  236. else if (string.IsNullOrEmpty(DisplayFiled))
  237. {
  238. tn.Text = dr[ValueFiled].ToString();
  239. tn.Tag = dr[ValueFiled].ToString();
  240. }
  241. else
  242. {
  243. throw new Exception("ValueFiled和DisplayFiled至少保证有一项有值");
  244. }
  245. tn.ToolTipText = tn.Text;
  246.  
  247. tn.Checked = false;
  248. lst.Nodes.Add(tn);
  249. }
  250. }
  251.  
  252. /// <summary>
  253. /// 绑定到可枚举类型
  254. /// </summary>
  255. /// <param name="enumerable">可枚举类型</param>
  256. private void DataBindToEnumerable(IEnumerable enumerable)
  257. {
  258. IEnumerator enumerator = enumerable.GetEnumerator();
  259. while (enumerator.MoveNext())
  260. {
  261. object currentObject = enumerator.Current;
  262. lst.Nodes.Add(CreateListItem(currentObject));
  263. }
  264. }
  265.  
  266. /// <summary>
  267. /// 功能描述:获取一个CheckBox
  268. /// 作  者:huangzh
  269. /// 创建日期:2016-01-04 10:53:12
  270. /// 任务编号:
  271. /// </summary>
  272. /// <param name="obj">obj</param>
  273. /// <returns>返回值</returns>
  274. private TreeNode CreateListItem(Object obj)
  275. {
  276. TreeNode item = new TreeNode();
  277.  
  278. if (obj is string)
  279. {
  280. item.Text = obj.ToString();
  281. item.Tag = obj.ToString();
  282. }
  283. else
  284. {
  285. if (DisplayFiled != "")
  286. {
  287. item.Text = GetPropertyValue(obj, DisplayFiled);
  288. }
  289. else
  290. {
  291. item.Text = obj.ToString();
  292. }
  293.  
  294. if (ValueFiled != "")
  295. {
  296. item.Tag = GetPropertyValue(obj, ValueFiled);
  297. }
  298. else
  299. {
  300. item.Tag = obj.ToString();
  301. }
  302. }
  303. item.ToolTipText = item.Text;
  304. return item;
  305. }
  306.  
  307. /// <summary>
  308. /// 取得属性值
  309. /// </summary>
  310. /// <param name="obj"></param>
  311. /// <param name="propertyName"></param>
  312. private string GetPropertyValue(object obj, string propertyName)
  313. {
  314. object result = null;
  315.  
  316. result = ObjectUtil.GetPropertyValue(obj, propertyName);
  317. return result == null ? String.Empty : result.ToString();
  318. }
  319.  
  320. #region override
  321.  
  322. /// <summary>
  323. /// 功能描述:OnKeyUp
  324. /// 作  者:huangzh
  325. /// 创建日期:2016-01-04 11:58:33
  326. /// 任务编号:
  327. /// </summary>
  328. /// <param name="e">e</param>
  329. protected override void OnKeyUp(KeyEventArgs e)
  330. {
  331. base.OnKeyDown(e);
  332. bool Pressed = (e.Control && ((e.KeyData & Keys.A) == Keys.A));
  333. if (Pressed)
  334. {
  335. this.Text = "";
  336. for (int i = ; i < lst.Nodes.Count; i++)
  337. {
  338. lst.Nodes[i].Checked = true;
  339. }
  340. }
  341. }
  342.  
  343. /// <summary>
  344. /// 功能描述:OnDropDown
  345. /// 作  者:huangzh
  346. /// 创建日期:2016-01-04 11:58:53
  347. /// 任务编号:
  348. /// </summary>
  349. /// <param name="e">e</param>
  350. protected override void OnDropDown(EventArgs e)
  351. {
  352. this.DroppedDown = false;
  353. string strValue = this.Text;
  354. if (!string.IsNullOrEmpty(strValue))
  355. {
  356. List<string> lstvalues = strValue.Split(',').ToList<string>();
  357. foreach (TreeNode tn in lst.Nodes)
  358. {
  359. if (tn.Checked && !lstvalues.Contains(tn.Tag.ToString()) && !string.IsNullOrEmpty(tn.Tag.ToString().Trim()))
  360. {
  361. tn.Checked = false;
  362. }
  363. else if (!tn.Checked && lstvalues.Contains(tn.Tag.ToString()) && !string.IsNullOrEmpty(tn.Tag.ToString().Trim()))
  364. {
  365. tn.Checked = true;
  366. }
  367. }
  368. }
  369. else
  370. {
  371. foreach (TreeNode tn in lst.Nodes)
  372. {
  373. tn.Checked = false;
  374. }
  375. }
  376. frmhost.Show(this);
  377. }
  378. #endregion
  379. }
  380.  
  381. /// <summary>
  382. /// 对象帮助类
  383. /// </summary>
  384. public class ObjectUtil
  385. {
  386. /// <summary>
  387. /// 获取对象的属性值
  388. /// </summary>
  389. /// <param name="obj">可能是DataRowView或一个对象</param>
  390. /// <param name="propertyName">属性名</param>
  391. /// <returns>属性值</returns>
  392. public static object GetPropertyValue(object obj, string propertyName)
  393. {
  394. object result = null;
  395.  
  396. try
  397. {
  398. if (obj is DataRow)
  399. {
  400. result = (obj as DataRow)[propertyName];
  401. }
  402. else if (obj is DataRowView)
  403. {
  404. result = (obj as DataRowView)[propertyName];
  405. }
  406. else if (obj is JObject)
  407. {
  408. result = (obj as JObject).Value<JValue>(propertyName).Value; //.getValue(propertyName);
  409. }
  410. else
  411. {
  412. result = GetPropertyValueFormObject(obj, propertyName);
  413. }
  414. }
  415. catch (Exception)
  416. {
  417. // 找不到此属性
  418. }
  419.  
  420. return result;
  421. }
  422.  
  423. /// <summary>
  424. /// 获取对象的属性值
  425. /// </summary>
  426. /// <param name="obj">对象</param>
  427. /// <param name="propertyName">属性名("Color"、"BodyStyle"或者"Info.UserName")</param>
  428. /// <returns>属性值</returns>
  429. private static object GetPropertyValueFormObject(object obj, string propertyName)
  430. {
  431. object rowObj = obj;
  432. object result = null;
  433.  
  434. if (propertyName.IndexOf(".") > )
  435. {
  436. string[] properties = propertyName.Split('.');
  437. object tmpObj = rowObj;
  438.  
  439. for (int i = ; i < properties.Length; i++)
  440. {
  441. PropertyInfo property = tmpObj.GetType().GetProperty(properties[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
  442. if (property != null)
  443. {
  444. tmpObj = property.GetValue(tmpObj, null);
  445. }
  446. }
  447.  
  448. result = tmpObj;
  449. }
  450. else
  451. {
  452. PropertyInfo property = rowObj.GetType().GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
  453. if (property != null)
  454. {
  455. result = property.GetValue(rowObj, null);
  456. }
  457. }
  458.  
  459. return result;
  460. }
  461. }
  462. }

然后就是使用了,直接拖一个到界面上,然后设置值就可以了

ListHeight,ListWidth 这两个属性一定要修改下的哦

然后就是绑定数据源

  1. var varSourceFrom = from p in lstEnumEnitty
  2. where p.Type == "source"
  3. select p;
  4. cboSourceFromType.DataSource = varSourceFrom;
  5. cboSourceFromType.DisplayFiled = "Name";
  6. cboSourceFromType.ValueFiled = "Code";
  7. cboSourceFromType.DataBind();

效果就是这样的了

需要引用的一个DLL去我的上一个文章里面下载吧

c# 自定义多选下拉列表2的更多相关文章

  1. Flex4 双选下拉列表的实现(源代码)

    本文属原创文章,如需转载,请注明出处,谢谢 企业应用中少不了双选下拉列表控件,但几乎都没有独立的控件,Flex在这上面得天独厚,ArrayCollection的过滤功能使得我们只需要一个数据源就可以将 ...

  2. WPF自定义控件与样式(8)-ComboBox与自定义多选控件MultComboBox

    一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接. 本文主要内容: 下拉选 ...

  3. 一款不错的多选下拉列表利器—— Ext.ux.form.SuperBoxSelect

    在B/S系统中,下拉列表(select/dropdownlist/combobox)的应用随处可见,为了增强用户体验,开发人员也常常会做一些带联想功能的下拉列表, 特别是数据项比较多的时候,用户筛选起 ...

  4. 【转】WPF自定义控件与样式(8)-ComboBox与自定义多选控件MultComboBox

    一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等. 本文主要内容: 下拉选择控件ComboBox的自定义样式及扩展: 自定义多选控件Mul ...

  5. WPF 自定义ComboBox样式,自定义多选控件

    原文:WPF 自定义ComboBox样式,自定义多选控件 一.ComboBox基本样式 ComboBox有两种状态,可编辑和不可编辑状态.通过设置IsEditable属性可以切换控件状态. 先看基本样 ...

  6. 自定义SWT控件二之自定义多选下拉框

    2.自定义下拉多选框 package com.view.control.select; import java.util.ArrayList; import java.util.HashMap; im ...

  7. javascript操作多选下拉列表

    闲来无事,把javascript操作多选下拉列表有关的操作知识复习了一遍,代码附上 <%-- Created by IntelliJ IDEA. User: Administrator Date ...

  8. kendoUI 多选下拉列表 kendoMultiSelect

    问题1:被重复渲染 点击新增按钮----弹出模态框 多选下拉列表在多选框中只是初始化过一次.但是每次点击新增后  发现 多选下拉列表 被重复渲染了 解决方案 在 新增时  先将其父元素div中  的s ...

  9. 如何对tableview进行自定义多选

    前言: 很多入门不久的程序员或许都会遇到系统自带的tableview多选时cell选择时不能选择自己想要的点击时的颜色或者图片,这让初级开发者们很烦恼.今天,我试着花了几个小时的时间用了自己的想法,去 ...

随机推荐

  1. oracle 11g 自己主动调整

    --:自己主动调教计划 begin   dbms_workload_repository.create_snapshot(); end; select /*+ result_cache */ coun ...

  2. Android开发之控制Toast的开启与关闭

    开发这个程序之前先解释一下,为什么Toast信息提示框在显示一定时间后会自己主动消失?由于在Android系统中有一个Toast队列,系统会依次从这个队列中取出一个Toast,并显示它.在显示了指定时 ...

  3. c语言复杂声明解析

    这是个好东西,接触c语言好几年了,第一次看到这东西,惊喜万分. 先提供个分析案例,以后看方便 vector <int> * (*seq_array[]) (int )={func1,fun ...

  4. Hack 语言学习/参考---1.Hack 语言

    Table of Contents What is Hack? Hack Background Summary Hack is a language for HHVM that interopates ...

  5. windows socket 网络编程

    样例代码就在我的博客中,包含六个UDP和TCP发送接受的cpp文件,一个基于MFC的局域网聊天小工具project,和此小工具的全部执行时库.资源和执行程序.代码的压缩包位置是http://www.b ...

  6. 多线程学习之三生产者消费者模式Guarded Suspension

    Guarded Suspension[生产消费者模式] 一:guarded suspension的参与者--->guardedObject(被防卫)参与者                1.1该 ...

  7. DateTime.ToString("dd/MM/yyyy");后,不能直接Convert.ToDateTime的解决:

    原文:DateTime.ToString("dd/MM/yyyy");后,不能直接Convert.ToDateTime的解决: DateTime.ToString("dd ...

  8. ADS-B 雷达 显示终端5.8

    改动日志 1  更新背景地图. 增加了全国范围内的国际航路.区域航路信息,全部航路信息来自网络及中国民用航空局公布的公开资料:航路採用深蓝色画笔绘制航路中包括有航路代码.高度及报告点信息.代码及报告点 ...

  9. 关于s2sh框架关于hibernate懒加载问题的说明和解决方案

    首先我们来看下面这个图,解释了一个web程序的一次请求流程! 懒加载异常的说明: 懒加载就是我们在查询一个对象时,它所有的属性是否要被查出来! 如果懒加载开启的话,session在service层就被 ...

  10. 74LS183 加法器 【数字电路】

    74LS183 搭的一个还有点意思的加法电路,串行进位的 2+6 == 8 大家都懂的哈哈