Archive Browser
Download PhotoshopColorSwatchWriter.zip version 2.0.0.0, last updated 15/03/2026 (17.27 KB)
Download- md5: 56d753ea51f23c0dcdfb6bc934aabc5b
- sha1: dc65c9411b063b43b194845dc99a27e228a319a4
- sha256: f22265a7b2fd0f6e71db50bbeeff063b5a28adc731420dbf6b85e888b3dd267d
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace PhotoshopColorSwatchWriter
{
internal class PalettePanel : BufferedPanel
{
#region Constants
private const int DefaultX = 6;
private const int DefaultY = 6;
private const int Spacing = 6;
private const int CellSize = 16;
#endregion
#region Instance Fields
private List<Color> _colors;
#endregion
#region Overridden Methods
/// <summary>
/// Raises the <see cref="E:System.Windows.Forms.Control.Paint"/> event.
/// </summary>
/// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"/> that contains the event data. </param>
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (this.Colors != null)
{
int x;
int y;
x = DefaultX;
y = DefaultY;
e.Graphics.Clear(this.BackColor);
foreach (Color color in this.Colors)
{
Rectangle bounds;
if (x > this.ClientSize.Width - (CellSize + DefaultX))
{
x = DefaultX;
y += DefaultY + CellSize + Spacing;
}
bounds = new Rectangle(x, y, CellSize, CellSize);
using (Brush brush = new SolidBrush(color))
e.Graphics.FillRectangle(brush, bounds);
e.Graphics.DrawRectangle(Pens.Black, bounds);
x += (CellSize + Spacing);
}
}
}
#endregion
#region Public Properties
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public List<Color> Colors
{
get { return _colors; }
set
{
_colors = value;
this.Invalidate();
}
}
#endregion
}
}
Donate
This software may be used free of charge, but as with all free software there are costs involved to develop and maintain.
If this site or its services have saved you time, please consider a donation to help with running costs and timely updates.
Donate