/// <summary> /// Create image button /// </summary> /// <param name="parent"></param> /// <param name="normalimgpath"></param> /// <param name="focusimgpath"></param> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public static ImageButton CreateImageButton( Panel parent, string normalimgpath, string focusimgpath, double x, double y) { var btn = new ImageButton(); btn.Create(BUTTON_IMAGE_WIDTH, BUTTON_IMAGE_HEIGHT, normalimgpath, focusimgpath); btn.SetXYWithMargin(x, y); parent.Children.Add(btn); btn.Hide(); return btn; }
/// <summary> /// Add menu item /// </summary> /// <param name="itemid"></param> /// <param name="marginx"></param> /// <param name="marginy"></param> /// <param name="normalbmpid"></param> /// <param name="focusbmpid"></param> public void AddMenuItem( int itemid, int marginx, int marginy, BitmapSource normalbmp, BitmapSource focusbmp) { var imgbutton = new ImageButton(); Debug.Assert(normalbmp != null); Debug.Assert(focusbmp != null); imgbutton.Create(normalbmp, focusbmp); imgbutton.Tag = itemid; var pt = ComputeNextItemPoint(); imgbutton.SetXY(pt.X + marginx, pt.Y + marginy); imgbutton.Clicked += new EventHandler(OnImageButtonClicked); _menucontent.Children.Add(imgbutton); _items.Add(imgbutton); }
/// <summary> /// Create backside button /// </summary> void CreateBackSideButton() { _cancelbutton = MiniMemoControlUtil.CreateCancelImageButton(this); _cancelbutton.Clicked += new EventHandler(OnCancelButtonClicked); _trashbutton = MiniMemoControlUtil.CreateTrashImageButton(this); _trashbutton.Clicked += new EventHandler(OnTrashButtonClicked); }
/// <summary> /// Create back-side buttons /// </summary> void CreateBackSideButtons() { _cancelbutton = MiniMemoControlUtil.CreateCancelImageButton(this); _cancelbutton.Clicked += new EventHandler(OnCancelButtonClicked); _trashbutton = MiniMemoControlUtil.CreateTrashImageButton(this); _trashbutton.Clicked += new EventHandler(OnTrashButtonClicked); _clipboardbutton = MiniMemoControlUtil.CreateImageButton( this, "Images/memo-list/memo-summary-clipboard.png", "Images/memo-list/memo-summary-clipboard-selected.png", 100, 1); _clipboardbutton.Clicked += new EventHandler(OnCopyToClipboardClicked); _emailbutton = MiniMemoControlUtil.CreateImageButton( this, "Images/memo-list/memo-summary-email.png", "Images/memo-list/memo-summary-email-selected.png", 100, 94); _emailbutton.Clicked += new EventHandler(OnEmailClicked); }