cyberjunk
26-02-2012 13:50:32
Dear community,
I'm trying to use the HtmlControl of Miyagi-1.2.1 within a Miyagi Panel.
Works fine so far, except for the scrolling
If the HtmlControl becomes bigger than it's container (Panel),
the Panel does not automatically add/adjust it's scrollbars.
(Like it does when adding Labels for example)
Also "ScrollToBottom();" does not work...
However, if I create the HtmlControl big enough to make it's container (Panel) have a scrollbars from the beginning,
the scrollbars get "updated" as soon as I start to move them "at least a bit",
afterwards they allow me to fully scroll down to new content in HtmlControl.
I tried probably every method I found that sounded like "update the scrollbars", like:
I'm trying to use the HtmlControl of Miyagi-1.2.1 within a Miyagi Panel.
Works fine so far, except for the scrolling
If the HtmlControl becomes bigger than it's container (Panel),
the Panel does not automatically add/adjust it's scrollbars.
(Like it does when adding Labels for example)
Also "ScrollToBottom();" does not work...
However, if I create the HtmlControl big enough to make it's container (Panel) have a scrollbars from the beginning,
the scrollbars get "updated" as soon as I start to move them "at least a bit",
afterwards they allow me to fully scroll down to new content in HtmlControl.
I tried probably every method I found that sounded like "update the scrollbars", like:
- this.Update()
this.VScrollBarElement.Update()
this.VScrollBarElement.Hide() followed by this.VScrollbarElement.Show()
and more...
[/list:u]
However I did not manage to manually trigger the "refresh" on the Scrollbar that is occuring, when it's being moved a little bit...
Here's my code-snippet, any help would be appreciated =)
public class HtmlPanel : Panel
{
private HtmlControl htmlControl;
private string htmlText = String.Empty;
public HtmlPanel(Skin panelSkin) : base ()
{
ResizeMode = ResizeModes.All;
Movable = true;
TabStop = false;
TabIndex = 0;
Throwable = true;
Size = new Size(400, 200);
Location = new Point(5, 400);
MinSize = new Size(0, 0);
Opacity = 0.5f;
ResizeThreshold = new Thickness(8);
BorderStyle = new BorderStyle { Thickness = new Thickness(8, 16, 8, 8) };
HScrollBarStyle = new ScrollBarStyle
{
Extent = 16,
ThumbStyle =
{
BorderStyle =
{
Thickness = new Thickness(2, 2, 2, 2)
}
}
};
VScrollBarStyle = new ScrollBarStyle
{
Extent = 12,
ThumbStyle =
{
BorderStyle =
{
Thickness = new Thickness(2, 2, 2, 2)
}
}
};
Skin = panelSkin;
htmlControl = new HtmlControl
{
Location = new Point(0, 0),
AutoSize = true,
Size = new Size(500,200),
AutoSizeMode = AutoSizeMode.GrowOnly
};
this.Controls.Add(htmlControl);
}
public void AddMessage(string Message)
{
htmlText += "<p>" + Message + "</p>";
htmlControl.HtmlSource = htmlText;
this.ScrollToBottom();
}
}