├── .gitignore ├── Controls ├── BitmapFont.cs ├── BitmapLabel.cs ├── BitmapText.cs ├── ColorPicker.cs ├── ColorPickerForm.cs ├── Highcharts │ ├── Axis.cs │ ├── AxisCollection.cs │ ├── AxisTitle.cs │ ├── Chart.cs │ ├── DataCollection.cs │ ├── Highchart.cs │ ├── HighchartTitle.cs │ ├── HightchartSubtitle.cs │ ├── Legend.cs │ ├── LegendButton.cs │ ├── LegendItemStyle.cs │ ├── PlotOptions.cs │ ├── Series.cs │ ├── SeriesAreaSolid.cs │ ├── SeriesAreaSolidOutline.cs │ ├── SeriesCollection.cs │ ├── SeriesLine.cs │ ├── SeriesLineSolid.cs │ ├── SeriesPaint.cs │ ├── SeriesPoint.cs │ ├── XAxis.cs │ ├── YAxis.cs │ ├── ZoomTypes.cs │ ├── gradientFill.mat │ └── gradientFill.shader └── TableView.cs ├── Core ├── API │ ├── IApiGraphics.cs │ ├── IApiInput.cs │ ├── IApiSystem.cs │ ├── IApiTiming.cs │ └── ITexture.cs ├── ApiHolder.cs ├── ApplicationResources.cs ├── KeyboardHook.cs └── MouseHook.cs ├── Examples ├── ControlsExtensions.cs ├── FormExamples.cs └── Panels │ ├── BaseExamplePanel.cs │ ├── PanelButton.cs │ ├── PanelChart.cs │ ├── PanelCheckBox.cs │ ├── PanelColorPicker.cs │ ├── PanelComboBox.cs │ ├── PanelDateTimePicker.cs │ ├── PanelFileDialog.cs │ ├── PanelFontDialog.cs │ ├── PanelForm.cs │ ├── PanelGroupBox.cs │ ├── PanelLabel.cs │ ├── PanelLinkLabel.cs │ ├── PanelMenuStrip.cs │ ├── PanelMonthCalendar.cs │ ├── PanelNumericUpDown.cs │ ├── PanelPanel.cs │ ├── PanelPictureBox.cs │ ├── PanelProgressBar.cs │ ├── PanelRadioButton.cs │ ├── PanelScrollBar.cs │ ├── PanelSplitContainer.cs │ ├── PanelTabControl.cs │ ├── PanelTableView.cs │ ├── PanelTableViewLazy.cs │ ├── PanelTrackBar.cs │ └── PanelTreeView.cs ├── LICENSE.txt ├── README.md ├── Resources ├── arrow_down.png ├── arrow_left.png ├── arrow_right.png ├── arrow_up.png ├── checked.png ├── circle.png ├── close.png ├── cursors │ ├── hand.png │ ├── help.png │ ├── hsplit.png │ ├── ibeam.png │ ├── sizeall.png │ ├── sizenesw.png │ ├── sizens.png │ ├── sizenwse.png │ ├── sizewe.png │ └── vsplit.png ├── curved_arrow_down.png ├── curved_arrow_left.png ├── curved_arrow_right.png ├── curved_arrow_up.png ├── datetimepicker.png ├── dropdown_rightarrow.png ├── filedialog_back.png ├── filedialog_file.png ├── filedialog_folder.png ├── filedialog_refresh.png ├── filedialog_up.png ├── form_resize.png ├── numeric_down.png ├── numeric_up.png ├── radioButton_checked.png ├── radioButton_hovered.png ├── radioButton_unchecked.png ├── treenode_collapsed.png └── treenode_expanded.png ├── System ├── Drawing │ ├── Bitmap.cs │ ├── Brush.cs │ ├── Brushes.cs │ ├── Color.cs │ ├── ColorTranslator.cs │ ├── ContentAlignment.cs │ ├── Drawing2D │ │ └── DashStyle.cs │ ├── Font.cs │ ├── Graphics.cs │ ├── IDeviceContext.cs │ ├── Image.cs │ ├── KnownColor.cs │ ├── Pen.cs │ ├── Pens.cs │ ├── Point.cs │ ├── PointF.cs │ ├── Rectangle.cs │ ├── RectangleF.cs │ ├── Size.cs │ ├── SizeF.cs │ ├── SolidBrush.cs │ ├── StringFormat.cs │ ├── SystemBrushes.cs │ ├── SystemColors.cs │ ├── SystemFonts.cs │ └── SystemPens.cs └── Windows │ └── Forms │ ├── AnchorStyles.cs │ ├── AppGdiImages.cs │ ├── Application.cs │ ├── AutoCompleteMode.cs │ ├── AutoCompleteSource.cs │ ├── BaseCollection.cs │ ├── Border3DSide.cs │ ├── Border3DStyle.cs │ ├── BorderStyle.cs │ ├── BoundsSpecified.cs │ ├── Button.cs │ ├── ButtonBase.cs │ ├── ButtonBorderStyle.cs │ ├── ButtonState.cs │ ├── CheckBox.cs │ ├── CheckState.cs │ ├── ComboBox.cs │ ├── ComboBoxStyle.cs │ ├── ContainerControl.cs │ ├── ContextMenuStrip.cs │ ├── Control.cs │ ├── ControlEventArgs.cs │ ├── ControlPaint.cs │ ├── ControlStyles.cs │ ├── CreateParams.cs │ ├── Cursor.cs │ ├── Cursors.cs │ ├── DataFormats.cs │ ├── DataObject.cs │ ├── DateRangeEventArgs.cs │ ├── DateRangeEventHandler.cs │ ├── DateTimePicker.cs │ ├── DialogResult.cs │ ├── DragEventArgs.cs │ ├── DragEventHandler.cs │ ├── DrawItemEventArgs.cs │ ├── DrawItemEventHandler.cs │ ├── DrawItemState.cs │ ├── DrawMode.cs │ ├── DrawTreeNodeEventArgs.cs │ ├── DrawTreeNodeEventHandler.cs │ ├── FileDialog.cs │ ├── FlatStyle.cs │ ├── FontDialog.cs │ ├── Form.cs │ ├── FormBorderStyle.cs │ ├── FormClosedEventArgs.cs │ ├── FormClosedEventHandler.cs │ ├── FormClosingEventArgs.cs │ ├── FormClosingEventHandler.cs │ ├── FormCollection.cs │ ├── FormStartPosition.cs │ ├── FormWindowState.cs │ ├── GroupBox.cs │ ├── HScrollBar.cs │ ├── HScrollProperties.cs │ ├── HorizontalAlignment.cs │ ├── IButtonControl.cs │ ├── IContainerControl.cs │ ├── IDataObject.cs │ ├── IDropTarget.cs │ ├── IResizableControl.cs │ ├── ImageLayout.cs │ ├── ImageList.cs │ ├── InputLanguage.cs │ ├── ItemDragEventArgs.cs │ ├── ItemDragEventHandler.cs │ ├── KeyEventArgs.cs │ ├── KeyEventHandler.cs │ ├── KeyPressEventArgs.cs │ ├── KeyPressEventHandler.cs │ ├── Keys.cs │ ├── Label.cs │ ├── LayoutEventArgs.cs │ ├── LayoutEventHandler.cs │ ├── LinkBehavior.cs │ ├── LinkLabel.cs │ ├── LinkLabelLinkClickedEventArgs.cs │ ├── LinkLabelLinkClickedEventHandler.cs │ ├── LinkState.cs │ ├── ListBox.cs │ ├── ListControl.cs │ ├── ListSortDirection.cs │ ├── MdiClient.cs │ ├── MenuStrip.cs │ ├── MessageBox.cs │ ├── MonthCalendar.cs │ ├── MouseEventArgs.cs │ ├── MouseEventHandler.cs │ ├── NativeMethods.cs │ ├── NumericUpDown.cs │ ├── OpenFileDialog.cs │ ├── Orientation.cs │ ├── Padding.cs │ ├── PaintEventArgs.cs │ ├── PaintEventHandler.cs │ ├── Panel.cs │ ├── PictureBox.cs │ ├── ProgressBar.cs │ ├── ProgressBarStyle.cs │ ├── RadioButton.cs │ ├── RepeatButton.cs │ ├── ResizeButton.cs │ ├── RightToLeft.cs │ ├── SafeNativeMethods.cs │ ├── SaveFileDialog.cs │ ├── Screen.cs │ ├── ScrollBar.cs │ ├── ScrollBars.cs │ ├── ScrollEventArgs.cs │ ├── ScrollEventHandler.cs │ ├── ScrollEventType.cs │ ├── ScrollOrientation.cs │ ├── ScrollProperties.cs │ ├── ScrollableControl.cs │ ├── SizeGripStyle.cs │ ├── SplitContainer.cs │ ├── SplitterPanel.cs │ ├── SystemInformation.cs │ ├── TabAlignment.cs │ ├── TabControl.cs │ ├── TabControlCancelEventArgs.cs │ ├── TabControlEventArgs.cs │ ├── TabPage.cs │ ├── TextBox.cs │ ├── TextBoxBase.cs │ ├── Timer.cs │ ├── ToolStrip.cs │ ├── ToolStripButton.cs │ ├── ToolStripDropDown.cs │ ├── ToolStripDropDownDirection.cs │ ├── ToolStripDropDownItem.cs │ ├── ToolStripDropDownMenu.cs │ ├── ToolStripItem.cs │ ├── ToolStripItemClickedEventArgs.cs │ ├── ToolStripItemClickedEventHandler.cs │ ├── ToolStripItemCollection.cs │ ├── ToolStripLabel.cs │ ├── ToolStripMenuItem.cs │ ├── ToolStripSeparator.cs │ ├── ToolTip.cs │ ├── TrackBar.cs │ ├── TreeNode.cs │ ├── TreeNodeCollection.cs │ ├── TreeNodeMouseClickEventArgs.cs │ ├── TreeNodeMouseClickEventHandler.cs │ ├── TreeNodeMouseHoverEventArgs.cs │ ├── TreeNodeStates.cs │ ├── TreeView.cs │ ├── TreeViewAction.cs │ ├── TreeViewEventArgs.cs │ ├── TreeViewEventHandler.cs │ ├── UserControl.cs │ ├── VScrollBar.cs │ ├── VScrollProperties.cs │ └── WindowsFormsUtils.cs ├── Unity ├── API │ ├── UnityGdi.cs │ ├── UnityGdiHelper.cs │ ├── UnityGdiSprite.cs │ ├── UnityGdiTexture.cs │ ├── UnityInput.cs │ ├── UnitySystem.cs │ └── UnityTiming.cs ├── AppResources.cs ├── External │ ├── TextureScale.cs │ └── TextureScaler.cs ├── UnitWinFormsExamples.cs ├── UnityKeyTranslator.cs ├── UnityWinForms.cs └── Views │ ├── AppControlList.cs │ ├── ControlInspector.cs │ ├── Editor.cs │ ├── EditorMenu.cs │ ├── EditorValue.cs │ ├── IObjectDesigner.cs │ └── ObjectDesigner.cs └── Utility ├── ColorTranslatorEx.cs ├── ControlHelper.cs ├── DrawingHelper.cs ├── KeyHelper.cs ├── MathHelper.cs └── swfHelper.cs /.gitignore: -------------------------------------------------------------------------------- 1 | *.meta 2 | -------------------------------------------------------------------------------- /Controls/BitmapLabel.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Controls 2 | { 3 | using System; 4 | using System.Drawing; 5 | using System.Windows.Forms; 6 | 7 | /// 8 | /// Less allocation, slower baking. 9 | /// Multiline not supported yet. 10 | /// 11 | public class BitmapLabel : Control 12 | { 13 | internal readonly BitmapText bmText; 14 | 15 | public float Scale 16 | { 17 | get { return bmText.Scale; } 18 | set { bmText.Scale = value; } 19 | } 20 | public bool ShowRects { get; set; } 21 | public override string Text 22 | { 23 | get { return bmText.Text; } 24 | set 25 | { 26 | bmText.Text = value; 27 | Refresh(); 28 | } 29 | } 30 | 31 | public BitmapLabel(BitmapFont font) 32 | { 33 | if (font == null || font.Loaded == false) 34 | throw new ArgumentNullException("font"); 35 | 36 | bmText = new BitmapText(font); 37 | 38 | AutoSize = true; 39 | Size = new Size(120, 20); 40 | } 41 | 42 | public override void Refresh() 43 | { 44 | base.Refresh(); 45 | 46 | bmText.Apply(); 47 | if (AutoSize) 48 | Size = new Size(bmText.Width, bmText.Height); 49 | } 50 | 51 | protected override void OnPaint(PaintEventArgs e) 52 | { 53 | e.Graphics.uwfFillRectangle(BackColor, 0, 0, Width, Height); 54 | e.Graphics.uwfDrawImage(bmText, ForeColor, 0, 0, bmText.Width, bmText.Height); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Controls/Highcharts/AxisTitle.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System; 4 | using System.Windows.Forms; 5 | 6 | public class AxisTitle : IDisposable 7 | { 8 | private readonly Axis owner; 9 | 10 | public AxisTitle(Axis axis) 11 | { 12 | owner = axis; 13 | 14 | align = HorizontalAlignment.Center; 15 | offset = 0; 16 | margin = 0; 17 | text = null; 18 | x = 0; 19 | y = 0; 20 | 21 | if (axis.horizontal == false) margin = 10; 22 | } 23 | 24 | /// 25 | /// Alignment of the title relative to the axis values. Possible values are "low", "middle" or "high". Defaults to middle. 26 | /// 27 | public HorizontalAlignment align { get; set; } 28 | /// 29 | /// The pixel distance between the axis labels or line and the title. Defaults to 0 for horizontal axes, 10 for vertical 30 | /// 31 | public int margin { get; set; } 32 | /// 33 | /// The distance of the axis title from the axis line. By default, this distance is computed from the offset width of the labels, 34 | /// the labels' distance from the axis and the title's margin. However when the offset option is set, it overrides all this. 35 | /// 36 | public int offset { get; set; } 37 | /// 38 | /// The actual text of the axis title. It can contain basic HTML text markup like , and spans with style. 39 | /// 40 | public string text { get; set; } 41 | /// 42 | /// Horizontal pixel offset of the title position. Defaults to 0. 43 | /// 44 | public int x { get; set; } 45 | /// 46 | /// Vertical pixel offset of the title position. 47 | /// 48 | public int y { get; set; } 49 | 50 | public void Dispose() 51 | { 52 | if (owner != null) owner.Dispose(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Controls/Highcharts/Chart.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System; 4 | using System.Drawing; 5 | 6 | public class Chart : IDisposable 7 | { 8 | internal Pen borderPen = new Pen(Color.White); 9 | internal Pen plotBorderPen = new Pen(Color.Transparent); 10 | 11 | public Chart() 12 | { 13 | backgroundColor = Color.FromArgb(0xFF, 0xFF, 0xFF); 14 | borderColor = Color.FromArgb(0x33, 0x5C, 0xAD); 15 | borderWidth = 0; 16 | plotBackgroundColor = Color.Transparent; 17 | plotBorderColor = Color.FromArgb(0xCC, 0xCC, 0xCC); 18 | plotBorderWidth = 0; 19 | spacingBottom = 15; 20 | spacingLeft = 10; 21 | spacingRight = 10; 22 | spacingTop = 10; 23 | } 24 | 25 | public Color backgroundColor { get; set; } 26 | public Color borderColor { get; set; } 27 | public int borderWidth { get; set; } 28 | public int?[] margin 29 | { 30 | get { return new[] {marginTop, marginRight, marginBottom, marginLeft}; } 31 | set 32 | { 33 | if (value == null) 34 | { 35 | marginBottom = null; 36 | marginLeft = null; 37 | marginRight = null; 38 | marginTop = null; 39 | } 40 | else if (value.Length != 4) 41 | { 42 | throw new NotSupportedException("margin"); 43 | } 44 | else 45 | { 46 | marginBottom = value[2]; 47 | marginLeft = value[3]; 48 | marginRight = value[1]; 49 | marginTop = value[0]; 50 | } 51 | } 52 | } 53 | public int? marginBottom { get; set; } 54 | public int? marginLeft { get; set; } 55 | public int? marginRight { get; set; } 56 | public int? marginTop { get; set; } 57 | public Color plotBackgroundColor { get; set; } 58 | public Color plotBorderColor 59 | { 60 | get { return plotBorderPen.Color; } 61 | set { plotBorderPen.Color = value; } 62 | } 63 | public int plotBorderWidth 64 | { 65 | get { return (int)plotBorderPen.Width; } 66 | set { plotBorderPen.Width = value; } 67 | } 68 | public int spacingBottom { get; set; } 69 | public int spacingLeft { get; set; } 70 | public int spacingRight { get; set; } 71 | public int spacingTop { get; set; } 72 | //public ZoomTypes zoomType { get; set; } 73 | 74 | public void Dispose() 75 | { 76 | if (borderPen != null) borderPen.Dispose(); 77 | if (plotBorderPen != null) plotBorderPen.Dispose(); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Controls/Highcharts/HighchartTitle.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | public class HighchartTitle 7 | { 8 | public HighchartTitle() 9 | { 10 | align = HorizontalAlignment.Center; 11 | color = Color.FromArgb(0x33, 0x33, 0x33); 12 | floating = false; 13 | font = Highchart.DefaultFont18; 14 | margin = 15; 15 | text = "Chart title"; 16 | x = 0; 17 | y = 0; 18 | } 19 | 20 | /// 21 | /// The horizontal alignment of the title. Can be one of "left", "center" and "right". Defaults to center. 22 | /// 23 | public HorizontalAlignment align { get; set; } 24 | public Color color { get; set; } 25 | /// 26 | /// When the title is floating, the plot area will not move to make space for it. Defaults to false. 27 | /// 28 | public bool floating { get; set; } 29 | public Font font { get; set; } 30 | /// 31 | /// The margin between the title and the plot area, or if a subtitle is present, 32 | /// the margin between the subtitle and the plot area. Defaults to 15. 33 | /// 34 | public int margin { get; set; } 35 | /// 36 | /// The title of the chart. To disable the title, set the text to null. Defaults to Chart title. 37 | /// 38 | public string text { get; set; } 39 | /// 40 | /// The x position of the title relative to the alignment within chart.spacingLeft and chart.spacingRight. Defaults to 0. 41 | /// 42 | public int x { get; set; } 43 | /// 44 | /// The y position of the title relative to the alignment within chart.spacingTop and chart.spacingBottom. 45 | /// By default it depends on the font size. 46 | /// 47 | public int y { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Controls/Highcharts/HightchartSubtitle.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | public class HightchartSubtitle 7 | { 8 | public HightchartSubtitle() 9 | { 10 | align = HorizontalAlignment.Center; 11 | color = Color.FromArgb(0x33, 0x33, 0x33); 12 | floating = false; 13 | font = Highchart.DefaultFont12; 14 | text = null; 15 | x = 0; 16 | y = 0; 17 | } 18 | 19 | /// 20 | /// The horizontal alignment of the title. Can be one of "left", "center" and "right". Defaults to center. 21 | /// 22 | public HorizontalAlignment align { get; set; } 23 | public Color color { get; set; } 24 | /// 25 | /// When the title is floating, the plot area will not move to make space for it. Defaults to false. 26 | /// 27 | public bool floating { get; set; } 28 | public Font font { get; set; } 29 | /// 30 | /// The title of the chart. To disable the title, set the text to null. Defaults to Chart title. 31 | /// 32 | public string text { get; set; } 33 | /// 34 | /// The x position of the title relative to the alignment within chart.spacingLeft and chart.spacingRight. Defaults to 0. 35 | /// 36 | public int x { get; set; } 37 | /// 38 | /// The y position of the title relative to the alignment within chart.spacingTop and chart.spacingBottom. 39 | /// By default it depends on the font size. 40 | /// 41 | public int y { get; set; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Controls/Highcharts/Legend.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | 5 | public enum LegendLayouts 6 | { 7 | horizontal, 8 | vertical 9 | } 10 | 11 | public class Legend 12 | { 13 | public Legend() 14 | { 15 | enabled = true; 16 | floating = false; 17 | itemDistance = 20; 18 | itemHiddenStyle = new LegendItemStyle(Color.FromArgb(0xCC, 0xCC, 0xCC)); 19 | itemHoverStyle = new LegendItemStyle(Color.FromArgb(0x00, 0x00, 0x00)); 20 | itemStyle = new LegendItemStyle(Color.FromArgb(0x33, 0x33, 0x33)); 21 | layout = LegendLayouts.horizontal; 22 | margin = 12; 23 | } 24 | 25 | /// 26 | /// Enable or disable the legend. 27 | /// 28 | public bool enabled { get; set; } 29 | /// 30 | /// When the legend is floating, the plot area ignores it and is allowed to be placed below it. Defaults to false. 31 | /// 32 | public bool floating { get; set; } 33 | /// 34 | /// In a legend with horizontal layout, the itemDistance defines the pixel distance between each item. Defaults to 20. 35 | /// 36 | public int itemDistance { get; set; } 37 | public LegendItemStyle itemHiddenStyle { get; set; } 38 | public LegendItemStyle itemHoverStyle { get; set; } 39 | public LegendItemStyle itemStyle { get; set; } 40 | public LegendLayouts layout { get; set; } 41 | /// 42 | /// If the plot area sized is calculated automatically and the legend is not floating, the legend margin 43 | /// is the space between the legend and the axis labels or plot area. Defaults to 12. 44 | /// 45 | public int margin { get; set; } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Controls/Highcharts/LegendButton.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System; 4 | using System.Drawing; 5 | using System.Windows.Forms; 6 | 7 | internal sealed class LegendButton : Button 8 | { 9 | private const int DefaultTextMarginLeft = 16; 10 | 11 | public LegendButton(Legend l, Series s) 12 | { 13 | Legend = l; 14 | Series = s; 15 | TextLeftMargin = DefaultTextMarginLeft; 16 | 17 | TextFromSeries(); 18 | } 19 | 20 | public Legend Legend { get; private set; } 21 | public Series Series { get; private set; } 22 | public int TextLeftMargin { get; set; } 23 | 24 | protected override void OnMouseClick(MouseEventArgs e) 25 | { 26 | base.OnMouseClick(e); 27 | 28 | switch (e.Button) 29 | { 30 | case MouseButtons.Left: 31 | Series.visible = !Series.visible; 32 | 33 | var highcharts = Parent as Highchart; 34 | if (highcharts != null) 35 | highcharts.UpdatePlot(); // Update plot min and max values range. 36 | break; 37 | 38 | case MouseButtons.Right: 39 | 40 | var itemColor = new ToolStripMenuItem(Highchart.textLegendMenu_Color); 41 | itemColor.Click += (sender, args) => 42 | { 43 | var form = new ColorPickerForm(); 44 | form.Color = Series.color; 45 | form.ColorChanged += (sender2, args2) => Series.color = form.Color; 46 | form.ShowDialog(); 47 | }; 48 | 49 | var context = new ContextMenuStrip(); 50 | context.Items.Add(itemColor); 51 | context.Show(null, MousePosition); 52 | break; 53 | } 54 | } 55 | 56 | protected override void OnPaint(PaintEventArgs e) 57 | { 58 | var graphics = e.Graphics; 59 | 60 | // User original series color or hidden color for icon and use styles for text. 61 | var seriesColor = Series.color; 62 | var textColor = Legend.itemStyle.color; 63 | 64 | if (!Series.visible) 65 | { 66 | seriesColor = Legend.itemHiddenStyle.color; 67 | textColor = seriesColor; 68 | } 69 | 70 | // Text also supports hover style. 71 | if (hovered) 72 | textColor = Legend.itemHoverStyle.color; 73 | 74 | Series.PaintIcon(graphics, new Rectangle(0, 0, TextLeftMargin, 16)); 75 | 76 | graphics.uwfDrawString(Text, Font, textColor, TextLeftMargin, 0, Width - TextLeftMargin, Height, ContentAlignment.MiddleCenter); 77 | } 78 | 79 | protected override void OnPaintBackground(PaintEventArgs e) 80 | { } 81 | 82 | private void TextFromSeries() 83 | { 84 | Text = Series.name != null 85 | ? Series.name 86 | : "Series " + (Series.index + 1); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Controls/Highcharts/LegendItemStyle.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System; 4 | using System.Drawing; 5 | 6 | public struct LegendItemStyle : IEquatable 7 | { 8 | public readonly Color color; 9 | public readonly Font font; 10 | 11 | public LegendItemStyle(Color color) 12 | { 13 | this.color = color; 14 | font = Highchart.DefaultFont12B; 15 | } 16 | 17 | public bool Equals(LegendItemStyle other) 18 | { 19 | return color.Equals(other.color) && Equals(font, other.font); 20 | } 21 | 22 | public override bool Equals(object obj) 23 | { 24 | if (ReferenceEquals(null, obj)) return false; 25 | return obj is LegendItemStyle && Equals((LegendItemStyle)obj); 26 | } 27 | public override int GetHashCode() 28 | { 29 | unchecked 30 | { 31 | return (color.GetHashCode() * 397) ^ (font != null ? font.GetHashCode() : 0); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Controls/Highcharts/PlotOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | public class PlotOptions 4 | { 5 | public bool linearGradient { get; set; } 6 | public object linearGradientMaterial { get; set; } // Gradient material for areaSolidOutline series type. 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Controls/Highcharts/SeriesAreaSolid.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | 5 | public class SeriesAreaSolid : Series 6 | { 7 | public SeriesAreaSolid() : this("") 8 | { } 9 | 10 | public SeriesAreaSolid(string name) : base(name) 11 | { } 12 | 13 | protected override void OnPaint(Graphics g, Rectangle clipRectangle) 14 | { 15 | if (data.Count == 1) 16 | { 17 | SeriesPaint.PaintPoint(this, g, clipRectangle, 0); 18 | return; 19 | } 20 | 21 | var valueRange = GetValueRange(); 22 | var xStep = GetXStep(); 23 | var areaColorAlpha = collection.GetColorAlpha(); 24 | var areaColor = Color.FromArgb(areaColorAlpha, color); 25 | 26 | var prevValue = data[0]; 27 | var prevValueX = GetXFromIndex(0, xStep, clipRectangle); 28 | var prevValueY = GetYFromValue(prevValue, valueRange, clipRectangle); 29 | 30 | for (float dataIterator = pointInterval; dataIterator < data.Count; dataIterator += pointInterval) 31 | { 32 | double currentValue = data[(int) dataIterator]; 33 | 34 | float currentValueX = GetXFromIndex(dataIterator, xStep, clipRectangle); 35 | float currentValueY = GetYFromValue(currentValue, valueRange, clipRectangle); 36 | 37 | float width = currentValueX - prevValueX; 38 | 39 | g.uwfFillRectangle(areaColor, prevValueX, prevValueY, width, clipRectangle.Bottom - prevValueY); 40 | 41 | if (dataIterator + pointInterval >= data.Count) 42 | g.uwfFillRectangle(areaColor, currentValueX, currentValueY, xStep, clipRectangle.Bottom - currentValueY); 43 | 44 | prevValueX = currentValueX; 45 | prevValueY = currentValueY; 46 | 47 | SeriesPaint.PaintHoveredValueRect(this, g, currentValueX, currentValueY, xStep); 48 | } 49 | } 50 | 51 | protected override void OnPaintIcon(Graphics g, Rectangle clipRectangle) 52 | { 53 | g.uwfFillRectangle(color, clipRectangle.Left + 4, clipRectangle.Top + 8, 8, 8); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Controls/Highcharts/SeriesLine.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | 5 | public class SeriesLine : Series 6 | { 7 | private readonly Pen iconPen = new Pen(Color.Black, 2); 8 | 9 | public SeriesLine() : this("") 10 | { } 11 | 12 | public SeriesLine(string name) : base(name) 13 | { } 14 | 15 | protected override void OnPaint(Graphics g, Rectangle clipRectangle) 16 | { 17 | if (data.Count == 1) 18 | { 19 | SeriesPaint.PaintPoint(this, g, clipRectangle, 0); 20 | return; 21 | } 22 | 23 | var valueRange = GetValueRange(); 24 | var xStep = GetXStep(); 25 | 26 | var prevValue = data[0]; 27 | var prevValueX = GetXFromIndex(0, xStep, clipRectangle); 28 | var prevValueY = GetYFromValue(prevValue, valueRange, clipRectangle); 29 | 30 | for (float dataIterator = pointInterval; dataIterator < data.Count; dataIterator += pointInterval) 31 | { 32 | int dataIndex = (int) dataIterator; 33 | 34 | double currentValue = data[dataIndex]; 35 | 36 | float currentValueX = GetXFromIndex(dataIndex, xStep, clipRectangle); 37 | float currentValueY = GetYFromValue(currentValue, valueRange, clipRectangle); 38 | 39 | g.DrawLine(pen, prevValueX, prevValueY, currentValueX, currentValueY); 40 | 41 | prevValueX = currentValueX; 42 | prevValueY = currentValueY; 43 | 44 | SeriesPaint.PaintHoveredValueRect(this, g, currentValueX, currentValueY, xStep); 45 | } 46 | } 47 | 48 | protected override void OnPaintIcon(Graphics g, Rectangle clipRectangle) 49 | { 50 | iconPen.Color = color; 51 | 52 | g.DrawLine(iconPen, clipRectangle.Left, clipRectangle.Top + 11, clipRectangle.Left + 16, clipRectangle.Top + 11); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Controls/Highcharts/SeriesLineSolid.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | 5 | public class SeriesLineSolid : Series 6 | { 7 | private readonly Pen iconPen = new Pen(Color.Black, 2); 8 | 9 | public SeriesLineSolid() : this("") 10 | { } 11 | 12 | public SeriesLineSolid(string name) : base(name) 13 | { } 14 | 15 | protected override void OnPaint(Graphics g, Rectangle clipRectangle) 16 | { 17 | if (data.Count == 1) 18 | { 19 | SeriesPaint.PaintPoint(this, g, clipRectangle, 0); 20 | return; 21 | } 22 | 23 | var valueRange = GetValueRange(); 24 | var xStep = GetXStep(); 25 | 26 | var prevValue = data[0]; 27 | var prevValueX = GetXFromIndex(0, xStep, clipRectangle); 28 | var prevValueY = GetYFromValue(prevValue, valueRange, clipRectangle); 29 | 30 | for (float dataIterator = pointInterval; dataIterator < data.Count; dataIterator += pointInterval) 31 | { 32 | int dataIndex = (int) dataIterator; 33 | 34 | double currentValue = data[dataIndex]; 35 | 36 | float currentValueX = GetXFromIndex(dataIndex, xStep, clipRectangle); 37 | float currentValueY = GetYFromValue(currentValue, valueRange, clipRectangle); 38 | 39 | g.DrawLine(pen, prevValueX, prevValueY, currentValueX + 1, prevValueY); 40 | g.DrawLine(pen, currentValueX, prevValueY, currentValueX, currentValueY); 41 | 42 | prevValueX = currentValueX; 43 | prevValueY = currentValueY; 44 | 45 | SeriesPaint.PaintHoveredValueRect(this, g, currentValueX, currentValueY, xStep); 46 | } 47 | } 48 | 49 | protected override void OnPaintIcon(Graphics g, Rectangle clipRectangle) 50 | { 51 | iconPen.Color = color; 52 | 53 | g.DrawLine(iconPen, clipRectangle.Left, clipRectangle.Top + 11, clipRectangle.Left + 16, clipRectangle.Top + 11); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Controls/Highcharts/SeriesPaint.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | 5 | public static class SeriesPaint 6 | { 7 | private static readonly SolidBrush pointBrush = new SolidBrush(Color.Black); 8 | 9 | public static void PaintPoint(Series s, Graphics g, Rectangle clipRectangle, int dataIndex) 10 | { 11 | pointBrush.Color = s.color; 12 | 13 | var valueRange = s.GetValueRange(); 14 | var xStep = s.GetXStep(); 15 | 16 | var valueX = s.GetXFromIndex(dataIndex, xStep, clipRectangle); 17 | var valueY = s.GetYFromValue(s.data[dataIndex], valueRange, clipRectangle); 18 | var valueDiameter = s.collection.chart.circleRadius * 2; 19 | 20 | g.FillEllipse(pointBrush, valueX, valueY, valueDiameter, valueDiameter); 21 | } 22 | 23 | public static void PaintHoveredValueRect(Series s, Graphics g, float currentValueX, float currentValueY, float xStep) 24 | { 25 | if (s.collection.chart.hovered && 26 | s.collection.chart.mouseX - s.collection.chart.cachedPlotLeft > currentValueX && 27 | s.collection.chart.mouseX - s.collection.chart.cachedPlotLeft < currentValueX + xStep) 28 | g.uwfFillRectangle(s.color, currentValueX - 2, currentValueY - 2, 4, 4); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Controls/Highcharts/SeriesPoint.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | 5 | public class SeriesPoint : Series 6 | { 7 | private readonly SolidBrush pointBrush = new SolidBrush(Color.Black); 8 | 9 | public SeriesPoint() : this("") 10 | { } 11 | 12 | public SeriesPoint(string name) : base(name) 13 | { } 14 | 15 | protected override void OnPaint(Graphics g, Rectangle clipRectangle) 16 | { 17 | pointBrush.Color = color; 18 | 19 | var pointRadius = collection.chart.circleRadius; 20 | var valueRange = GetValueRange(); 21 | var xStep = GetXStep(); 22 | 23 | for (float dataIterator = 0; dataIterator < data.Count; dataIterator += pointInterval) 24 | { 25 | int dataIndex = (int) dataIterator; 26 | 27 | double currentValue = data[dataIndex]; 28 | 29 | float currentValueX = GetXFromIndex(dataIndex, xStep, clipRectangle) - pointRadius; 30 | float currentValueY = GetYFromValue(currentValue, valueRange, clipRectangle) - pointRadius; 31 | 32 | g.FillEllipse(pointBrush, currentValueX, currentValueY, pointRadius * 2, pointRadius * 2); 33 | 34 | SeriesPaint.PaintHoveredValueRect(this, g, currentValueX, currentValueY, xStep); 35 | } 36 | } 37 | 38 | protected override void OnPaintIcon(Graphics g, Rectangle clipRectangle) 39 | { 40 | pointBrush.Color = color; 41 | 42 | g.FillEllipse(pointBrush, clipRectangle.Left + 4, clipRectangle.Top + 8, 8, 8); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Controls/Highcharts/XAxis.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | 5 | public class XAxis : Axis 6 | { 7 | public XAxis() : base(true) 8 | { 9 | gridLineColor = Color.FromArgb(0xE6, 0xE6, 0xE6); 10 | gridLineWidth = 0; 11 | lineColor = Color.FromArgb(0xCC, 0xD6, 0xEB); 12 | lineWidth = 1; 13 | tickColor = Color.FromArgb(0xCC, 0xD6, 0xEB); 14 | tickWidth = 1; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Controls/Highcharts/YAxis.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | using System.Drawing; 4 | 5 | public class YAxis : Axis 6 | { 7 | public YAxis() : base(false) 8 | { 9 | gridLineColor = Color.FromArgb(0xE6, 0xE6, 0xE6); 10 | gridLineWidth = 1; 11 | lineColor = Color.FromArgb(0xCC, 0xD6, 0xEB); 12 | lineWidth = 0; 13 | tickColor = Color.FromArgb(0xCC, 0xD6, 0xEB); 14 | tickWidth = 0; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Controls/Highcharts/ZoomTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Highcharts 2 | { 3 | public enum ZoomTypes 4 | { 5 | none, 6 | x, 7 | y, 8 | xy 9 | } 10 | } -------------------------------------------------------------------------------- /Controls/Highcharts/gradientFill.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meragon/Unity-WinForms/c622aab900d41b9272eb5614ca9e074c15ec75fa/Controls/Highcharts/gradientFill.mat -------------------------------------------------------------------------------- /Controls/Highcharts/gradientFill.shader: -------------------------------------------------------------------------------- 1 | Shader "GUI/GradientFill" 2 | { 3 | Properties 4 | { 5 | _Color("Color", Color) = (1, 1, 1, 1) 6 | _Y("Y", Float) = 0 7 | } 8 | 9 | SubShader 10 | { 11 | Tags 12 | { 13 | "Queue" = "Transparent" 14 | "IgnoreProjector" = "True" 15 | "RenderType" = "Transparent" 16 | "PreviewType" = "Plane" 17 | } 18 | 19 | Lighting Off 20 | Cull Off 21 | ZTest Always 22 | ZWrite Off 23 | Blend SrcAlpha OneMinusSrcAlpha 24 | 25 | Pass { 26 | 27 | CGPROGRAM 28 | 29 | #pragma vertex vert 30 | #pragma fragment frag 31 | 32 | #include "UnityCG.cginc" 33 | 34 | struct appdata_t 35 | { 36 | float4 vertex : POSITION; 37 | fixed4 color : COLOR; 38 | float2 texcoord : TEXCOORD0; 39 | }; 40 | 41 | struct v2f 42 | { 43 | float4 vertex : SV_POSITION; 44 | fixed4 color : COLOR; 45 | float2 texcoord : TEXCOORD0; // 0..1 46 | float4 worldPosition : TEXCOORD1; 47 | }; 48 | 49 | uniform fixed4 _Color; 50 | uniform float _Y; 51 | 52 | v2f vert(appdata_t v) 53 | { 54 | v2f o; 55 | o.worldPosition = v.vertex; 56 | o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); 57 | o.color = _Color; 58 | o.texcoord = v.texcoord; 59 | return o; 60 | } 61 | 62 | fixed4 frag(v2f i) : SV_Target 63 | { 64 | if (i.texcoord.y > _Y) 65 | return half4(0, 0, 0, 0); 66 | 67 | // Clipping is not working. 68 | // Details: 69 | // Default Unity shader(UI-Default.shader) is using UnityGet2DClipping to check clipping, but 70 | // there is variable _ClipRect which is used by that clipping function. I just don't know 71 | // where they updating it. 72 | // More interesting why clipping in default shader is not working too (when I change it in material inspector). 73 | // Right now clipping is managed by Chart control. 74 | return half4(i.color.rgb, i.texcoord.y); 75 | } 76 | 77 | ENDCG 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Core/API/IApiGraphics.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing.Drawing2D; 2 | 3 | namespace System.Drawing.API 4 | { 5 | public interface IApiGraphics 6 | { 7 | ITexture CreateTexture(int width, int height); 8 | ITexture CreateTexture(object original); 9 | 10 | void BeginGroup(float x, float y, float width, float height); 11 | void Clear(Color color); 12 | void DrawImage(Image image, float x, float y, float width, float height, float angle); 13 | void DrawImage(Image image, float x, float y, float width, float height, object material = null); 14 | void DrawLine(Pen pen, float x1, float y1, float x2, float y2, object material = null); 15 | void DrawLine(Color color, float width, DashStyle style, float x1, float y1, float x2, float y2, object material = null); 16 | void DrawPolygon(Pen pen, Point[] points, object material = null); 17 | void DrawRectangle(Pen pen, float x, float y, float width, float height, object material = null); 18 | void DrawString(string text, Font font, Color color, float x, float y, float width, float height, ContentAlignment align, object material = null); 19 | void EndGroup(); 20 | void FillRectangle(Brush brush, float x, float y, float width, float height, object material = null); 21 | void FillRectangle(Color color, float x, float y, float width, float height, object material = null); 22 | void Focus(); 23 | void FocusNext(); 24 | SizeF MeasureString(string text, Font font); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Core/API/IApiInput.cs: -------------------------------------------------------------------------------- 1 | namespace System.Drawing.API 2 | { 3 | public interface IApiInput 4 | { 5 | bool CursorVisible { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /Core/API/IApiSystem.cs: -------------------------------------------------------------------------------- 1 | namespace System.Drawing 2 | { 3 | using System.Globalization; 4 | 5 | public interface IApiSystem 6 | { 7 | CultureInfo CurrentCulture { get; } 8 | Point MousePosition { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Core/API/IApiTiming.cs: -------------------------------------------------------------------------------- 1 | namespace System.Drawing.API 2 | { 3 | public interface IApiTiming 4 | { 5 | float DeltaTime { get; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Core/API/ITexture.cs: -------------------------------------------------------------------------------- 1 | namespace System.Drawing.API 2 | { 3 | public interface ITexture 4 | { 5 | int Height { get; } 6 | int Width { get; } 7 | 8 | void Apply(); 9 | void Clear(Color color); 10 | Color GetPixel(int x, int y); 11 | Color[] GetPixels(); 12 | Color[] GetPixels(int x, int y, int width, int height); 13 | void SetPixel(int x, int y, Color color); 14 | void SetPixels(Color[] colors); 15 | void SetPixels(int x, int y, int width, int height, Color[] colors); 16 | } 17 | } -------------------------------------------------------------------------------- /Core/ApiHolder.cs: -------------------------------------------------------------------------------- 1 | namespace System.Windows.Forms 2 | { 3 | using System.Drawing; 4 | using System.Drawing.API; 5 | 6 | /// 7 | /// Replace with your own implementation if needed. 8 | /// 9 | public static class ApiHolder 10 | { 11 | public static IApiGraphics Graphics { get; set; } 12 | public static IApiInput Input { get; set; } 13 | public static IApiSystem System { get; set; } 14 | public static IApiTiming Timing { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /Core/ApplicationResources.cs: -------------------------------------------------------------------------------- 1 | namespace System.Windows.Forms 2 | { 3 | using System.Collections.Generic; 4 | 5 | internal static class ApplicationResources 6 | { 7 | public static AppGdiImages Images { get; set; } 8 | public static List Fonts { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Core/KeyboardHook.cs: -------------------------------------------------------------------------------- 1 | namespace System.Windows.Forms 2 | { 3 | internal static class KeyboardHook 4 | { 5 | public static event KeyEventHandler KeyDown; 6 | public static event KeyEventHandler KeyUp; 7 | 8 | public static void RaiseKeyDown(object sender, KeyEventArgs e) 9 | { 10 | var handler = KeyDown; 11 | if (handler != null) 12 | handler(sender, e); 13 | } 14 | public static void RaiseKeyUp(object sender, KeyEventArgs e) 15 | { 16 | var handler = KeyUp; 17 | if (handler != null) 18 | handler(sender, e); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Core/MouseHook.cs: -------------------------------------------------------------------------------- 1 | namespace System.Windows.Forms 2 | { 3 | /// 4 | /// implement your windows hook here. 5 | /// 6 | internal static class MouseHook 7 | { 8 | public static event MouseEventHandler MouseDown; 9 | [Obsolete("not supported yet")] 10 | public static event MouseEventHandler MouseMove; 11 | public static event MouseEventHandler MouseUp; 12 | [Obsolete("not supported yet")] 13 | public static event MouseEventHandler MouseWheel; 14 | 15 | public static void RaiseMouseDown(object sender, MouseEventArgs args) 16 | { 17 | var handler = MouseDown; 18 | if (handler != null) 19 | handler(sender, args); 20 | } 21 | public static void RaiseMouseMove(object sender, MouseEventArgs args) 22 | { 23 | #pragma warning disable 618 24 | var handler = MouseMove; 25 | #pragma warning restore 618 26 | if (handler != null) 27 | handler(sender, args); 28 | } 29 | public static void RaiseMouseWheel(object sender, MouseEventArgs args) 30 | { 31 | #pragma warning disable 618 32 | var handler = MouseWheel; 33 | #pragma warning restore 618 34 | if (handler != null) 35 | handler(sender, args); 36 | } 37 | public static void RaiseMouseUp(object sender, MouseEventArgs args) 38 | { 39 | var handler = MouseUp; 40 | if (handler != null) 41 | handler(sender, args); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Examples/Panels/BaseExamplePanel.cs: -------------------------------------------------------------------------------- 1 | namespace UnityWinForms.Examples.Panels 2 | { 3 | using System; 4 | using System.Drawing; 5 | using System.Windows.Forms; 6 | 7 | public abstract class BaseExamplePanel : Panel 8 | { 9 | protected int lineOffset = 36; 10 | 11 | protected BaseExamplePanel() 12 | { 13 | AutoScroll = true; 14 | BackColor = Color.FromArgb(239, 235, 233); 15 | } 16 | 17 | public abstract void Initialize(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Examples/Panels/PanelCheckBox.cs: -------------------------------------------------------------------------------- 1 | namespace UnityWinForms.Examples.Panels 2 | { 3 | using System.Windows.Forms; 4 | 5 | public class PanelCheckBox : BaseExamplePanel 6 | { 7 | public override void Initialize() 8 | { 9 | this.Create