protected virtual void OnCustomPaint(MetroPaintEventArgs e) { if (GetStyle(ControlStyles.UserPaint)) { CustomPaint?.Invoke(this, e); } }
private void button1_Click(object sender, EventArgs e) { var clickedButton = (sender as Button); panelMain.Controls.Clear(true); Control newControl; var str = clickedButton.Text; switch (str) { case "INTRODUCTION": newControl = new Introduction(); break; case "CONTENT": newControl = new Content(); break; case "CUSTOM PAINT": newControl = new CustomPaint(); break; default: newControl = new Introduction(); break; } newControl.Dock = DockStyle.Fill; panelMain.Controls.Add(newControl); //Paint selection button color foreach (Button item in panelLinks.Controls) { item.Image = null; } clickedButton.Image = _menuButtonImage; //clickedButton.FlatAppearance.MouseOverBackColor = Color.Red; }
public static bool _hitTestInteractive(GlobalKey customPaintKey, Offset offset) { if (customPaintKey.currentContext == null) { return(false); } CustomPaint customPaint = customPaintKey.currentContext.widget as CustomPaint; ScrollbarPainter painter = customPaint.foregroundPainter as ScrollbarPainter; RenderBox renderBox = customPaintKey.currentContext.findRenderObject() as RenderBox; Offset localOffset = renderBox.globalToLocal(offset); return(painter.hitTestInteractive(localOffset)); }
public static void readPPOverrideDataPacket(BinaryReader reader, out PaintingProjectile projectile) { projectile = null; int projId = reader.ReadInt32(); int projType = reader.ReadInt32(); int paintColor = reader.ReadInt32(); string customPaintName = reader.ReadString(); float timeScale = (float)reader.ReadDouble(); float timeOffset = (float)reader.ReadDouble(); bool sprayPaint = reader.ReadBoolean(); string method = reader.ReadString(); Projectile proj = getProjectile(projId); if (proj != null && proj.type == projType) { projectile = proj.modProjectile as PaintingProjectile; if (projectile != null) { CustomPaint customPaint = customPaintName == "null" ? null : (CustomPaint)Activator.CreateInstance(Type.GetType("WeaponsOfMassDecoration.Items." + customPaintName)); PaintMethods paintMethod = (PaintMethods)Enum.Parse(typeof(PaintMethods), method); projectile._overridePaintData = new PaintData(timeScale, paintColor, customPaint, sprayPaint, timeOffset, paintMethod); } } }
private void LoginView_Paint(object sender, PaintEventArgs e) { CustomPaint.DefaultBorder(sender, e, this); }
private void AlertView_Paint(object sender, PaintEventArgs e) { CustomPaint.StoreEffect(sender, e, this, CustomPen.GetPenAlert()); }
private void ConfigView_Paint(object sender, PaintEventArgs e) { CustomPaint.StoreEffect(sender, e, this, new Pen(Color.Tomato, 1)); }
private void PopupView_Paint(object sender, PaintEventArgs e) { CustomPaint.StoreEffect(sender, e, this, CustomPen.GetPenPopUp()); }
public override Widget build(BuildContext context) { D.assert(MaterialD.debugCheckHasMaterialLocalizations(context)); if (this._controller.length == 0) { return(new Container( height: TabsUtils._kTabHeight + this.widget.indicatorWeight )); } List <Widget> wrappedTabs = new List <Widget>(); for (int i = 0; i < this.widget.tabs.Count; i++) { wrappedTabs.Add(new Center( heightFactor: 1.0f, child: new Padding( padding: this.widget.labelPadding ?? Constants.kTabLabelPadding, child: new KeyedSubtree( key: this._tabKeys[i], child: this.widget.tabs[i] ) ) ) ); } if (this._controller != null) { int previousIndex = this._controller.previousIndex; if (this._controller.indexIsChanging) { D.assert(this._currentIndex != previousIndex); Animation <float> animation = new _ChangeAnimation(this._controller); wrappedTabs[this._currentIndex] = this._buildStyledTab(wrappedTabs[this._currentIndex], true, animation); wrappedTabs[previousIndex] = this._buildStyledTab(wrappedTabs[previousIndex], false, animation); } else { int tabIndex = this._currentIndex; Animation <float> centerAnimation = new _DragAnimation(this._controller, tabIndex); wrappedTabs[tabIndex] = this._buildStyledTab(wrappedTabs[tabIndex], true, centerAnimation); if (this._currentIndex > 0) { int previousTabIndex = this._currentIndex - 1; Animation <float> previousAnimation = new ReverseAnimation(new _DragAnimation(this._controller, previousTabIndex)); wrappedTabs[previousTabIndex] = this._buildStyledTab(wrappedTabs[previousTabIndex], false, previousAnimation); } if (this._currentIndex < this.widget.tabs.Count - 1) { int nextTabIndex = this._currentIndex + 1; Animation <float> nextAnimation = new ReverseAnimation(new _DragAnimation(this._controller, nextTabIndex)); wrappedTabs[nextTabIndex] = this._buildStyledTab(wrappedTabs[nextTabIndex], false, nextAnimation); } } } int tabCount = this.widget.tabs.Count; for (int index = 0; index < tabCount; index++) { int tabIndex = index; wrappedTabs[index] = new InkWell( onTap: () => { this._handleTap(tabIndex); }, child: new Padding( padding: EdgeInsets.only(bottom: this.widget.indicatorWeight), child: wrappedTabs[index] ) ); if (!this.widget.isScrollable) { wrappedTabs[index] = new Expanded( child: wrappedTabs[index]); } } Widget tabBar = new CustomPaint( painter: this._indicatorPainter, child: new _TabStyle( animation: Animations.kAlwaysDismissedAnimation, selected: false, labelColor: this.widget.labelColor, unselectedLabelColor: this.widget.unselectedLabelColor, labelStyle: this.widget.labelStyle, unselectedLabelStyle: this.widget.unselectedLabelStyle, child: new _TabLabelBar( onPerformLayout: this._saveTabOffsets, children: wrappedTabs ) ) ); if (this.widget.isScrollable) { this._scrollController = this._scrollController ?? new _TabBarScrollController(this); tabBar = new SingleChildScrollView( scrollDirection: Axis.horizontal, controller: this._scrollController, child: tabBar); } return(tabBar); }
private void MarqPonto_Paint(object sender, PaintEventArgs e) { CustomPaint.StoreEffect(sender, e, this, CustomPen.GetPenHome()); }
private void BlockView_Paint(object sender, PaintEventArgs e) { CustomPaint.StoreEffect(sender, e, this, new Pen(Color.DarkOrange, 1)); }