private void dSkinButton_BackGround_Click(object sender, EventArgs e) { bool bbb = dSkinCheckBox_ImageFuzzy.Checked; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Image Files(*.All Types)|*.jpg;*.jpeg;*.png;*.bmp;*.gif"; openFileDialog.FilterIndex = 1; if (openFileDialog.ShowDialog() == DialogResult.OK) { System.IO.FileInfo fl = new System.IO.FileInfo(openFileDialog.FileName); if (fl.Length > 1024 * 1024) { //System.Windows.Forms.MessageBox.Show("请选择1M以内的横向图片"); AuroraMessageBox msg = null; msg = new AuroraMessageBox(); msg.strCaption = "Aurora智能提示"; msg.strMessage = "请选择1M以内的横向图片"; msg.strButtonText = "确定"; msg.StartPosition = FormStartPosition.Manual; msg.Location = new Point(this.Location.X + this.Width / 2 - msg.Width / 2, this.Location.Y + this.Height / 2 - msg.Height / 2); msg.ShowDialog(); return; } mainFrm.str_BackGroundImage = dSkinTextBox_BackGround.Text = openFileDialog.FileName; mainFrm.SetPlayerBackground(); mainFrm.ItemHoverColor = SkinTools.GetImageAverageColor(Image.FromFile(openFileDialog.FileName)); HSL hsl = ColorConverterEx.ColorToHSL(mainFrm.ItemHoverColor); //hsl.Luminance += 0.2; //if (hsl.Luminance >= 1) // hsl.Luminance = 0.99; hsl.Saturation += 0.2; if (hsl.Saturation >= 1) { hsl.Saturation = 0.99; } mainFrm.ItemHoverColor = ColorConverterEx.HSLToColor(hsl); dSkinCheckBox_ImageFuzzy.Checked = !bbb; dSkinCheckBox_ImageFuzzy.Checked = bbb; this.Invalidate(); } }
private void DrawDefaultBack(Graphics g, RectangleF rect) { float width = rect.Width / 360f; rect.Width = width; using (LinearGradientBrush brush = new LinearGradientBrush( new Point(0, 0), new Point(1, 0), Color.White, Color.White)) { ColorBlend blend = new ColorBlend(); blend.Colors = new Color[] { Color.White, Color.White, Color.Black }; blend.Positions = new float[] { 0f, .5f, 1f }; brush.Transform = new Matrix(0f, rect.Height, 1f, 0f, 0f, 0f); for (int i = 0; i < 360; i++) { _drawHsl.Hue = i; rect.X += width; blend.Colors[1] = ColorConverterEx.HSLToColor(_drawHsl); brush.InterpolationColors = blend; g.FillRectangle(brush, rect); } } }
private void CalcColors() { switch (_barStyle) { case HSLTrackBarStyle.Saturation: if (_blend == null) { _blend = new ColorBlend(); } HSL hsl = _hsl; Color[] colors = new Color[3]; hsl.Saturation = 1d; colors[2] = ColorConverterEx.HSLToColor(hsl); hsl.Saturation = 0.5d; colors[1] = ColorConverterEx.HSLToColor(hsl); hsl.Saturation = 0d; colors[0] = ColorConverterEx.HSLToColor(hsl); _blend.Colors = colors; _blend.Positions = new float[] { 0, 0.5f, 1f }; break; } }