You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.2 KiB
C#
75 lines
2.2 KiB
C#
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace GeoSigma.SigmaDrawerElement
|
|
{
|
|
/// <summary>
|
|
/// 曲线渐变填充界面
|
|
/// </summary>
|
|
public partial class GradientFillForm : Form
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="GradientFillForm"/> class.
|
|
/// </summary>
|
|
public GradientFillForm()
|
|
{
|
|
InitializeComponent();
|
|
|
|
LeftColorComboBox.DrawItem += LeftColorComboBox_DrawItem;
|
|
RightColorComboBox.DrawItem += RightColorComboBox_DrawItem;
|
|
}
|
|
|
|
public string CurveName
|
|
{
|
|
get => CurveComoBox.Text;
|
|
set => CurveComoBox.Text = value;
|
|
}
|
|
|
|
public WellTrackGradientStyle GradientStyle
|
|
{
|
|
set
|
|
{
|
|
CurveComoBox.Text = value.CurveName;
|
|
LeftValueTextBox.Text = value.Left.ToString();
|
|
RightValueTextBox.Text = value.Right.ToString();
|
|
}
|
|
}
|
|
|
|
private void RightColorComboBox_DrawItem(object sender, DrawItemEventArgs e)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
|
|
private void LeftColorComboBox_DrawItem(object sender, DrawItemEventArgs e)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
|
|
private void DrawItem(object sender, DrawItemEventArgs e)
|
|
{
|
|
e.DrawBackground();
|
|
|
|
var comboBox = sender as ComboBox;
|
|
|
|
if (e.Index >= 0)
|
|
{
|
|
object item = comboBox.Items[e.Index];
|
|
if (item is Color color)
|
|
{
|
|
// 画颜色块
|
|
using (Brush brush = new SolidBrush(color))
|
|
{
|
|
e.Graphics.FillRectangle(brush, e.Bounds.Left + 2, e.Bounds.Top + 2, 20, e.Bounds.Height - 4);
|
|
e.Graphics.DrawRectangle(Pens.Black, e.Bounds.Left + 2, e.Bounds.Top + 2, 20, e.Bounds.Height - 4);
|
|
}
|
|
|
|
// 画颜色名字
|
|
e.Graphics.DrawString(color.Name, e.Font, Brushes.Black, e.Bounds.Left + 25, e.Bounds.Top + 2);
|
|
}
|
|
}
|
|
|
|
e.DrawFocusRectangle();
|
|
}
|
|
}
|
|
}
|