protected override void OnPaint(PaintEventArgs e) { if (this.Parent == null) { return; } Color color = (BackColor.Equals(Color.Transparent)) ? Parent.BackColor : this.BackColor; _bufGraphics.Graphics.Clear(color); if (_drawParentImage && this.Parent.BackgroundImage != null) { int x = -this.Location.X; int y = -this.Location.Y; _bufGraphics.Graphics.DrawImageUnscaled(this.Parent.BackgroundImage, x, y); } for (int i = this.Parent.Controls.Count - 1; i > 0; i--) { DrawOtherControl(this.Parent.Controls[i]); } OnRender(_bufGraphics.Graphics); _bufGraphics.Render(e.Graphics); }
private void DoBackColorChanged(EventArgs e) { base.OnBackColorChanged(e); Color backgroundColor; if (BackColor.Equals(Color.Transparent)) { backgroundColor = Parent != null ? Parent.BackColor : Color.White; } else { backgroundColor = BackColor; } // Get the hue of the background color float hue = backgroundColor.GetHue(); float saturation = backgroundColor.GetSaturation(); float bright = backgroundColor.GetBrightness(); // Get a value which is darker or lighter _circleEdge = ColorFromAhsb(220, hue, saturation, bright * 0.2f); _circleBack = ColorFromAhsb(190, hue, saturation, bright * 0.4f); _circleCenter = ColorFromAhsb(210, hue, saturation, bright * 0.7f); _circleBright = ColorFromAhsb(250, hue, saturation, bright * 1.0f); #region Draw the faded edge of the circle to give spherical depth _glassShadowColorBlend.Colors = new[] { _circleEdge, _circleBack, _circleCenter, _circleCenter }; _glassShadowColorBlend.Positions = new[] { 0.00F, 0.25f, 0.7f, 1.0f }; #endregion #region Set the colors of the reflection // If the background color is black, make the class reflection white if (backgroundColor.Equals(Color.Black)) { float whiteHue = Color.White.GetHue(); float whiteSaturation = Color.White.GetSaturation(); float whiteBright = Color.White.GetBrightness(); _circleCenter = ColorFromAhsb(210, whiteHue, whiteSaturation, whiteBright * 0.7f); _circleBright = ColorFromAhsb(250, whiteHue, whiteSaturation, whiteBright * 1.0f); _glassReflectionColorBlend.Colors = new[] { _circleBright, Color.FromArgb(200, _circleCenter), Color.FromArgb(10, _circleCenter), Color.Transparent }; } else { Color nearWhite = ColorFromAhsb(255, hue, saturation, 1.0f); _glassReflectionColorBlend.Colors = new[] { nearWhite, Color.FromArgb(200, _circleCenter), Color.FromArgb(10, _circleCenter), Color.Transparent }; } _glassReflectionColorBlend.Positions = new[] { 0F, 0.15f, 0.35F, 1.0f }; MakeBrushes(); #endregion }
private void backgroundColorToolStripMenuItem_Click(object sender, EventArgs e) { colorPicker.Color = BackColor; colorPicker.ShowDialog(); if (!BackColor.Equals(colorPicker.Color)) { BackColor = colorPicker.Color; } }
private void changeColorToolStripMenuItem_Click(object sender, EventArgs e) { if (BackColor.Equals(prevColor)) { BackColor = Color.Aqua; } else { BackColor = prevColor; } }
/// <summary> /// Обработчик события - изменение цветовой схемы отображения /// </summary> /// <param name="sender">Объект, инициировавший событие(форма)</param> /// <param name="e">Аргумент события</param> protected virtual void formMain_BackColorChanged(object sender, EventArgs e) { List <Control> listCtrlDoChangeBackColor; BackColor = (sender as Form).BackColor; listCtrlDoChangeBackColor = getTypedControls(this, new List <Type> () { typeof(DataGridView), typeof(ZedGraph.ZedGraphControl) }).ToList(); listCtrlDoChangeBackColor.ForEach(ctrl => ctrl.BackColor = BackColor.Equals(SystemColors.Control) == false ? BackColor : SystemColors.Control); //??? SystemColors.Window }
public void PaintSelf(Graphics graphics, Point parentLocation, Color parentBg) { var cardArea = new Rectangle(parentLocation, Size); if (!parentBg.Equals(BackColor) && !BackColor.Equals(Color.Transparent)) { graphics.FillRectangle(new SolidBrush(BackColor), cardArea); } if (BackgroundImage != null) { graphics.DrawImage(BackgroundImage, cardArea); } }
public override bool Equals(object obj) { var other = obj as IStyleSheet; if (other == null) { return(false); } return(base.Equals(other) && BaseStyle.Equals(other.BaseStyle) && ItemStyle.Equals(other.ItemStyle) && EdgeStyle.Equals(other.EdgeStyle) && BackColor.Equals(other.BackColor)); }
public void ResourceControl_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if ((mouseDownSelectionWindow != Rectangle.Empty) && (!mouseDownSelectionWindow.Contains(e.X, e.Y))) { if (MainForm.tutorialMode && !BackColor.Equals(MainForm.tutorialColor)) { return; } displayOffset = SystemInformation.WorkingArea.Location; DragDropEffects dropEffect = this.DoDragDrop(Tag, DragDropEffects.Copy); } } }
/// <include file='doc\PrintPreviewControl.uex' path='docs/doc[@for="PrintPreviewControl.ShouldSerializeBackColor"]/*' /> /// <devdoc> /// <para> /// Indicates whether the <see cref='System.Windows.Forms.Control.BackColor'/> property should be /// persisted. /// </para> /// </devdoc> internal override bool ShouldSerializeBackColor() { return(!BackColor.Equals(SystemColors.AppWorkspace)); }
protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer) { // Wire up the onkeypress event handler to the ChangeBackgroundColor() JavaScript function Control c = Page.FindControl(ControlToManage); StringBuilder onClickCall = new StringBuilder(); //make sure it's the right object if (c != null && c.GetType().ToString().Equals("BrightcoveSDK.UI.VideoPlayer")) { VideoPlayer vp = (VideoPlayer)c; //check video id if (VideoID.Equals(-1)) { onClickCall.Append(vp.VideoID); } else { onClickCall.Append(VideoID); } onClickCall.Append(", "); //check for player id if (PlayerID.Equals(-1)) { onClickCall.Append(vp.PlayerID); } else { onClickCall.Append(PlayerID); } //check for player name onClickCall.Append(", '" + vp.PlayerName + "', "); //check for auto start if (AutoStart.Equals(false)) { onClickCall.Append(vp.AutoStart.ToString().ToLower()); } else { onClickCall.Append(AutoStart.ToString().ToLower()); } onClickCall.Append(", '"); //check for back color if (BackColor.Equals("#000000")) { onClickCall.Append(vp.BackColor); } else { onClickCall.Append(BackColor); } onClickCall.Append("', "); //check for width if (Width.Equals(0)) { onClickCall.Append(vp.Width.ToString()); } else { onClickCall.Append(Width.ToString()); } onClickCall.Append(", "); //check for Height if (Height.Equals(0)) { onClickCall.Append(vp.Height.ToString()); } else { onClickCall.Append(Height.ToString()); } onClickCall.Append(", "); //check for IsVid if (IsVid.Equals(true)) { onClickCall.Append(vp.IsVid.ToString().ToLower()); } else { onClickCall.Append(IsVid.ToString().ToLower()); } onClickCall.Append(", '"); //check for WMode if (WMode.Equals("")) { onClickCall.Append(vp.WMode); } else { onClickCall.Append(WMode); } //append for ClientID onClickCall.Append("', '" + vp.ClientID + "', '" + PlaylistTabString + "', '" + PlaylistComboString + "', '" + VideoList.ToString() + "'"); writer.AddAttribute("onclick", "javascript:addPlayer(" + onClickCall.ToString() + ");return false;"); base.AddAttributesToRender(writer); } else { StringBuilder error = new StringBuilder(); error.Append("The ControlToManage must be specified or point to a valid VideoPlayer."); if (c == null) { error.Append("\n The ControlToManage was null."); } else if (!c.GetType().ToString().Equals("BrightcoveSDK.UI.VideoPlayer")) { error.Append("\n The ControlToManage type was " + c.GetType().ToString() + "."); } throw new ArgumentException(error.ToString()); } }
protected bool Equals(Tile other) { return(BackColor.Equals(other.BackColor) && FrontColor.Equals(other.FrontColor) && Glyph == other.Glyph); }
// <doc> // <desc> // Returns true if the backColor should be persisted in code gen. We // override this because we change the default back color. // </desc> // <retvalue> // true if the backColor should be persisted. // </retvalue> // </doc> // public bool ShouldSerializeBackColor() { return(!BackColor.Equals(SystemColors.Info)); }
/// <summary> /// 自定义绘制节点 /// </summary> /// <param name="e"></param> private void DrawNodeItem(DrawTreeNodeEventArgs e) { TreeNode tn = e.Node; if (tn.Level == 0) { using (Graphics g = e.Graphics) { if (!BackColor.Equals(ChangeColor(MetroPaint.GetStyleColor(Style), -0.5f))) { BackColor = ChangeColor(MetroPaint.GetStyleColor(Style), -0.5f); } //绘制分组的背景 RenderBackgroundInternalRate( g, e.Bounds, MetroPaint.GetStyleColor(Style), false); //绘制展开按扭 g.FillEllipse(new SolidBrush(ExpandButtonColor), ExpandButtonBounds(e.Bounds)); g.DrawEllipse(new Pen(Color.LightGray), ExpandButtonBounds(e.Bounds)); Point p1; Point p2; Point p3; if (tn.IsExpanded) { p1 = new Point(ExpandButtonBounds(e.Bounds).X + 3, ExpandButtonBounds(e.Bounds).Bottom - 4); p2 = new Point(ExpandButtonBounds(e.Bounds).X + (ExpandButtonSize.Width) / 2, ExpandButtonBounds(e.Bounds).Top + 5); p3 = new Point(ExpandButtonBounds(e.Bounds).Right - 3, ExpandButtonBounds(e.Bounds).Bottom - 4); } else { p1 = new Point(ExpandButtonBounds(e.Bounds).X + 3, ExpandButtonBounds(e.Bounds).Y + 4); p2 = new Point(ExpandButtonBounds(e.Bounds).X + (ExpandButtonSize.Width) / 2, ExpandButtonBounds(e.Bounds).Bottom - 5); p3 = new Point(ExpandButtonBounds(e.Bounds).Right - 3, ExpandButtonBounds(e.Bounds).Y + 4); } GraphicsPath gp = new GraphicsPath(); gp.AddLine(p1, p2); gp.AddLine(p2, p3); g.DrawPath(new Pen(Color.FromArgb(255, 150, 0, 0), 2f), gp); //绘制分组的文本 TextRenderer.DrawText( g, e.Node.Text, MetroFonts.Tile(metroLabelSize, metroLabelWeight), GroupTitleBounds(e.Bounds), Color.White, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis); } } else if (tn.Level == 1) { //e.DrawDefault = true; using (Graphics g = e.Graphics) { if (tn.IsSelected) { RenderBackgroundInternalRate( g, e.Bounds, ChangeColor(MetroPaint.GetStyleColor(Style), 0.3f), false ); RenderBackgroundInternalRate( g, new Rectangle { X = e.Bounds.X, Y = e.Bounds.Y, Height = e.Bounds.Height, Width = 5 }, ChangeColor(MetroPaint.GetStyleColor(Style), -0.8f), false ); TextRenderer.DrawText( g, e.Node.Text, MetroFonts.Tile(metroLabelSize, metroLabelWeight), new Rectangle { X = e.Bounds.X + 40, Y = e.Bounds.Y, Width = e.Bounds.Width, Height = e.Bounds.Height }, Color.White, TextFormatFlags.Left | TextFormatFlags.VerticalCenter); } else { TextRenderer.DrawText( g, e.Node.Text, MetroFonts.Tile(metroLabelSize, MetroTileTextWeight.Light), new Rectangle { X = e.Bounds.X + 40, Y = e.Bounds.Y, Width = e.Bounds.Width, Height = e.Bounds.Height }, Color.White, TextFormatFlags.Left | TextFormatFlags.VerticalCenter); } } } }
private void RenderFlashObject(HtmlTextWriter writer) { switch (RenderMode) { case FlashRenderMode.ObjectTag: writer.AddAttribute("data", ResolveClientUrl(MovieUrl)); writer.AddAttribute("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"); writer.AddAttribute("codebase", "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + FlashVersion.Replace(".", ",")); if (!Unit.Equals(ExpandedWidth, Unit.Empty)) { writer.AddAttribute("width", this.ExpandedWidth.ToString()); } else { writer.AddAttribute("width", this.Width.ToString()); } if (!Unit.Equals(ExpandedHeight, Unit.Empty)) { writer.AddAttribute("height", this.ExpandedHeight.ToString()); } else { writer.AddAttribute("height", this.Height.ToString()); } writer.AddAttribute("type", "application/x-shockwave-flash"); writer.AddAttribute("viewastext", "viewastext"); writer.RenderBeginTag(HtmlTextWriterTag.Object); RenderContents(writer); writer.RenderEndTag(); break; case FlashRenderMode.ScriptTag: //Scripting attributes to the 'object' tag. if (!Unit.Equals(ExpandedWidth, Unit.Empty)) { _ScriptLine += ", \'" + this.ExpandedWidth.ToString() + "\'"; } else { _ScriptLine += ", \'" + this.Width.ToString() + "\'"; } if (!Unit.Equals(ExpandedHeight, Unit.Empty)) { _ScriptLine += ", \'" + this.ExpandedHeight.ToString() + "\'"; } else { _ScriptLine += ", \'" + this.Height.ToString() + "\'"; } _ScriptLine += ", \'" + ResolveClientUrl(MovieUrl) + "\'"; // choose a wmode and a bgcolor based on BackColor value. if (BackColor == System.Drawing.Color.Transparent) { _ScriptLine += ", \'#ffffff\'"; _ScriptLine += ", \'Transparent\'"; } else if (BackColor.Equals(System.Drawing.Color.Empty)) { //TODO: why i'm setting a bgcolor? guess that we cant do nothing here. _ScriptLine += ", \'#ffffff\'"; _ScriptLine += ", \'\'"; } else { //string color = Conversion.Hex(this.BackColor.ToArgb()); string color = this.BackColor.ToArgb().ToString("x2"); if (!color.Equals("0")) { _ScriptLine += ", \'#" + color.Substring(2) + "\'"; _ScriptLine += ", \'\'"; } } _ScriptLine += ", \'" + FlashVars + "\'"; if (this.ScriptAccess == FlashScriptAccess.Default) { _ScriptLine += ", null"; } else { _ScriptLine += ", \'" + ScriptAccess.ToString().ToLower() + "\'"; } if (AllowFullScreen) { _ScriptLine += ", true"; } else { _ScriptLine += ", false"; } string scale = "null"; if (this.Scale != FlashScale.ShowAll) { scale = "\'" + this.Scale.ToString().ToLower() + "\'"; } _ScriptLine += ", " + scale; string align = "null"; if (this.Alignment != FlashAlign.Center) { switch (Alignment) { case FlashAlign.Bottom: align = "\'b\'"; break; case FlashAlign.BottomLeft: align = "\'bl\'"; break; case FlashAlign.BottomRight: align = "\'br\'"; break; case FlashAlign.Left: align = "\'l\'"; break; case FlashAlign.Right: align = "\'r\'"; break; case FlashAlign.Top: align = "\'t\'"; break; case FlashAlign.TopLeft: align = "\'tl\'"; break; case FlashAlign.TopRight: align = "\'tr\'"; break; } } _ScriptLine += ", " + align; _ScriptLine += ");"; writer.AddAttribute("type", "text/javascript"); writer.RenderBeginTag(HtmlTextWriterTag.Script); writer.WriteLine(_ScriptLine); writer.RenderEndTag(); break; } }
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer) { if (this.DesignMode) { //nothing to be done yet } else { WriteParam(writer, "movie", ResolveClientUrl(MovieUrl)); // choose a wmode and a bgcolor based on BackColor value. if (BackColor == System.Drawing.Color.Transparent) { WriteParam(writer, "wmode", "Transparent"); } else if (BackColor.Equals(System.Drawing.Color.Empty)) { //nothing to be done. } else { //Conversion.Hex string color = this.BackColor.ToArgb().ToString("x2"); if (!color.Equals("0")) { WriteParam(writer, "bgcolor", "#" + color.Substring(2)); } } WriteParam(writer, "menu", ShowMenu.ToString().ToLower()); if (!string.IsNullOrEmpty(FlashVars)) { WriteParam(writer, "flashVars", FlashVars); } if (this.Scale != FlashScale.ShowAll) { WriteParam(writer, "scale", Scale.ToString().ToLower()); } if (!Play) { WriteParam(writer, "play", "false"); } if (ScriptAccess != FlashScriptAccess.Default) { WriteParam(writer, "allowScriptAccess", ScriptAccess.ToString().ToLower()); } if (AllowFullScreen) { WriteParam(writer, "allowFullscreen", AllowFullScreen.ToString().ToLower()); } if (!@Loop) { WriteParam(writer, "loop", "false"); } WriteParam(writer, "quality", Quality.ToString().ToLower()); if (this.Alignment != FlashAlign.Center) { string align = ""; switch (Alignment) { case FlashAlign.Bottom: align = "b"; break; case FlashAlign.BottomLeft: align = "bl"; break; case FlashAlign.BottomRight: align = "br"; break; case FlashAlign.Left: align = "l"; break; case FlashAlign.Right: align = "r"; break; case FlashAlign.Top: align = "t"; break; case FlashAlign.TopLeft: align = "tl"; break; case FlashAlign.TopRight: align = "tr"; break; } WriteParam(writer, "salign", align); } if (!Unit.Equals(ExpandedWidth, Unit.Empty)) { writer.AddAttribute("width", this.ExpandedWidth.ToString()); } else { writer.AddAttribute("width", this.Width.ToString()); } if (!Unit.Equals(ExpandedHeight, Unit.Empty)) { writer.AddAttribute("height", this.ExpandedHeight.ToString()); } else { writer.AddAttribute("height", this.Height.ToString()); } writer.AddAttribute(HtmlTextWriterAttribute.Type, "application/x-shockwave-flash"); writer.AddAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer"); writer.RenderBeginTag(HtmlTextWriterTag.Embed); writer.RenderEndTag(); } }
protected override void OnBackColorChanged(EventArgs e) { base.OnBackColorChanged(e); Color BackgroundColor; if (BackColor.Equals(Color.Transparent)) { if (Parent != null) { BackgroundColor = Parent.BackColor; } else { BackgroundColor = Color.White; } } else { BackgroundColor = BackColor; } // Get the hue of the background color float hue = BackgroundColor.GetHue(); float saturation = BackgroundColor.GetSaturation(); float bright = BackgroundColor.GetBrightness(); float alpha = BackgroundColor.A; // Get a value which is darker or lighter CircleEdge = DoubleBufferedControl.ColorFromAhsb(220, hue, saturation, bright * 0.2f); CircleBack = DoubleBufferedControl.ColorFromAhsb(190, hue, saturation, bright * 0.4f); CircleCenter = DoubleBufferedControl.ColorFromAhsb(210, hue, saturation, bright * 0.7f); CircleBright = DoubleBufferedControl.ColorFromAhsb(250, hue, saturation, bright * 1.0f); #region Draw the faded edge of the circle to give spherical depth GlassShadowColorBlend.Colors = new Color[] { CircleEdge, CircleBack, CircleCenter, CircleCenter }; GlassShadowColorBlend.Positions = new float[] { 0.00F, 0.25f, 0.7f, 1.0f }; #endregion #region Set the colors of the reflection // If the background color is black, make the class reflection white if (BackgroundColor.Equals(Color.Black)) { float WhiteHue = Color.White.GetHue(); float WhiteSaturation = Color.White.GetSaturation(); float WhiteBright = Color.White.GetBrightness(); CircleCenter = DoubleBufferedControl.ColorFromAhsb(210, WhiteHue, WhiteSaturation, WhiteBright * 0.7f); CircleBright = DoubleBufferedControl.ColorFromAhsb(250, WhiteHue, WhiteSaturation, WhiteBright * 1.0f); GlassReflectionColorBlend.Colors = new Color[] { CircleBright, Color.FromArgb(200, CircleCenter), Color.FromArgb(10, CircleCenter), Color.Transparent }; } else { Color NearWhite = DoubleBufferedControl.ColorFromAhsb(255, hue, saturation, 1.0f); GlassReflectionColorBlend.Colors = new Color[] { NearWhite, Color.FromArgb(200, CircleCenter), Color.FromArgb(10, CircleCenter), Color.Transparent }; } GlassReflectionColorBlend.Positions = new float[] { 0F, 0.15f, 0.35F, 1.0f }; MakeBrushes(); #endregion }