protected override void OnLoad(EventArgs e) { base.OnLoad(e); Bitmap image = Bitmap.FromFile("AltData/About.gif"); m_MaterialBrush1 = new ExtBrush(); m_MaterialBrush1.MaterialName = "Material1"; m_MaterialBrush1.SetExtParameter("Image", image); m_MaterialBrush2 = new ExtBrush(); m_MaterialBrush2.MaterialName = "Material2"; m_MaterialBrush2.SetExtParameter("Image", image); m_MaterialBrush3 = new ExtBrush(); m_MaterialBrush3.MaterialName = "Material3"; m_MaterialBrush3.SetExtParameter("Image", image); m_MaterialBrush4 = new ExtBrush(); m_MaterialBrush4.MaterialName = "Material4"; m_MaterialBrush4.SetExtParameter("Image", image); // CrossSplitter splitter = new CrossSplitter(this); splitter.Dock = Pos.Fill; Pen contourPen = new Pen(Color.DodgerBlue, 3); ExtBrushPanel panel = m_ExtBrushPanel1 = new ExtBrushPanel(splitter, m_MaterialBrush1, contourPen, Color.LightCoral); panel.Dock = Pos.Fill; splitter.SetPanel(0, panel); panel = m_ExtBrushPanel2 = new ExtBrushPanel(splitter, m_MaterialBrush2, contourPen, Color.Green); panel.Dock = Pos.Fill; splitter.SetPanel(2, panel); panel = m_ExtBrushPanel3 = new ExtBrushPanel(splitter, m_MaterialBrush3, contourPen, Color.Red); panel.Dock = Pos.Fill; splitter.SetPanel(1, panel); panel = m_ExtBrushPanel4 = new ExtBrushPanel(splitter, m_MaterialBrush4, contourPen, Color.Cyan); panel.Dock = Pos.Fill; splitter.SetPanel(3, panel); }
protected void Paint_onPaint(Alt.GUI.PaintEventArgs e) { #if UNITY_5 && USE_ExtBrush if (e.Graphics is SoftwareGraphics) { return; } Alt.Sketch.Color colorMultiplier; #endif int opacity = 128; if (m_MaterialBrush1 == null) { #if UNITY_5 && USE_ExtBrush Bitmap image = Bitmap.FromFile("AltData/About.gif"); ExtBrush brush; brush = new ExtBrush(); brush.MaterialName = "Material1"; brush.SetExtParameter("Image", image); m_MaterialBrush1 = brush; brush = new ExtBrush(); brush.MaterialName = "Material2"; brush.SetExtParameter("Image", image); m_MaterialBrush2 = brush; brush = new ExtBrush(); brush.MaterialName = "Material3"; brush.SetExtParameter("Image", image); m_MaterialBrush3 = brush; brush = new ExtBrush(); brush.MaterialName = "Material4"; brush.SetExtParameter("Image", image); m_MaterialBrush4 = brush; #else SolidColorBrush brush; brush = new SolidColorBrush(Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.Red)); m_MaterialBrush1 = brush; brush = new SolidColorBrush(Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.Green)); m_MaterialBrush2 = brush; brush = new SolidColorBrush(Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.DodgerBlue)); m_MaterialBrush3 = brush; brush = new SolidColorBrush(Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.Yellow)); m_MaterialBrush4 = brush; #endif } Brush currentBrush; switch (m_CurrentBrush) { case 0: currentBrush = m_MaterialBrush1; #if UNITY_5 && USE_ExtBrush colorMultiplier = Alt.Sketch.Color.LightCoral; #endif break; case 1: currentBrush = m_MaterialBrush2; #if UNITY_5 && USE_ExtBrush colorMultiplier = Alt.Sketch.Color.Green; #endif break; case 2: currentBrush = m_MaterialBrush3; #if UNITY_5 && USE_ExtBrush colorMultiplier = Alt.Sketch.Color.Red; #endif break; case 3: currentBrush = m_MaterialBrush4; #if UNITY_5 && USE_ExtBrush colorMultiplier = Alt.Sketch.Color.Cyan; #endif break; default: return; } Alt.Sketch.Graphics graphics = e.Graphics; graphics.SmoothingMode = SmoothingMode.None; Alt.Sketch.Rect rect = e.ClipRectangle; rect.Deflate(50 + offset, 50 + offset); graphics.FillRoundedRectangle(currentBrush, rect, 20 #if UNITY_5 && USE_ExtBrush , colorMultiplier #else , UseHardwareRender ? Alt.Sketch.Color.FromArgb(opacity, Alt.Sketch.Color.White) : Alt.Sketch.Color.White #endif ); graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.DrawRoundedRectangle(m_ContourPen, rect, 20); }