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.
94 lines
2.6 KiB
C#
94 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
using ICSharpCode.Core;
|
|
using Mesnac.Gui.Workbench;
|
|
using Mesnac.PlugIn.Pad;
|
|
|
|
namespace Mesnac.Gui.Edit.Pad
|
|
{
|
|
public partial class PropertyWindow : DefaultPadContent
|
|
{
|
|
public PropertyWindow()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public PropertyGrid PropertyGrid
|
|
{
|
|
get
|
|
{
|
|
return this.propertyGrid1;
|
|
}
|
|
}
|
|
|
|
public ComboBox CmbControls
|
|
{
|
|
get
|
|
{
|
|
return this.comboBox1;
|
|
}
|
|
}
|
|
|
|
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
|
|
{
|
|
ComboBox cmbControls = sender as ComboBox;
|
|
if (e.Index < 0 || e.Index >= cmbControls.Items.Count)
|
|
{
|
|
return;
|
|
}
|
|
Graphics g = e.Graphics;
|
|
Brush stringColor = SystemBrushes.ControlText;
|
|
|
|
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
|
|
{
|
|
if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)
|
|
{
|
|
g.FillRectangle(SystemBrushes.Highlight, e.Bounds);
|
|
stringColor = SystemBrushes.HighlightText;
|
|
}
|
|
else
|
|
{
|
|
g.FillRectangle(SystemBrushes.Window, e.Bounds);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
g.FillRectangle(SystemBrushes.Window, e.Bounds);
|
|
}
|
|
|
|
object item = cmbControls.Items[e.Index];
|
|
int xPos = e.Bounds.X;
|
|
|
|
if (item is IComponent)
|
|
{
|
|
ISite site = ((IComponent)item).Site;
|
|
if (site != null)
|
|
{
|
|
string name = site.Name;
|
|
using (Font f = new Font(cmbControls.Font, FontStyle.Bold))
|
|
{
|
|
g.DrawString(name, f, stringColor, xPos, e.Bounds.Y);
|
|
xPos += (int)g.MeasureString(name + "-", f).Width;
|
|
}
|
|
}
|
|
}
|
|
|
|
string typeString = item.GetType().ToString();
|
|
g.DrawString(typeString, cmbControls.Font, stringColor, xPos, e.Bounds.Y);
|
|
}
|
|
|
|
private void PropertyWindow_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
e.Cancel = true;
|
|
this.Hide();
|
|
}
|
|
}
|
|
}
|