/// <summary> /// 添加一个按钮 /// </summary> /// <param name="position"></param> /// <returns></returns> public bool AddAButtom(ButtomControl mbc) { if (mbc.ButtomOR.ButtonWidth <= 10) mbc.ButtomOR.ButtonWidth = 200; if (mbc.ButtomOR.ButtonHeight <= 10) mbc.ButtomOR.ButtonHeight = 50; lableHeight = mbc.ButtomOR.ButtonHeight; BottomKJ bc = new BottomKJ(); bc.Name = "x1" + mbc.ID; bc.Width = mbc.ButtomOR.ButtonWidth; bc.Height = mbc.ButtomOR.ButtonHeight; bc.Tag = mbc; bc.SetValue(Canvas.LeftProperty, Convert.ToDouble(mbc.ButtomOR.LabelLeft)); bc.SetValue(Canvas.TopProperty, Convert.ToDouble(mbc.ButtomOR.LabelTop)); bc.SetSizeBg(); bc.SetTextInfo(); BindeEvent(bc); CBottom.Children.Add(bc); ENLableControl bc1 = new ENLableControl(); bc1.Name = "x2" + mbc.ID; bc1.Width = EnLableWidth; bc1.Height = EnLableHeight; bc1.Tag = mbc; bc1.SetTextInfo(); bc1.SetValue(Canvas.LeftProperty, Convert.ToDouble(mbc.ButtomOR.EnlabelLeftoffset)); bc1.SetValue(Canvas.TopProperty, Convert.ToDouble(mbc.ButtomOR.EnlabelTopoffset)); BindeEvent(bc1); CBottom.Children.Add(bc1); TagControl tab = new TagControl(); tab.Name = "x3" + mbc.ID; tab.Width = TagWidth; tab.Height = TagHeight; tab.Tag = mbc; tab.SetTextInfo(); tab.SetValue(Canvas.LeftProperty, Convert.ToDouble(mbc.ButtomOR.TagLeftoffset)); tab.SetValue(Canvas.TopProperty, Convert.ToDouble(mbc.ButtomOR.TagTopoffset)); BindeEvent(tab); CBottom.Children.Add(tab); return true; }
public CWButtomProperty(ButtomControl obj) { InitializeComponent(); FontHeadle.InitCombox(LabelFontname); FontHeadle.InitCombox(TagFontname); FontHeadle.InitCombox(EnlabelFontname); _Qh = obj.ButtomOR; _QHC = obj; cbYW.ItemsSource = MainPage.ListYw; cbYW.DisplayMemberPath = "Name"; //ListPageWin = Common.ListPageWin; cbPageWin.ItemsSource = Common.ListPageWin; cbPageWin.DisplayMemberPath = "Name"; //this.DataContext= this; InitValue(); }
protected void v_GetBottomListCompleted(object sender, WCFSV.GetBottomListCompletedEventArgs ee) { try { listButtom.Clear(); CBottom.Children.Clear(); var list = ee.Result; foreach (WCFSV.QhandyOR obj in list) { ButtomControl mbc = new ButtomControl(); mbc.OpType = 1; mbc.ID = Guid.NewGuid().ToString(); WCFSV.QhandyOR mButtom = new WCFSV.QhandyOR(); mButtom = _ButtomControl.Init(mButtom, this._WDBH); mbc.ButtomOR = obj; listButtom.Add(mbc); _ButtomControl.AddAButtom(mbc); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ButtomControl InitAddPosition(Point position, string _wdbh) { ButtomControl mbc = new ButtomControl(); mbc.OpType = 0; mbc.ID = Guid.NewGuid().ToString(); WCFSV.QhandyOR mButtom = new WCFSV.QhandyOR(); mButtom = Init(mButtom, _wdbh);// Init(mButtom); mButtom.Orgbh = _wdbh; mbc.ButtomOR = mButtom; mbc.ButtomOR.LabelLeft = Convert.ToInt16(position.X); mbc.ButtomOR.LabelTop = Convert.ToInt16(position.Y); mbc.ButtomOR.EnlabelLeftoffset = Convert.ToInt16(position.X); mbc.ButtomOR.EnlabelTopoffset = Convert.ToInt16(position.Y + lableHeight * 0.7); mbc.ButtomOR.TagLeftoffset = Convert.ToInt16(position.X + TagWidth * 0.7); mbc.ButtomOR.TagTopoffset = Convert.ToInt16(position.Y); AddAButtom(mbc); return mbc; }