DataSelector.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:1k
源码类别:
OA系统
开发平台:
C#
- #define debug
- using System;
- using System.Reflection;
- using System.Collections;
- using System.Drawing;
- using System.Drawing.Design;
- using System.ComponentModel;
- using System.ComponentModel.Design.Serialization;
- using System.Windows.Forms;
- using System.Globalization;
- namespace OThinker.H3.WorkSheet
- {
- /// <summary>
- /// DataSelector 的摘要说明。
- /// </summary>
- public class DataSelector : UITypeEditor
- {
- public DataSelector()
- {
- // SEMI ERROR,这里可以做优化,免得每次都从服务器上取数据项
- }
- public override object EditValue(ITypeDescriptorContext tdc, IServiceProvider sp, object obj)
- {
- if( obj == null )
- obj = "";
- string Df = obj.ToString();
- DataFieldSelector DFSelector = new DataFieldSelector();
- if( DFSelector.ShowDialog() == DialogResult.OK )
- {
- if(DFSelector.SelctedDataField == null)
- {
- return obj;
- }
- else
- {
- return DFSelector.SelctedDataField;
- }
- }
- else
- return obj;
- }
- public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext tdc)
- {
- return UITypeEditorEditStyle.Modal;
- }
- }
- }