public object Draw(PropertyEditor propertyEditor)
            {
                if (!propertyEditor.info.CanRead)
                {
                    return(null);
                }

                var value = propertyEditor.info.GetValue(target, null);

                if (value == null)
                {
                    Editor.Label(propertyEditor.info.Name, "(" + propertyEditor.info.PropertyType.Name + ") null");
                    return(null);
                }

                // Base editors.
                if (value is bool)
                {
                    return(PropertyEditorBool(propertyEditor, (bool)value));
                }
                if (value is byte)
                {
                    return(PropertyEditorUInt8(propertyEditor, (byte)value));
                }
                if (value is decimal)
                {
                    return(PropertyEditorDecimal(propertyEditor, (decimal)value));
                }
                if (value is double)
                {
                    return(PropertyEditorDouble(propertyEditor, (double)value));
                }
                if (value is float)
                {
                    return(PropertyEditorSingle(propertyEditor, (float)value));
                }
                if (value is int)
                {
                    return(PropertyEditorInt32(propertyEditor, (int)value));
                }
                if (value is long)
                {
                    return(PropertyEditorInt64(propertyEditor, (long)value));
                }
                if (value is sbyte)
                {
                    return(PropertyEditorInt8(propertyEditor, (sbyte)value));
                }
                if (value is short)
                {
                    return(PropertyEditorInt16(propertyEditor, (short)value));
                }
                if (value is uint)
                {
                    return(PropertyEditorUInt32(propertyEditor, (uint)value));
                }
                if (value is ulong)
                {
                    return(PropertyEditorUInt64(propertyEditor, (ulong)value));
                }
                if (value is ushort)
                {
                    return(PropertyEditorUInt16(propertyEditor, (ushort)value));
                }

                if (value is string)
                {
                    return(PropertyEditorString(propertyEditor, (string)value));
                }
                if (value is Color)
                {
                    return(PropertyEditorColor(propertyEditor, (Color)value));
                }
                if (value is Control)
                {
                    return(PropertyEditorControl(propertyEditor, (Control)value));
                }
                if (value is Enum)
                {
                    return(PropertyEditorEnum(propertyEditor, (Enum)value));
                }

                // Complex types.
                if (propertyEditor.editor == null)
                {
                    propertyEditor.editor = new ObjectEditor(value, propertyEditor.info.Name);
                    propertyEditor.editor.backgroundRGB = MathHelper.Clamp(backgroundRGB - 25, 128, 255);
                }

                return(propertyEditor.editor.Draw());
            }
            public object Draw()
            {
                if (properties.Count == 0 && methods.Count == 0)
                {
                    Editor.Label(name);
                    return(null);
                }

                toggleEditor = Editor.Foldout(name, toggleEditor);

                Editor.BeginVertical(toggleEditor ? "Box" : null);

                if (toggleEditor)
                {
                    // Fields.
                    if (fields.Count > 0)
                    {
                        Editor.SetBackColor(Color.AliceBlue);
                        Editor.BeginVertical("Box");
                        Editor.Label("    Fields");

                        for (int i = 0; i < fields.Count; i++)
                        {
                            var tc = Draw(fields[i]);
                            if (tc != null)
                            {
                                return(tc);
                            }
                        }

                        Editor.EndVertical();
                        Editor.NewLine(1);
                    }

                    // Properties.
                    Editor.SetBackColor(Color.White);
                    if (toggleEditor)
                    {
                        Editor.SetBackColor(Color.FromArgb(backgroundRGB, backgroundRGB, backgroundRGB));
                    }

                    for (int i = 0; i < properties.Count; i++)
                    {
                        var tc = Draw(properties[i]);
                        if (tc != null)
                        {
                            return(tc);
                        }
                    }

                    // Methods.
                    if (methods.Count > 0)
                    {
                        if (properties.Count > 0)
                        {
                            Editor.NewLine(1);
                        }
                        Editor.SetBackColor(Color.Lavender);
                        Editor.BeginVertical("Box");
                        Editor.Label("    Methods");

                        for (int i = 0; i < methods.Count; i++)
                        {
                            var tc = Draw(methods[i]);
                            if (tc != null)
                            {
                                return(tc);
                            }
                        }

                        Editor.EndVertical();
                    }

                    // Array & List.
                    if (!(target is string) && (target.GetType().IsArray || target is IEnumerable))
                    {
                        Editor.BeginVertical();

                        {
                            var arrayIndex = 0;
                            var e          = target as IEnumerable;

                            foreach (var item in e)
                            {
                                var control = item as Control;
                                if (control != null)
                                {
                                    if (Editor.Button("    " + arrayIndex, control.ToString()))
                                    {
                                        return(control);
                                    }
                                }
                                else
                                {
                                    if (arrayIndex >= arrayEditors.Count)
                                    {
                                        var itemText = "null";
                                        if (item != null)
                                        {
                                            itemText = item.ToString();
                                        }

                                        var aEditor = new ObjectEditor(item, arrayIndex + " (" + itemText + ")");
                                        aEditor.backgroundRGB = MathHelper.Clamp(backgroundRGB - 25, 128, 255);

                                        arrayEditors.Add(aEditor);
                                    }

                                    arrayEditors[arrayIndex].Draw();
                                }

                                arrayIndex++;
                            }
                        }

                        Editor.EndVertical();
                    }
                }

                Editor.EndVertical();

                if (toggleEditor)
                {
                    Editor.NewLine(1);
                }

                return(null);
            }