public PanelIcon(IconPanel parent, Image imgPanel, Image imgDrag, int index, Object IconData, EventHandler onClickEvent, DoubleClickIconEvent onDoubleClickEvent) { Initialize(parent, imgPanel, imgDrag, index, IconData, onClickEvent, onDoubleClickEvent); }
private void Initialize(IconPanel parent, Image imgPanel, Image imgDrag, int index, Object IconData, EventHandler onClickEvent, DoubleClickIconEvent onDoubleClickEvent) { this.index=index; this.iconPanel=parent; this.m_oIconData = IconData; m_imgDrag = imgDrag; if(IconData == null) throw new Exception("IconData is not set for this panel icon."); Image=imgPanel; Visible=true; Location=new Point(iconPanel.outlookBar.Size.Width/2-imgPanel.Size.Width/2, iconPanel.Margin + index*iconPanel.IconSpacing); Size=imgPanel.Size; if(onClickEvent != null) Click+=onClickEvent; if(onDoubleClickEvent != null) DoubleClickIcon+=onDoubleClickEvent; Tag=this; MouseEnter+=new EventHandler(OnMouseEnter); MouseLeave+=new EventHandler(OnMouseLeave); MouseMove+=new MouseEventHandler(OnMouseMove); MouseDown+=new MouseEventHandler(OnMouseDown); GiveFeedback+=new GiveFeedbackEventHandler(OnGiveFeedback); m_imageDrag = new ImageListDrag(); m_imageList = new ImageList(); m_imageList.ImageSize = new Size(imgDrag.Width, imgDrag.Height); m_imageDrag.Imagelist = m_imageList; m_imageList.Images.Add(imgDrag, System.Drawing.Color.Transparent); m_bDraggingIcon = false; bckgColor=iconPanel.BackColor; //mouseEnter=false; AllowDrop = true; }
public PanelIcon(IconPanel parent, Image imgPanel, Image imgDrag, int index, Object IconData) { Initialize(parent, imgPanel, imgDrag, index, IconData, null, null); }