年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

190 lines
5.9 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using KGIS.Plugin.LayerProperty.Interface;
using ESRI.ArcGIS.Carto;
namespace KGIS.Plugin.LayerProperty.View.UC_Controls
{
public partial class UCLayerEffectPropertyPage : XtraUserControl, IUCPropertyPageEx, IPropertyPage
{
private short m_ContrastValue;
private short m_BrightnessValue;
private short m_Transparency;
private ILayer m_Layer;
private bool isDirty;
public event System.EventHandler EditorChanged;
public bool IsPageDirty
{
get
{
return this.isDirty;
}
set
{
this.isDirty = value;
}
}
public int Priority
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
public string Title
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
public UCLayerEffectPropertyPage()
{
InitializeComponent();
}
private void spContrast_EditValueChanged(object sender, System.EventArgs e)
{
try
{
this.m_ContrastValue = Convert.ToInt16(this.spContrast.EditValue);
this.InvokeEditValueChanged(sender, e);
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
private void spBrightness_EditValueChanged(object sender, System.EventArgs e)
{
try
{
this.m_BrightnessValue = Convert.ToInt16(this.spBrightness.EditValue);
this.InvokeEditValueChanged(sender, e);
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
private void spTransparency_EditValueChanged(object sender, System.EventArgs e)
{
try
{
this.m_Transparency = Convert.ToInt16(this.spTransparency.EditValue);
this.InvokeEditValueChanged(sender, e);
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
public bool CanWrite2Prop()
{
return true;
}
private void InvokeEditValueChanged(object sender, System.EventArgs e)
{
if (this.EditorChanged != null)
{
this.EditorChanged(sender, e);
}
this.isDirty = true;
}
public void SetDefaultValue(object value)
{
}
public void InitUC(object layerProperty)
{
try
{
if (layerProperty is ILayer)
{
this.m_Layer = (layerProperty as ILayer);
}
ILayerEffects layerEffects = layerProperty as ILayerEffects;
this.InitControlEnabled(layerEffects);
if (this.spBrightness.Enabled)
{
this.spBrightness.EditValue = layerEffects.Brightness;
}
if (this.spContrast.Enabled)
{
this.spContrast.EditValue = layerEffects.Contrast;
}
if (this.spTransparency.Enabled)
{
this.spTransparency.EditValue = layerEffects.Transparency;
}
this.m_ContrastValue = Convert.ToInt16(this.spContrast.EditValue);
this.m_BrightnessValue = Convert.ToInt16(this.spBrightness.EditValue);
this.m_Transparency = Convert.ToInt16(this.spTransparency.EditValue);
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
private void InitControlEnabled(ILayerEffects lyrEffects)
{
if (lyrEffects == null)
{
return;
}
this.spBrightness.Enabled = lyrEffects.SupportsBrightnessChange;
this.spContrast.Enabled = lyrEffects.SupportsContrastChange;
this.spTransparency.Enabled = lyrEffects.SupportsTransparency;
}
public void Write2Prop()
{
try
{
ILayerEffects layerEffects = this.m_Layer as ILayerEffects;
if (layerEffects.SupportsBrightnessChange)
{
layerEffects.Brightness = this.m_BrightnessValue;
}
if (layerEffects.SupportsContrastChange)
{
layerEffects.Contrast = this.m_ContrastValue;
}
if (layerEffects.SupportsTransparency)
{
layerEffects.Transparency = this.m_Transparency;
}
this.isDirty = false;
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
public int Activate()
{
throw new Exception("The method or operation is not implemented.");
}
public void Deactivate()
{
throw new Exception("The method or operation is not implemented.");
}
public void Cancel()
{
throw new Exception("The method or operation is not implemented.");
}
}
}