/******************************************************************************* * Copyright(c) 2012 dongke All rights reserved. / Confidential * 类的信息: * 1.程序名称:ImageItem.cs * 2.功能描述:图片Item * 编辑履历: * 作者 日期 版本 修改内容 * 欧阳涛 2012/09/14 1.00 新建 *******************************************************************************/ using System; using System.Drawing; namespace Dongke.WinForm.Controls.InvoiceLayout { [Serializable] public class ImageItem : LayoutItem { #region 成员变量 private string _fileName = string.Empty; // 图片文件的路径(全名) private Image _image; // 图片 #endregion 成员变量 #region 属性 /// /// 获取或设置图片文件的路径(全名) /// public string FileName { get { return _fileName; } set { if (string.IsNullOrEmpty(value)) { value = string.Empty; } if (!value.Equals(_fileName)) { _fileName = value; //if (Owner != null) //{ // Owner.SetItemChangedArgs(this, ItemChangeType.Modified); //} } } } /// /// 获取或设置图片 /// public Image Image { get { return _image; } set { _image = value; //if (SimpleShape != null) //{ // SimpleShape.BackgroundImageLayout = ImageLayout.Stretch; // SimpleShape.BackgroundImage = _image; //} //if (Owner != null) //{ // Owner.SetItemChangedArgs(this, ItemChangeType.Modified); //} } } #endregion 属性 #region 构造函数 ///// ///// 构造函数 ///// //internal ImageItem() // : this(null) //{ //} /// /// 构造函数 /// /// Layoutbox /// item类别 internal ImageItem(/*LayoutBox box*/) : base(/*box, */ItemType.Image) { //_width = LayoutConsts.SHAPE_ITEM_SIZE_DEFAULT_WIDTH; //_height = LayoutConsts.SHAPE_ITEM_SIZE_DEFAULT_HEIGHT; //if (box != null) //{ // if (_simpleShape != null) // { // _simpleShape.BackgroundImageLayout = ImageLayout.Stretch; // _simpleShape.BackgroundImage = _image; // } //} } #endregion 构造函数 #region 函数 ///// ///// 显示Item属性设置画面 ///// ///// ///// DialogResult.OK:选中的Item有效,设置成功
///// DialogResult.Cancel:选中的Item有效,取消设置
///// DialogResult.None:LayoutBox不是编辑模式,或选中的Item不是一个 /////
//protected override DialogResult ShowItemPropertyDialogInner() //{ // using (ImageItemSetting itemPropertySetting = new ImageItemSetting()) // { // itemPropertySetting.ImageLocationX = Left; // itemPropertySetting.ImageLocationY = Top; // itemPropertySetting.ImageWidth = Width; // itemPropertySetting.ImageHeight = Height; // itemPropertySetting.SideRatioFixed = SideRatioFixed; // itemPropertySetting.FileName = FileName; // itemPropertySetting.Image = Image; // DialogResult result = itemPropertySetting.ShowDialog(); // if (result == DialogResult.OK) // { // Left = itemPropertySetting.ImageLocationX; // Top = itemPropertySetting.ImageLocationY; // Width = itemPropertySetting.ImageWidth; // Height = itemPropertySetting.ImageHeight; // SideRatioFixed = itemPropertySetting.SideRatioFixed; // ResetItemFrame(); // SetDrawProperty(); // Owner.Dirty = true; // } // return result; // } //} ///// ///// Item初始化 ///// ///// LayoutBox ///// 是否生成新ID ///// 是否成功 //internal override bool Init(LayoutBox box, bool isNewID) //{ // bool isInit = base.Init(box, isNewID); // if (isInit) // { // if (_simpleShape != null) // { // _simpleShape.BackgroundImageLayout = ImageLayout.Stretch; // _simpleShape.BackgroundImage = _image; // } // } // return isInit; //} #endregion 函数 } }