using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraEditors.Controls; using DevExpress.XtraEditors.Repository; using ESRI.ArcGIS.Carto; using KGIS.Plugin.LayerProperty.Interface; namespace KGIS.Plugin.LayerProperty.View.UC_Controls { internal class UCRasterLayerDispPropertyPage : XtraUserControl, IUCPropertyPageEx, IPropertyPage { private IContainer components; private GroupControl groupControl1; private TrackBarControl trackDisplayResolutionFactor; private CheckEdit chkShowMapTips; private SpinEdit spTransparency; private SpinEdit spBrightness; private LabelControl labelControl2; private SpinEdit spContrast; private LabelControl labelControl1; private LabelControl labelControl10; private LabelControl labelControl9; private GroupControl groupControl2; private LabelControl labelControl5; private LabelControl labelControl4; private LabelControl labelControl3; private bool m_ShowTips; private short m_ContrastValue; private short m_BrightnessValue; private short m_Transparency; private int m_DisplayResolutionFactor; 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; set; } public string Title { get; set; } protected override void Dispose(bool disposing) { if (disposing && this.components != null) { this.components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.groupControl1 = new GroupControl(); this.chkShowMapTips = new CheckEdit(); this.spTransparency = new SpinEdit(); this.spBrightness = new SpinEdit(); this.labelControl2 = new LabelControl(); this.spContrast = new SpinEdit(); this.labelControl1 = new LabelControl(); this.labelControl10 = new LabelControl(); this.labelControl9 = new LabelControl(); this.trackDisplayResolutionFactor = new TrackBarControl(); this.groupControl2 = new GroupControl(); this.labelControl5 = new LabelControl(); this.labelControl4 = new LabelControl(); this.labelControl3 = new LabelControl(); ((ISupportInitialize)this.groupControl1).BeginInit(); this.groupControl1.SuspendLayout(); ((ISupportInitialize)this.chkShowMapTips.Properties).BeginInit(); ((ISupportInitialize)this.spTransparency.Properties).BeginInit(); ((ISupportInitialize)this.spBrightness.Properties).BeginInit(); ((ISupportInitialize)this.spContrast.Properties).BeginInit(); ((ISupportInitialize)this.trackDisplayResolutionFactor).BeginInit(); ((ISupportInitialize)this.trackDisplayResolutionFactor.Properties).BeginInit(); ((ISupportInitialize)this.groupControl2).BeginInit(); this.groupControl2.SuspendLayout(); base.SuspendLayout(); this.groupControl1.Controls.Add(this.chkShowMapTips); this.groupControl1.Controls.Add(this.spTransparency); this.groupControl1.Controls.Add(this.spBrightness); this.groupControl1.Controls.Add(this.labelControl2); this.groupControl1.Controls.Add(this.spContrast); this.groupControl1.Controls.Add(this.labelControl1); this.groupControl1.Controls.Add(this.labelControl10); this.groupControl1.Controls.Add(this.labelControl9); this.groupControl1.Location = new Point(12, 12); this.groupControl1.Name = "groupControl1"; this.groupControl1.Size = new Size(389, 176); this.groupControl1.TabIndex = 22; this.groupControl1.Text = "显示设置"; this.chkShowMapTips.Location = new Point(15, 34); this.chkShowMapTips.Name = "chkShowMapTips"; this.chkShowMapTips.Properties.Caption = "显示地图提示(使用主显示字段)"; this.chkShowMapTips.Size = new Size(222, 19); this.chkShowMapTips.TabIndex = 17; this.chkShowMapTips.CheckedChanged += new System.EventHandler(this.chkShowMapTips_CheckedChanged); BaseEdit arg_2BE_0 = this.spTransparency; int[] bits = new int[4]; arg_2BE_0.EditValue = new decimal(bits); this.spTransparency.Location = new Point(78, 127); this.spTransparency.Name = "spTransparency"; this.spTransparency.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton() }); RepositoryItemSpinEdit arg_329_0 = this.spTransparency.Properties; int[] array = new int[4]; array[0] = 100; arg_329_0.MaxValue = new decimal(array); this.spTransparency.Properties.MinValue = new decimal(new int[] { 100, 0, 0, -2147483648 }); this.spTransparency.Size = new Size(144, 21); this.spTransparency.TabIndex = 20; this.spTransparency.EditValueChanged += new System.EventHandler(this.spTransparency_EditValueChanged); BaseEdit arg_3AD_0 = this.spBrightness; int[] bits2 = new int[4]; arg_3AD_0.EditValue = new decimal(bits2); this.spBrightness.Location = new Point(78, 100); this.spBrightness.Name = "spBrightness"; this.spBrightness.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton() }); RepositoryItemSpinEdit arg_41E_0 = this.spBrightness.Properties; int[] array2 = new int[4]; array2[0] = 100; arg_41E_0.MaxValue = new decimal(array2); this.spBrightness.Properties.MinValue = new decimal(new int[] { 100, 0, 0, -2147483648 }); this.spBrightness.Size = new Size(144, 21); this.spBrightness.TabIndex = 20; this.spBrightness.EditValueChanged += new System.EventHandler(this.spBrightness_EditValueChanged); this.labelControl2.Location = new Point(17, 130); this.labelControl2.Name = "labelControl2"; this.labelControl2.Size = new Size(48, 14); this.labelControl2.TabIndex = 18; this.labelControl2.Text = "透明度:"; BaseEdit arg_4FE_0 = this.spContrast; int[] bits3 = new int[4]; arg_4FE_0.EditValue = new decimal(bits3); this.spContrast.Location = new Point(78, 73); this.spContrast.Name = "spContrast"; this.spContrast.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton() }); RepositoryItemSpinEdit arg_56F_0 = this.spContrast.Properties; int[] array3 = new int[4]; array3[0] = 100; arg_56F_0.MaxValue = new decimal(array3); this.spContrast.Properties.MinValue = new decimal(new int[] { 100, 0, 0, -2147483648 }); this.spContrast.Size = new Size(144, 21); this.spContrast.TabIndex = 20; this.spContrast.EditValueChanged += new System.EventHandler(this.spContrast_EditValueChanged); this.labelControl1.Location = new Point(17, 103); this.labelControl1.Name = "labelControl1"; this.labelControl1.Size = new Size(48, 14); this.labelControl1.TabIndex = 18; this.labelControl1.Text = "亮 度:"; this.labelControl10.Location = new Point(236, 130); this.labelControl10.Name = "labelControl10"; this.labelControl10.Size = new Size(135, 14); this.labelControl10.TabIndex = 19; this.labelControl10.Text = "(0-100,0表示不透明)"; this.labelControl9.Location = new Point(17, 76); this.labelControl9.Name = "labelControl9"; this.labelControl9.Size = new Size(48, 14); this.labelControl9.TabIndex = 18; this.labelControl9.Text = "对比度:"; this.trackDisplayResolutionFactor.EditValue = 100; this.trackDisplayResolutionFactor.Location = new Point(34, 56); this.trackDisplayResolutionFactor.Name = "trackDisplayResolutionFactor"; this.trackDisplayResolutionFactor.Properties.Maximum = 100; this.trackDisplayResolutionFactor.Properties.TickFrequency = 10; this.trackDisplayResolutionFactor.Properties.TickStyle = TickStyle.TopLeft; this.trackDisplayResolutionFactor.Size = new Size(321, 45); this.trackDisplayResolutionFactor.TabIndex = 21; this.trackDisplayResolutionFactor.Value = 100; this.trackDisplayResolutionFactor.EditValueChanged += new System.EventHandler(this.trackDisplayResolutionFactor_EditValueChanged); this.groupControl2.Controls.Add(this.labelControl5); this.groupControl2.Controls.Add(this.labelControl4); this.groupControl2.Controls.Add(this.labelControl3); this.groupControl2.Controls.Add(this.trackDisplayResolutionFactor); this.groupControl2.Location = new Point(12, 194); this.groupControl2.Name = "groupControl2"; this.groupControl2.Size = new Size(389, 123); this.groupControl2.TabIndex = 23; this.groupControl2.Text = "显示质量"; this.labelControl5.Location = new Point(331, 36); this.labelControl5.Name = "labelControl5"; this.labelControl5.Size = new Size(24, 14); this.labelControl5.TabIndex = 24; this.labelControl5.Text = "一般"; this.labelControl4.Location = new Point(182, 36); this.labelControl4.Name = "labelControl4"; this.labelControl4.Size = new Size(24, 14); this.labelControl4.TabIndex = 23; this.labelControl4.Text = "中等"; this.labelControl3.Location = new Point(34, 36); this.labelControl3.Name = "labelControl3"; this.labelControl3.Size = new Size(24, 14); this.labelControl3.TabIndex = 22; this.labelControl3.Text = "粗糙"; base.AutoScaleDimensions = new SizeF(6f, 12f); base.AutoScaleMode = AutoScaleMode.Font; base.Controls.Add(this.groupControl2); base.Controls.Add(this.groupControl1); base.Name = "UCRasterLayerDispPropertyPage"; base.Size = new Size(416, 409); ((ISupportInitialize)this.groupControl1).EndInit(); this.groupControl1.ResumeLayout(false); this.groupControl1.PerformLayout(); ((ISupportInitialize)this.chkShowMapTips.Properties).EndInit(); ((ISupportInitialize)this.spTransparency.Properties).EndInit(); ((ISupportInitialize)this.spBrightness.Properties).EndInit(); ((ISupportInitialize)this.spContrast.Properties).EndInit(); ((ISupportInitialize)this.trackDisplayResolutionFactor.Properties).EndInit(); ((ISupportInitialize)this.trackDisplayResolutionFactor).EndInit(); ((ISupportInitialize)this.groupControl2).EndInit(); this.groupControl2.ResumeLayout(false); this.groupControl2.PerformLayout(); base.ResumeLayout(false); } public UCRasterLayerDispPropertyPage() { this.InitializeComponent(); } private void chkShowMapTips_CheckedChanged(object sender, System.EventArgs e) { try { this.m_ShowTips = this.chkShowMapTips.Checked; this.InvokeEditValueChanged(sender, e); } catch (Exception ex) { //RdbUtil.AddException(ex); } } 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); } } private void trackDisplayResolutionFactor_EditValueChanged(object sender, System.EventArgs e) { try { this.m_DisplayResolutionFactor = Convert.ToInt32(this.trackDisplayResolutionFactor.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); } this.chkShowMapTips.Checked = this.m_Layer.ShowTips; ILayerEffects layerEffects = layerProperty as ILayerEffects; this.spBrightness.EditValue = layerEffects.Brightness; this.spContrast.EditValue = layerEffects.Contrast; this.spTransparency.EditValue = layerEffects.Transparency; IRasterLayer rasterLayer = layerProperty as IRasterLayer; this.trackDisplayResolutionFactor.EditValue = rasterLayer.DisplayResolutionFactor; this.m_ShowTips = this.chkShowMapTips.Checked; this.m_ContrastValue = Convert.ToInt16(this.spContrast.EditValue); this.m_BrightnessValue = Convert.ToInt16(this.spBrightness.EditValue); this.m_Transparency = Convert.ToInt16(this.spTransparency.EditValue); this.m_DisplayResolutionFactor = (int)Convert.ToInt16(this.trackDisplayResolutionFactor.EditValue); } catch (Exception ex) { //RdbUtil.AddException(ex); } } public void Write2Prop() { try { this.m_Layer.ShowTips = this.m_ShowTips; ILayerEffects layerEffects = this.m_Layer as ILayerEffects; layerEffects.Brightness = this.m_BrightnessValue; layerEffects.Contrast = this.m_ContrastValue; layerEffects.Transparency = this.m_Transparency; IRasterLayer rasterLayer = this.m_Layer as IRasterLayer; rasterLayer.DisplayResolutionFactor = this.m_DisplayResolutionFactor; this.isDirty = false; } catch (Exception ex) { ///RdbUtil.AddException(ex); } } public int Activate() { return 0; } public void Deactivate() { } public void Cancel() { } void IUCPropertyPageEx.Hide() { base.Hide(); } void IUCPropertyPageEx.Show() { base.Show(); } } }