X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;ds=sidebyside;f=dev3%2Fpsychlops%2Fcore%2Fgraphic%2Fcanvas.cs;h=9d2cad399070a15304e94b41a9612923fd6c9802;hb=1a2f942e3be2ba03d789df4d17c3bf237d9b635f;hp=d9e0d379b8324fdc52ef6d271656fe9b2691ad6b;hpb=0d510ea424330e5e8c71dbc4576611e5f256d956;p=psychlops%2Fsilverlight.git diff --git a/dev3/psychlops/core/graphic/canvas.cs b/dev3/psychlops/core/graphic/canvas.cs index d9e0d37..9d2cad3 100644 --- a/dev3/psychlops/core/graphic/canvas.cs +++ b/dev3/psychlops/core/graphic/canvas.cs @@ -7,6 +7,7 @@ using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using System.Windows.Browser; @@ -140,6 +141,12 @@ namespace Psychlops api_canvas.MouseWheel += Mouse.Canvas_MouseWheel; panel.KeyDown += Keyboard.Canvas_KeyDown; panel.KeyUp += Keyboard.Canvas_KeyUp; + + HtmlElement htmlHost = HtmlPage.Document.GetElementById("silverlightControlHost"); + //if (htmlHost != null) HtmlPage.Window.Alert("silverlightControlHost is null"); + htmlHost.SetStyleAttribute("width", (200+wid).ToString()+"px"); + htmlHost.SetStyleAttribute("height", (20+hei).ToString() + "px"); + htmlHost.SetStyleAttribute("margin", "2em auto auto auto"); } #endregion @@ -200,9 +207,12 @@ namespace Psychlops if (nextIntervalFrame <= 0) { var tmp = new System.Windows.Controls.Canvas(); - foreach (Internal.PrimitiveFigure f in stack) + if (stack.Count > 0) { - tmp.Children.Add(f.toNative()); + foreach (Internal.PrimitiveFigure f in stack) + { + tmp.Children.Add(f.toNative()); + } } api_canvas.Children.Clear(); api_canvas.Children.Add(tmp);