├── .gitignore
├── .vs
└── slnx.sqlite
├── Backup
├── CheckBoxComboBox.Designer.cs
├── CheckBoxComboBox.cs
├── CheckBoxComboBox.csproj
├── CheckBoxComboBox.csproj.user
├── GripBounds.cs
├── NativeMethods.cs
├── Popup.Designer.cs
├── Popup.cs
├── PopupComboBox.Designer.cs
├── PopupComboBox.cs
├── PopupComboBox.resx
├── Properties
│ └── AssemblyInfo.cs
├── Selection Wrappers
│ ├── ListSelectionWrapper.cs
│ └── ObjectSelectionWrapper.cs
└── obj
│ ├── Debug
│ └── CheckBoxComboBox.csproj.AssemblyReference.cache
│ └── Release
│ └── CheckBoxComboBox.csproj.AssemblyReference.cache
├── Components
├── SlimDX.dll
├── SlimDX.pdb
└── SlimDX.xml
├── Map Editor.sln
├── Map Editor.v12.suo
└── Map Editor
├── CellInfoControl.Designer.cs
├── CellInfoControl.cs
├── CellInfoControl.resx
├── CellInfoData.cs
├── DXManager.cs
├── Editor.cs
├── FilesNameComparer.cs
├── FrmAbout.Designer.cs
├── FrmAbout.cs
├── FrmAbout.resx
├── FrmJump.Designer.cs
├── FrmJump.cs
├── FrmJump.resx
├── FrmSetAnimation.Designer.cs
├── FrmSetAnimation.cs
├── FrmSetAnimation.resx
├── FrmSetDoor.Designer.cs
├── FrmSetDoor.cs
├── FrmSetDoor.resx
├── FrmSetLight.Designer.cs
├── FrmSetLight.cs
├── FrmSetLight.resx
├── ListItem.cs
├── MLibrary.cs
├── Main.Designer.cs
├── Main.cs
├── Main.resx
├── Map Editor.csproj
├── Map Editor.csproj.user
├── MapCode.cs
├── NewFileFrm.Designer.cs
├── NewFileFrm.cs
├── NewFileFrm.resx
├── Program.cs
├── Properties
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── Resources
├── 100.jpg
├── 110.jpg
├── 1100.jpg
├── 1110.jpg
├── 1120.jpg
├── 1130.jpg
├── 1140.jpg
├── 1150.jpg
├── 120.jpg
├── 130.jpg
├── 140.jpg
├── 150.jpg
├── 160.jpg
├── 170.jpg
├── 180.jpg
├── 190.jpg
├── Camera.png
├── Minus.png
├── Navigator.png
├── Off.png
├── On.png
├── Plus.png
├── Radar.png
├── Square.png
└── System folder.png
├── SetrProperty.resx
├── Utility.cs
├── ico.ico
└── obj
└── Debug
├── DesignTimeResolveAssemblyReferences.cache
├── DesignTimeResolveAssemblyReferencesInput.cache
└── Map Editor.csproj.AssemblyReference.cache
/.gitignore:
--------------------------------------------------------------------------------
1 | /Map Editor/obj/Debug
2 | /.vs/Map Editor/v16
3 | /Map Editor/bin/Release
4 | /Map Editor/obj/Release
5 | /.vs/Map Editor
6 |
--------------------------------------------------------------------------------
/.vs/slnx.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Suprcode/Crystal.MapEditor/dcb5d3049e2980055fda3093fa89baa5168937b9/.vs/slnx.sqlite
--------------------------------------------------------------------------------
/Backup/CheckBoxComboBox.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace PresentationControls
2 | {
3 | partial class CheckBoxComboBox
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | components = new System.ComponentModel.Container();
32 | }
33 |
34 | #endregion
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Backup/CheckBoxComboBox.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | Debug
4 | AnyCPU
5 | 9.0.20404
6 | 2.0
7 | {70A25201-8EA4-48F8-A4A6-ED13ADF8823C}
8 | Library
9 | Properties
10 | CheckBoxComboBox
11 | CheckBoxComboBox
12 | v3.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 | 3.5
36 |
37 |
38 |
39 |
40 | 3.5
41 |
42 |
43 |
44 |
45 |
46 |
47 | Component
48 |
49 |
50 | CheckBoxComboBox.cs
51 |
52 |
53 |
54 |
55 |
56 |
57 | Component
58 |
59 |
60 | Popup.cs
61 |
62 |
63 | Component
64 |
65 |
66 | PopupComboBox.cs
67 |
68 |
69 |
70 |
71 |
72 | PopupComboBox.cs
73 | Designer
74 |
75 |
76 |
77 |
84 |
--------------------------------------------------------------------------------
/Backup/CheckBoxComboBox.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 | ShowAllFiles
4 |
5 |
--------------------------------------------------------------------------------
/Backup/GripBounds.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 |
4 | namespace PresentationControls
5 | {
6 | ///
7 | /// CodeProject.com "Simple pop-up control" "http://www.codeproject.com/cs/miscctrl/simplepopup.asp".
8 | ///
9 | internal struct GripBounds
10 | {
11 | private const int GripSize = 6;
12 | private const int CornerGripSize = GripSize << 1;
13 |
14 | public GripBounds(Rectangle clientRectangle)
15 | {
16 | this.clientRectangle = clientRectangle;
17 | }
18 |
19 | private Rectangle clientRectangle;
20 | public Rectangle ClientRectangle
21 | {
22 | get { return clientRectangle; }
23 | //set { clientRectangle = value; }
24 | }
25 |
26 | public Rectangle Bottom
27 | {
28 | get
29 | {
30 | Rectangle rect = ClientRectangle;
31 | rect.Y = rect.Bottom - GripSize + 1;
32 | rect.Height = GripSize;
33 | return rect;
34 | }
35 | }
36 |
37 | public Rectangle BottomRight
38 | {
39 | get
40 | {
41 | Rectangle rect = ClientRectangle;
42 | rect.Y = rect.Bottom - CornerGripSize + 1;
43 | rect.Height = CornerGripSize;
44 | rect.X = rect.Width - CornerGripSize + 1;
45 | rect.Width = CornerGripSize;
46 | return rect;
47 | }
48 | }
49 |
50 | public Rectangle Top
51 | {
52 | get
53 | {
54 | Rectangle rect = ClientRectangle;
55 | rect.Height = GripSize;
56 | return rect;
57 | }
58 | }
59 |
60 | public Rectangle TopRight
61 | {
62 | get
63 | {
64 | Rectangle rect = ClientRectangle;
65 | rect.Height = CornerGripSize;
66 | rect.X = rect.Width - CornerGripSize + 1;
67 | rect.Width = CornerGripSize;
68 | return rect;
69 | }
70 | }
71 |
72 | public Rectangle Left
73 | {
74 | get
75 | {
76 | Rectangle rect = ClientRectangle;
77 | rect.Width = GripSize;
78 | return rect;
79 | }
80 | }
81 |
82 | public Rectangle BottomLeft
83 | {
84 | get
85 | {
86 | Rectangle rect = ClientRectangle;
87 | rect.Width = CornerGripSize;
88 | rect.Y = rect.Height - CornerGripSize + 1;
89 | rect.Height = CornerGripSize;
90 | return rect;
91 | }
92 | }
93 |
94 | public Rectangle Right
95 | {
96 | get
97 | {
98 | Rectangle rect = ClientRectangle;
99 | rect.X = rect.Right - GripSize + 1;
100 | rect.Width = GripSize;
101 | return rect;
102 | }
103 | }
104 |
105 | public Rectangle TopLeft
106 | {
107 | get
108 | {
109 | Rectangle rect = ClientRectangle;
110 | rect.Width = CornerGripSize;
111 | rect.Height = CornerGripSize;
112 | return rect;
113 | }
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/Backup/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace PresentationControls
6 | {
7 | ///
8 | /// CodeProject.com "Simple pop-up control" "http://www.codeproject.com/cs/miscctrl/simplepopup.asp".
9 | ///
10 | internal static class NativeMethods
11 | {
12 | internal const int WM_NCHITTEST = 0x0084,
13 | WM_NCACTIVATE = 0x0086,
14 | WS_EX_NOACTIVATE = 0x08000000,
15 | HTTRANSPARENT = -1,
16 | HTLEFT = 10,
17 | HTRIGHT = 11,
18 | HTTOP = 12,
19 | HTTOPLEFT = 13,
20 | HTTOPRIGHT = 14,
21 | HTBOTTOM = 15,
22 | HTBOTTOMLEFT = 16,
23 | HTBOTTOMRIGHT = 17,
24 | WM_USER = 0x0400,
25 | WM_REFLECT = WM_USER + 0x1C00,
26 | WM_COMMAND = 0x0111,
27 | CBN_DROPDOWN = 7,
28 | WM_GETMINMAXINFO = 0x0024;
29 |
30 | internal static int HIWORD(int n)
31 | {
32 | return (n >> 16) & 0xffff;
33 | }
34 |
35 | internal static int HIWORD(IntPtr n)
36 | {
37 | return HIWORD(unchecked((int)(long)n));
38 | }
39 |
40 | internal static int LOWORD(int n)
41 | {
42 | return n & 0xffff;
43 | }
44 |
45 | internal static int LOWORD(IntPtr n)
46 | {
47 | return LOWORD(unchecked((int)(long)n));
48 | }
49 |
50 | [StructLayout(LayoutKind.Sequential)]
51 | internal struct MINMAXINFO
52 | {
53 | public Point reserved;
54 | public Size maxSize;
55 | public Point maxPosition;
56 | public Size minTrackSize;
57 | public Size maxTrackSize;
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/Backup/Popup.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace PresentationControls
2 | {
3 | partial class Popup
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing)
17 | {
18 | if (components != null)
19 | {
20 | components.Dispose();
21 | }
22 | if (content != null)
23 | {
24 | System.Windows.Forms.Control _content = content;
25 | content = null;
26 | _content.Dispose();
27 | }
28 | }
29 | base.Dispose(disposing);
30 | }
31 |
32 | #region Component Designer generated code
33 |
34 | ///
35 | /// Required method for Designer support - do not modify
36 | /// the contents of this method with the code editor.
37 | ///
38 | private void InitializeComponent()
39 | {
40 | components = new System.ComponentModel.Container();
41 | }
42 |
43 | #endregion
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Backup/Popup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 | using System.Security.Permissions;
9 | using System.Runtime.InteropServices;
10 | using VS = System.Windows.Forms.VisualStyles;
11 |
12 | /*
13 |
Base class for custom tooltips.
14 | Office-2007-like tooltip class.
15 | */
16 | namespace PresentationControls
17 | {
18 | ///
19 | /// CodeProject.com "Simple pop-up control" "http://www.codeproject.com/cs/miscctrl/simplepopup.asp".
20 | /// Represents a pop-up window.
21 | ///
22 | [CLSCompliant(true), ToolboxItem(false)]
23 | public partial class Popup : ToolStripDropDown
24 | {
25 | #region " Fields & Properties "
26 |
27 | private Control content;
28 | ///
29 | /// Gets the content of the pop-up.
30 | ///
31 | public Control Content
32 | {
33 | get { return content; }
34 | }
35 |
36 | private bool fade;
37 | ///
38 | /// Gets a value indicating whether the uses the fade effect.
39 | ///
40 | /// true if pop-up uses the fade effect; otherwise, false.
41 | /// To use the fade effect, the FocusOnOpen property also has to be set to true.
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 | ///
54 | /// Gets or sets a value indicating whether to focus the content after the pop-up has been opened.
55 | ///
56 | /// true if the content should be focused after the pop-up has been opened; otherwise, false.
57 | /// If the FocusOnOpen property is set to false, then pop-up cannot use the fade effect.
58 | public bool FocusOnOpen
59 | {
60 | get { return focusOnOpen; }
61 | set { focusOnOpen = value; }
62 | }
63 |
64 | private bool acceptAlt = true;
65 | ///
66 | /// Gets or sets a value indicating whether presing the alt key should close the pop-up.
67 | ///
68 | /// true if presing the alt key does not close the pop-up; otherwise, false.
69 | public bool AcceptAlt
70 | {
71 | get { return acceptAlt; }
72 | set { acceptAlt = value; }
73 | }
74 |
75 | private Popup ownerPopup;
76 | private Popup childPopup;
77 |
78 | private bool _resizable;
79 | private bool resizable;
80 | ///
81 | /// Gets or sets a value indicating whether this is resizable.
82 | ///
83 | /// true if resizable; otherwise, false.
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 | ///
94 | /// Gets or sets the size that is the lower limit that can specify.
95 | ///
96 | /// An ordered pair of type representing the width and height of a rectangle.
97 | public new Size MinimumSize
98 | {
99 | get { return minSize; }
100 | set { minSize = value; }
101 | }
102 |
103 | private Size maxSize;
104 | ///
105 | /// Gets or sets the size that is the upper limit that can specify.
106 | ///
107 | /// An ordered pair of type representing the width and height of a rectangle.
108 | public new Size MaximumSize
109 | {
110 | get { return maxSize; }
111 | set { maxSize = value; }
112 | }
113 |
114 | ///
115 | /// Gets parameters of a new window.
116 | ///
117 | /// An object of type used when creating a new window.
118 | protected override CreateParams CreateParams
119 | {
120 | [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
121 | get
122 | {
123 | CreateParams cp = base.CreateParams;
124 | cp.ExStyle |= NativeMethods.WS_EX_NOACTIVATE;
125 | return cp;
126 | }
127 | }
128 |
129 | #endregion
130 |
131 | #region " Constructors "
132 |
133 | ///
134 | /// Initializes a new instance of the class.
135 | ///
136 | /// The content of the pop-up.
137 | ///
138 | /// Pop-up will be disposed immediately after disposion of the content control.
139 | ///
140 | /// is null
.
141 | public Popup(Control content)
142 | {
143 | if (content == null)
144 | {
145 | throw new ArgumentNullException("content");
146 | }
147 | this.content = content;
148 | this.fade = SystemInformation.IsMenuAnimationEnabled && SystemInformation.IsMenuFadeEnabled;
149 | this._resizable = true;
150 | InitializeComponent();
151 | AutoSize = false;
152 | DoubleBuffered = true;
153 | ResizeRedraw = true;
154 | host = new ToolStripControlHost(content);
155 | Padding = Margin = host.Padding = host.Margin = Padding.Empty;
156 | MinimumSize = content.MinimumSize;
157 | content.MinimumSize = content.Size;
158 | MaximumSize = content.MaximumSize;
159 | content.MaximumSize = content.Size;
160 | Size = content.Size;
161 | content.Location = Point.Empty;
162 | Items.Add(host);
163 | content.Disposed += delegate(object sender, EventArgs e)
164 | {
165 | content = null;
166 | Dispose(true);
167 | };
168 | content.RegionChanged += delegate(object sender, EventArgs e)
169 | {
170 | UpdateRegion();
171 | };
172 | content.Paint += delegate(object sender, PaintEventArgs e)
173 | {
174 | PaintSizeGrip(e);
175 | };
176 | UpdateRegion();
177 | }
178 |
179 | #endregion
180 |
181 | #region " Methods "
182 |
183 | ///
184 | /// Processes a dialog box key.
185 | ///
186 | /// One of the values that represents the key to process.
187 | ///
188 | /// true if the key was processed by the control; otherwise, false.
189 | ///
190 | protected override bool ProcessDialogKey(Keys keyData)
191 | {
192 | if (acceptAlt && ((keyData & Keys.Alt) == Keys.Alt)) return false;
193 | return base.ProcessDialogKey(keyData);
194 | }
195 |
196 | ///
197 | /// Updates the pop-up region.
198 | ///
199 | protected void UpdateRegion()
200 | {
201 | if (this.Region != null)
202 | {
203 | this.Region.Dispose();
204 | this.Region = null;
205 | }
206 | if (content.Region != null)
207 | {
208 | this.Region = content.Region.Clone();
209 | }
210 | }
211 |
212 | ///
213 | /// Shows pop-up window below the specified control.
214 | ///
215 | /// The control below which the pop-up will be shown.
216 | ///
217 | /// When there is no space below the specified control, the pop-up control is shown above it.
218 | ///
219 | /// is null
.
220 | public void Show(Control control)
221 | {
222 | if (control == null)
223 | {
224 | throw new ArgumentNullException("control");
225 | }
226 | SetOwnerItem(control);
227 | Show(control, control.ClientRectangle);
228 | }
229 |
230 | ///
231 | /// Shows pop-up window below the specified area of specified control.
232 | ///
233 | /// The control used to compute screen location of specified area.
234 | /// The area of control below which the pop-up will be shown.
235 | ///
236 | /// When there is no space below specified area, the pop-up control is shown above it.
237 | ///
238 | /// is null
.
239 | public void Show(Control control, Rectangle area)
240 | {
241 | if (control == null)
242 | {
243 | throw new ArgumentNullException("control");
244 | }
245 | SetOwnerItem(control);
246 | resizableTop = resizableRight = false;
247 | Point location = control.PointToScreen(new Point(area.Left, area.Top + area.Height));
248 | Rectangle screen = Screen.FromControl(control).WorkingArea;
249 | if (location.X + Size.Width > (screen.Left + screen.Width))
250 | {
251 | resizableRight = true;
252 | location.X = (screen.Left + screen.Width) - Size.Width;
253 | }
254 | if (location.Y + Size.Height > (screen.Top + screen.Height))
255 | {
256 | resizableTop = true;
257 | location.Y -= Size.Height + area.Height;
258 | }
259 | location = control.PointToClient(location);
260 | Show(control, location, ToolStripDropDownDirection.BelowRight);
261 | }
262 |
263 | private const int frames = 1;
264 | private const int totalduration = 0; // ML : 2007-11-05 : was 100 but caused a flicker.
265 | private const int frameduration = totalduration / frames;
266 | ///
267 | /// Adjusts the size of the owner to accommodate the if the owner is currently displayed, or clears and resets active child controls of the if the is not currently displayed.
268 | ///
269 | /// true if the owner is currently displayed; otherwise, false.
270 | protected override void SetVisibleCore(bool visible)
271 | {
272 | double opacity = Opacity;
273 | if (visible && fade && focusOnOpen) Opacity = 0;
274 | base.SetVisibleCore(visible);
275 | if (!visible || !fade || !focusOnOpen) return;
276 | for (int i = 1; i <= frames; i++)
277 | {
278 | if (i > 1)
279 | {
280 | System.Threading.Thread.Sleep(frameduration);
281 | }
282 | Opacity = opacity * (double)i / (double)frames;
283 | }
284 | Opacity = opacity;
285 | }
286 |
287 | private bool resizableTop;
288 | private bool resizableRight;
289 |
290 | private void SetOwnerItem(Control control)
291 | {
292 | if (control == null)
293 | {
294 | return;
295 | }
296 | if (control is Popup)
297 | {
298 | Popup popupControl = control as Popup;
299 | ownerPopup = popupControl;
300 | ownerPopup.childPopup = this;
301 | OwnerItem = popupControl.Items[0];
302 | return;
303 | }
304 | if (control.Parent != null)
305 | {
306 | SetOwnerItem(control.Parent);
307 | }
308 | }
309 |
310 | ///
311 | /// Raises the event.
312 | ///
313 | /// An that contains the event data.
314 | protected override void OnSizeChanged(EventArgs e)
315 | {
316 | content.MinimumSize = Size;
317 | content.MaximumSize = Size;
318 | content.Size = Size;
319 | content.Location = Point.Empty;
320 | base.OnSizeChanged(e);
321 | }
322 |
323 | ///
324 | /// Raises the event.
325 | ///
326 | /// A that contains the event data.
327 | protected override void OnOpening(CancelEventArgs e)
328 | {
329 | if (content.IsDisposed || content.Disposing)
330 | {
331 | e.Cancel = true;
332 | return;
333 | }
334 | UpdateRegion();
335 | base.OnOpening(e);
336 | }
337 |
338 | ///
339 | /// Raises the event.
340 | ///
341 | /// An that contains the event data.
342 | protected override void OnOpened(EventArgs e)
343 | {
344 | if (ownerPopup != null)
345 | {
346 | ownerPopup._resizable = false;
347 | }
348 | if (focusOnOpen)
349 | {
350 | content.Focus();
351 | }
352 | base.OnOpened(e);
353 | }
354 |
355 | protected override void OnClosed(ToolStripDropDownClosedEventArgs e)
356 | {
357 | if (ownerPopup != null)
358 | {
359 | ownerPopup._resizable = true;
360 | }
361 | base.OnClosed(e);
362 | }
363 |
364 | public DateTime LastClosedTimeStamp = DateTime.Now;
365 |
366 | protected override void OnVisibleChanged(EventArgs e)
367 | {
368 | if (Visible == false)
369 | LastClosedTimeStamp = DateTime.Now;
370 | base.OnVisibleChanged(e);
371 | }
372 |
373 | #endregion
374 |
375 | #region " Resizing Support "
376 |
377 | ///
378 | /// Processes Windows messages.
379 | ///
380 | /// The Windows to process.
381 | [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
382 | protected override void WndProc(ref Message m)
383 | {
384 | if (InternalProcessResizing(ref m, false))
385 | {
386 | return;
387 | }
388 | base.WndProc(ref m);
389 | }
390 |
391 | ///
392 | /// Processes the resizing messages.
393 | ///
394 | /// The message.
395 | /// true, if the WndProc method from the base class shouldn't be invoked.
396 | [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
397 | public bool ProcessResizing(ref Message m)
398 | {
399 | return InternalProcessResizing(ref m, true);
400 | }
401 |
402 | [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
403 | private bool InternalProcessResizing(ref Message m, bool contentControl)
404 | {
405 | if (m.Msg == NativeMethods.WM_NCACTIVATE && m.WParam != IntPtr.Zero && childPopup != null && childPopup.Visible)
406 | {
407 | childPopup.Hide();
408 | }
409 | if (!Resizable)
410 | {
411 | return false;
412 | }
413 | if (m.Msg == NativeMethods.WM_NCHITTEST)
414 | {
415 | return OnNcHitTest(ref m, contentControl);
416 | }
417 | else if (m.Msg == NativeMethods.WM_GETMINMAXINFO)
418 | {
419 | return OnGetMinMaxInfo(ref m);
420 | }
421 | return false;
422 | }
423 |
424 | [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
425 | private bool OnGetMinMaxInfo(ref Message m)
426 | {
427 | NativeMethods.MINMAXINFO minmax = (NativeMethods.MINMAXINFO)Marshal.PtrToStructure(m.LParam, typeof(NativeMethods.MINMAXINFO));
428 | minmax.maxTrackSize = this.MaximumSize;
429 | minmax.minTrackSize = this.MinimumSize;
430 | Marshal.StructureToPtr(minmax, m.LParam, false);
431 | return true;
432 | }
433 |
434 | private bool OnNcHitTest(ref Message m, bool contentControl)
435 | {
436 | int x = NativeMethods.LOWORD(m.LParam);
437 | int y = NativeMethods.HIWORD(m.LParam);
438 | Point clientLocation = PointToClient(new Point(x, y));
439 |
440 | GripBounds gripBouns = new GripBounds(contentControl ? content.ClientRectangle : ClientRectangle);
441 | IntPtr transparent = new IntPtr(NativeMethods.HTTRANSPARENT);
442 |
443 | if (resizableTop)
444 | {
445 | if (resizableRight && gripBouns.TopLeft.Contains(clientLocation))
446 | {
447 | m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTTOPLEFT;
448 | return true;
449 | }
450 | if (!resizableRight && gripBouns.TopRight.Contains(clientLocation))
451 | {
452 | m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTTOPRIGHT;
453 | return true;
454 | }
455 | if (gripBouns.Top.Contains(clientLocation))
456 | {
457 | m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTTOP;
458 | return true;
459 | }
460 | }
461 | else
462 | {
463 | if (resizableRight && gripBouns.BottomLeft.Contains(clientLocation))
464 | {
465 | m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTBOTTOMLEFT;
466 | return true;
467 | }
468 | if (!resizableRight && gripBouns.BottomRight.Contains(clientLocation))
469 | {
470 | m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTBOTTOMRIGHT;
471 | return true;
472 | }
473 | if (gripBouns.Bottom.Contains(clientLocation))
474 | {
475 | m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTBOTTOM;
476 | return true;
477 | }
478 | }
479 | if (resizableRight && gripBouns.Left.Contains(clientLocation))
480 | {
481 | m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTLEFT;
482 | return true;
483 | }
484 | if (!resizableRight && gripBouns.Right.Contains(clientLocation))
485 | {
486 | m.Result = contentControl ? transparent : (IntPtr)NativeMethods.HTRIGHT;
487 | return true;
488 | }
489 | return false;
490 | }
491 |
492 | private VS.VisualStyleRenderer sizeGripRenderer;
493 | ///
494 | /// Paints the size grip.
495 | ///
496 | /// The instance containing the event data.
497 | public void PaintSizeGrip(PaintEventArgs e)
498 | {
499 | if (e == null || e.Graphics == null || !resizable)
500 | {
501 | return;
502 | }
503 | Size clientSize = content.ClientSize;
504 | if (Application.RenderWithVisualStyles)
505 | {
506 | if (this.sizeGripRenderer == null)
507 | {
508 | this.sizeGripRenderer = new VS.VisualStyleRenderer(VS.VisualStyleElement.Status.Gripper.Normal);
509 | }
510 | this.sizeGripRenderer.DrawBackground(e.Graphics, new Rectangle(clientSize.Width - 0x10, clientSize.Height - 0x10, 0x10, 0x10));
511 | }
512 | else
513 | {
514 | ControlPaint.DrawSizeGrip(e.Graphics, content.BackColor, clientSize.Width - 0x10, clientSize.Height - 0x10, 0x10, 0x10);
515 | }
516 | }
517 |
518 | #endregion
519 | }
520 | }
521 |
--------------------------------------------------------------------------------
/Backup/PopupComboBox.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace PresentationControls
2 | {
3 | partial class PopupComboBox
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing)
17 | {
18 | if (components != null)
19 | {
20 | components.Dispose();
21 | }
22 | if (dropDown != null)
23 | {
24 | dropDown.Dispose();
25 | }
26 | }
27 | base.Dispose(disposing);
28 | }
29 |
30 | #region Component Designer generated code
31 |
32 | ///
33 | /// Required method for Designer support - do not modify
34 | /// the contents of this method with the code editor.
35 | ///
36 | private void InitializeComponent()
37 | {
38 | this.SuspendLayout();
39 | //
40 | // PopupComboBox
41 | //
42 | this.ResumeLayout(false);
43 |
44 | }
45 |
46 | #endregion
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Backup/PopupComboBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 | using System.Security.Permissions;
9 |
10 | namespace PresentationControls
11 | {
12 | ///
13 | /// CodeProject.com "Simple pop-up control" "http://www.codeproject.com/cs/miscctrl/simplepopup.asp".
14 | /// Represents a Windows combo box control with a custom popup control attached.
15 | ///
16 | [ToolboxBitmap(typeof(System.Windows.Forms.ComboBox)), ToolboxItem(true), ToolboxItemFilter("System.Windows.Forms"), Description("Displays an editable text box with a drop-down list of permitted values.")]
17 | public partial class PopupComboBox : ComboBox
18 | {
19 | ///
20 | /// Initializes a new instance of the class.
21 | ///
22 | public PopupComboBox()
23 | {
24 | InitializeComponent();
25 | base.DropDownHeight = base.DropDownWidth = 1;
26 | base.IntegralHeight = false;
27 | }
28 |
29 | ///
30 | /// The pop-up wrapper for the dropDownControl.
31 | /// Made PROTECTED instead of PRIVATE so descendent classes can set its Resizable property.
32 | /// Note however the pop-up properties must be set after the dropDownControl is assigned, since this
33 | /// popup wrapper is recreated when the dropDownControl is assigned.
34 | ///
35 | protected Popup dropDown;
36 |
37 | private Control dropDownControl;
38 | ///
39 | /// Gets or sets the drop down control.
40 | ///
41 | /// The drop down control.
42 | public Control DropDownControl
43 | {
44 | get
45 | {
46 | return dropDownControl;
47 | }
48 | set
49 | {
50 | if (dropDownControl == value)
51 | return;
52 | dropDownControl = value;
53 | dropDown = new Popup(value);
54 | }
55 | }
56 |
57 | ///
58 | /// Shows the drop down.
59 | ///
60 | public void ShowDropDown()
61 | {
62 | if (dropDown != null)
63 | {
64 | dropDown.Show(this);
65 | }
66 | }
67 |
68 | ///
69 | /// Hides the drop down.
70 | ///
71 | public void HideDropDown()
72 | {
73 | if (dropDown != null)
74 | {
75 | dropDown.Hide();
76 | }
77 | }
78 |
79 | ///
80 | /// Processes Windows messages.
81 | ///
82 | /// The Windows to process.
83 | [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
84 | protected override void WndProc(ref Message m)
85 | {
86 | if (m.Msg == (NativeMethods.WM_REFLECT + NativeMethods.WM_COMMAND))
87 | {
88 | if (NativeMethods.HIWORD(m.WParam) == NativeMethods.CBN_DROPDOWN)
89 | {
90 | // Blocks a redisplay when the user closes the control by clicking
91 | // on the combobox.
92 | TimeSpan TimeSpan = DateTime.Now.Subtract(dropDown.LastClosedTimeStamp);
93 | if (TimeSpan.TotalMilliseconds > 500)
94 | ShowDropDown();
95 | return;
96 | }
97 | }
98 | base.WndProc(ref m);
99 | }
100 |
101 | #region " Unused Properties "
102 |
103 | /// This property is not relevant for this class.
104 | /// This property is not relevant for this class.
105 | [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
106 | public new int DropDownWidth
107 | {
108 | get { return base.DropDownWidth; }
109 | set { base.DropDownWidth = value; }
110 | }
111 |
112 | /// This property is not relevant for this class.
113 | /// This property is not relevant for this class.
114 | [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
115 | public new int DropDownHeight
116 | {
117 | get { return base.DropDownHeight; }
118 | set
119 | {
120 | dropDown.Height = value;
121 | base.DropDownHeight = value;
122 | }
123 | }
124 |
125 | /// This property is not relevant for this class.
126 | /// This property is not relevant for this class.
127 | [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
128 | public new bool IntegralHeight
129 | {
130 | get { return base.IntegralHeight; }
131 | set { base.IntegralHeight = value; }
132 | }
133 |
134 | /// This property is not relevant for this class.
135 | /// This property is not relevant for this class.
136 | [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
137 | public new ObjectCollection Items
138 | {
139 | get { return base.Items; }
140 | }
141 |
142 | /// This property is not relevant for this class.
143 | /// This property is not relevant for this class.
144 | [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
145 | public new int ItemHeight
146 | {
147 | get { return base.ItemHeight; }
148 | set { base.ItemHeight = value; }
149 | }
150 |
151 | #endregion
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/Backup/PopupComboBox.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | False
122 |
123 |
--------------------------------------------------------------------------------
/Backup/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("CheckBoxComboBox")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("IT")]
12 | [assembly: AssemblyProduct("CheckBoxComboBox")]
13 | [assembly: AssemblyCopyright("Copyright © IT 2007")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0b11e2be-4211-4d2a-9102-6847a56d6fd8")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Backup/Selection Wrappers/ListSelectionWrapper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Reflection;
7 | using System.ComponentModel;
8 |
9 | namespace PresentationControls
10 | {
11 | ///
12 | /// Maintains an additional "Selected" & "Count" value for each item in a List.
13 | /// Useful in the CheckBoxComboBox. It holds a reference to the List[Index] Item and
14 | /// whether it is selected or not.
15 | /// It also caters for a Count, if needed.
16 | ///
17 | ///
18 | public class ListSelectionWrapper : List>
19 | {
20 | #region CONSTRUCTOR
21 |
22 | ///
23 | /// No property on the object is specified for display purposes, so simple ToString() operation
24 | /// will be performed. And no Counts will be displayed
25 | ///
26 | public ListSelectionWrapper(IEnumerable source) : this(source, false) { }
27 | ///
28 | /// No property on the object is specified for display purposes, so simple ToString() operation
29 | /// will be performed.
30 | ///
31 | public ListSelectionWrapper(IEnumerable source, bool showCounts)
32 | : base()
33 | {
34 | _Source = source;
35 | _ShowCounts = showCounts;
36 | if (_Source is IBindingList)
37 | ((IBindingList)_Source).ListChanged += new ListChangedEventHandler(ListSelectionWrapper_ListChanged);
38 | Populate();
39 | }
40 | ///
41 | /// A Display "Name" property is specified. ToString() will not be performed on items.
42 | /// This is specifically useful on DataTable implementations, or where PropertyDescriptors are used to read the values.
43 | /// If a PropertyDescriptor is not found, a Property will be used.
44 | ///
45 | public ListSelectionWrapper(IEnumerable source, string usePropertyAsDisplayName) : this(source, false, usePropertyAsDisplayName) { }
46 | ///
47 | /// A Display "Name" property is specified. ToString() will not be performed on items.
48 | /// This is specifically useful on DataTable implementations, or where PropertyDescriptors are used to read the values.
49 | /// If a PropertyDescriptor is not found, a Property will be used.
50 | ///
51 | public ListSelectionWrapper(IEnumerable source, bool showCounts, string usePropertyAsDisplayName)
52 | : this(source, showCounts)
53 | {
54 | _DisplayNameProperty = usePropertyAsDisplayName;
55 | }
56 |
57 | #endregion
58 |
59 | #region PRIVATE PROPERTIES
60 |
61 | ///
62 | /// Is a Count indicator used.
63 | ///
64 | private bool _ShowCounts;
65 | ///
66 | /// The original List of values wrapped. A "Selected" and possibly "Count" functionality is added.
67 | ///
68 | private IEnumerable _Source;
69 | ///
70 | /// Used to indicate NOT to use ToString(), but read this property instead as a display value.
71 | ///
72 | private string _DisplayNameProperty = null;
73 |
74 | #endregion
75 |
76 | #region PUBLIC PROPERTIES
77 |
78 | ///
79 | /// When specified, indicates that ToString() should not be performed on the items.
80 | /// This property will be read instead.
81 | /// This is specifically useful on DataTable implementations, where PropertyDescriptors are used to read the values.
82 | ///
83 | public string DisplayNameProperty
84 | {
85 | get { return _DisplayNameProperty; }
86 | set { _DisplayNameProperty = value; }
87 | }
88 | ///
89 | /// Builds a concatenation list of selected items in the list.
90 | ///
91 | public string SelectedNames
92 | {
93 | get
94 | {
95 | string Text = "";
96 | foreach (ObjectSelectionWrapper Item in this)
97 | if (Item.Selected)
98 | Text += (
99 | string.IsNullOrEmpty(Text)
100 | ? String.Format("\"{0}\"", Item.Name)
101 | : String.Format(" & \"{0}\"", Item.Name));
102 | return Text;
103 | }
104 | }
105 | ///
106 | /// Indicates whether the Item display value (Name) should include a count.
107 | ///
108 | public bool ShowCounts
109 | {
110 | get { return _ShowCounts; }
111 | set { _ShowCounts = value; }
112 | }
113 |
114 | #endregion
115 |
116 | #region HELPER MEMBERS
117 |
118 | ///
119 | /// Reset all counts to zero.
120 | ///
121 | public void ClearCounts()
122 | {
123 | foreach (ObjectSelectionWrapper Item in this)
124 | Item.Count = 0;
125 | }
126 | ///
127 | /// Creates a ObjectSelectionWrapper item.
128 | /// Note that the constructor signature of sub classes classes are important.
129 | ///
130 | ///
131 | ///
132 | private ObjectSelectionWrapper CreateSelectionWrapper(IEnumerator Object)
133 | {
134 | Type[] Types = new Type[] { typeof(T), this.GetType() };
135 | ConstructorInfo CI = typeof(ObjectSelectionWrapper).GetConstructor(Types);
136 | if (CI == null)
137 | throw new Exception(String.Format(
138 | "The selection wrapper class {0} must have a constructor with ({1} Item, {2} Container) parameters.",
139 | typeof(ObjectSelectionWrapper),
140 | typeof(T),
141 | this.GetType()));
142 | object[] parameters = new object[] { Object.Current, this };
143 | object result = CI.Invoke(parameters);
144 | return (ObjectSelectionWrapper)result;
145 | }
146 |
147 | public ObjectSelectionWrapper FindObjectWithItem(T Object)
148 | {
149 | return Find(new Predicate>(
150 | delegate(ObjectSelectionWrapper target)
151 | {
152 | return target.Item.Equals(Object);
153 | }));
154 | }
155 |
156 | /*
157 | public TSelectionWrapper FindObjectWithKey(object key)
158 | {
159 | return FindObjectWithKey(new object[] { key });
160 | }
161 |
162 | public TSelectionWrapper FindObjectWithKey(object[] keys)
163 | {
164 | return Find(new Predicate(
165 | delegate(TSelectionWrapper target)
166 | {
167 | return
168 | ReflectionHelper.CompareKeyValues(
169 | ReflectionHelper.GetKeyValuesFromObject(target.Item, target.Item.TableInfo),
170 | keys);
171 | }));
172 | }
173 |
174 | public object[] GetArrayOfSelectedKeys()
175 | {
176 | List