public void AddMessage(ChatMessage message) { messages.Add(message); logHeight += message.Size.Height; needsResize = true; bool scroll = (((this.ClientSize.Height - (int)logHeight + this.Margin.Bottom)- this.AutoScrollPosition.Y) <= this.Margin.Bottom); if (scroll) {//729,767,3 MeasureTexts(CreateGraphics());//TODO: böse ScrollToBottom(); } else this.AutoScrollMinSize = new Size(0, (int)logHeight); this.Invalidate(); }
public RootPart(ChatMessage parentChatMessage,XmlElement xml,Font font = null) : base(xml, null,font) { this.parentChatMessage = parentChatMessage; }
private void ChatLogControl_MouseMove(object sender, MouseEventArgs e) { float currentPosition = ClientSize.Height + ((int)logHeight - this.ClientSize.Height) + AutoScrollPosition.Y; foreach (ChatMessage msg in messages) { currentPosition -= msg.Size.Height; if (e.Y > currentPosition && e.Y < currentPosition + msg.Size.Height) { if (msg != previousChatMessage) { if (previousChatMessage != null) previousChatMessage.MouseLeave (new PointF (e.X, e.Y - currentPosition), e); msg.MouseEnter (new PointF (e.X, e.Y - currentPosition),e); previousChatMessage = msg; } msg.MouseMove(new PointF(e.X, e.Y - currentPosition), e); break; } } }
private void Messages_ItemThrown(object sender, ChatMessage thrown) { logHeight -= thrown.Size.Height; }
private void Messages_ItemThrown(object sender, ChatMessage thrown) { logHeight -= thrown.Size.Height; }