//悬浮时 private void lblName_MouseHover(object sender, EventArgs e) { if (userInformationForm == null || userInformationForm.IsDisposed) { userInformationForm = new UserInformationForm(); } int top = this.Top + lblName.Top; int left = this.Left - 279 - 5; int ph = Screen.GetWorkingArea(this).Height; if (top + 181 > ph) { top = ph - 181 - 5; } if (left < 0) { left = this.Right + 5; } userInformationForm.IsFMove = false; this.userInformationForm.Item = UserItem; this.userInformationForm.SetUserData(UserItem, new Point(left, top)); this.userInformationForm.Show(); }
private UserInformationForm userInformationForm;//悬浮至头像时 private void chatShow_MouseEnterHead(object sender, ChatListEventArgs e) { if (userInformationForm == null || userInformationForm.IsDisposed) { userInformationForm = new UserInformationForm(); } int top = this.Top + this.ChatTab.Top + this.ChatTab.ItemSize.Height + (e.MouseOnSubItem.HeadRect.Y - this.chatListBox.chatVScroll.Value); int left = this.Left - 279 - 5; int ph = Screen.GetWorkingArea(this).Height; if (top + 181 > ph) { top = ph - 181 - 5; } if (left < 0) { left = this.Right + 5; } userInformationForm.IsFMove = false; this.userInformationForm.Item = e.MouseOnSubItem; this.userInformationForm.SetUserData(e.MouseOnSubItem, new Point(left, top)); this.userInformationForm.Show(); }