当前位置: 首页>>代码示例>>C#>>正文


C# Form.SizeTo方法代码示例

本文整理汇总了C#中System.Windows.Forms.Form.SizeTo方法的典型用法代码示例。如果您正苦于以下问题:C# Form.SizeTo方法的具体用法?C# Form.SizeTo怎么用?C# Form.SizeTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Form的用法示例。


在下文中一共展示了Form.SizeTo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Application

        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IApp page)
        {
            //FormStyler.AtFormCreated = FormStyler.LikeWindows3;

            // http://alteredqualia.com/css-shaders/sphere_simple.html

            SphereRule.InitializeSphereRuleFor("shader");

            Func<Form> q = delegate
            {
                var f =
                    //new Form1
                    new Form { Text = "CSS filter shader" };

                f.SizeTo(512, 512);
                f.Show();

                f.GetHTMLTarget().className = "shader";

                #region WhileDragging

                Native.window.onframe += delegate
                {
                    if (f.Capture)
                    {
                        f.GetHTMLTarget().className = "";
                        f.Text = "CSS filter shader (dragging)";
                    }
                    else
                    {
                        f.GetHTMLTarget().className = "shader";
                        f.Text = "CSS filter shader";

                    }
                };
                #endregion


             
                return f;
            };

            q().MoveTo(32, 32);
            FormStyler.AtFormCreated = FormStyler.LikeVisualStudioMetro;
            q().MoveTo(96, 96);
            FormStyler.AtFormCreated = FormStyler.LikeWindows3;

            var pf = q();



        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:56,代码来源:Application.cs

示例2: Application


//.........这里部分代码省略.........
                        //var i = new IHTMLImage { src = src }.AttachTo(fc);
                        //i.style.width = "100%";

                        var web = new WebBrowser { Dock = DockStyle.Fill };

                        web.AttachTo(ff);

                        //script: error JSC1000: No implementation found for this native method, please implement [System.Windows.Forms.WebBrowser.add_DocumentCompleted(System.Windows.Forms.WebBrowserDocumentCompletedEventHandler)]
                        //script: warning JSC1000: Did you reference ScriptCoreLib via IAssemblyReferenceToken?
                        //script: error JSC1000: error at DropFileIntoSQLite.Application+<>c__DisplayClass2e.<.ctor>b__15,
                        // assembly: V:\DropFileIntoSQLite.Application.exe
                        // type: DropFileIntoSQLite.Application+<>c__DisplayClass2e, DropFileIntoSQLite.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

                        //web.DocumentCompleted +=
                        //    delegate
                        //    {



                        //};

                        DetectCanvasFromBytesExperiment(
                            ff,
                            web,
                            ContentValue,
                            src,
                            ContentBytesLength
                        );


                        web.Navigate(src);

                        if (Width > 0)
                            ff.SizeTo(
                               Width,
                               Height
                           );
                        //else
                        //    i.InvokeOnComplete(
                        //        delegate
                        //        {


                        //            ff.ClientSize = new System.Drawing.Size(i.width, i.height);

                        //        }
                        //    );

                        ff.LocationChanged +=
                            delegate
                            {
                                __ContentKey.SetLeft(ff.Left);
                                __ContentKey.SetTop(ff.Top);
                            };

                        ff.SizeChanged +=
                            delegate
                            {
                                __ContentKey.SetWidth(ff.Width);
                                __ContentKey.SetHeight(ff.Height);
                            };

                        ff.FormClosing +=
                            delegate
                            {
                                __ContentKey.Delete();
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:67,代码来源:Application.cs

示例3: Application


//.........这里部分代码省略.........
            #endregion


            // what is attaching what?
            // what about await
            var svgcursor1ghost = new cursor1().AttachTo(page.content).ToSVG();

            var svgcursor1 = new cursor1().AttachTo(page.content).ToSVG();

            svgcursor1.fill += svgcursor1ghost.fill;

            var vcursor = new cursor1().AttachTo(fvs.GetHTMLTarget()).ToSVG();

            var Shadows = new List<Form>();

            Func<Form, Form> CreateShadow =
                _fw =>
                {
                    FormStyler.AtFormCreated = LikeVirtualWindow;
                    var fwshadow = new Form();
                    Shadows.Add(fwshadow);

                    fwshadow.BackColor = Color.Transparent;
                    FormStyler.AtFormCreated = FormStyler.LikeWindowsClassic;
                    fwshadow.Width = Native.screen.width / 4;
                    fwshadow.Height = Native.screen.height / 4;
                    fwshadow.Show();


                    Action fwshadow_update = delegate
                    {

                        fwshadow.MoveTo(_fw.Left, _fw.Top);
                        fwshadow.SizeTo(_fw.Width, _fw.Height);
                    };

                    _fw.LocationChanged +=
                        delegate
                        {
                            fwshadow_update();
                        };

                    _fw.SizeChanged +=
                        delegate
                        {
                            fwshadow_update();

                        };

                    fwshadow_update();

                    _fw.BringToFront();

                    return fwshadow;
                };

            Shadows.Add(CreateShadow(fw));

            bool canexit = false;
            bool canenter = true;

            Action at_exit_MultiMouseMode = delegate
            {
                //Console.WriteLine("at_exit_MultiMouseMode");
            };
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:66,代码来源:Application.cs

示例4: InitializeContent


//.........这里部分代码省略.........



                        v.WalkTo(p.ToDouble());

                        // move in group formation
                        p.X += 16;
                        p.Y += 16;
                    }
                };


            #endregion

            #region tutorial step 4



            #region CreateDialogAt
            var CreateDialogAt =
                new
                {
                    //Dialog = default(IHTMLDiv),
                    Content = default(IHTMLDiv),
                    Width = default(string)
                }
                .ToFunc(
                (Point pos, string width) =>
                {
                    var f = new Form();

                    f.Show();

                    f.SizeTo(200, 200);


                    // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20151115/audio
                    //f.PopupInsteadOfClosing();

                    f.MoveTo(pos.X, pos.Y);
                    //f.SizeTo(


                    //var dialog = new IHTMLDiv();

                    //dialog.style.SetLocation(pos.X, pos.Y);

                    //dialog.style.backgroundColor = Color.Gray;
                    //dialog.style.padding = "1px";

                    //var caption = new IHTMLDiv().AttachTo(dialog);

                    //caption.style.backgroundColor = Color.Blue;
                    //caption.style.width = width;
                    //caption.style.height = "0.5em";
                    //caption.style.cursor = IStyle.CursorEnum.move;

                    //var drag = new DragHelper(caption);

                    //drag.Position = pos;
                    //drag.Enabled = true;
                    //drag.DragMove +=
                    //    delegate
                    //    {
                    //        dialog.style.SetLocation(drag.Position.X, drag.Position.Y);
                    //    };
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:67,代码来源:NatureBoyTestPad.cs

示例5: Application


//.........这里部分代码省略.........
			// X:\jsc.svn\core\ScriptCoreLib.Windows.Forms\ScriptCoreLib.Windows.Forms\JavaScript\BCLImplementation\System\Windows\Forms\Form\Form..ctor.cs
			//CaptionForeground.className = "caption";

			// Could not load file or assembly 'ScriptCoreLib' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

			var css = Native.css[typeof(Form)][" .caption"];
			//var css = IStyleSheet.all[" .caption"];


			//new IHTMLPre { new { css.rule.selectorText } }.AttachToDocument();


			// https://code.google.com/p/chromium/issues/detail?id=229330
			(css.style as dynamic).webkitAppRegion = "drag";

			//(ff.CaptionForeground.style as dynamic).webkitAppRegion = "drag";

			FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;

			var ShadowRightBottom = 8;

			var f = new Form
			{

				ShowIcon = false,

				Text = Native.document.title,

				//Text = Native.document.location.hash,
				StartPosition = FormStartPosition.Manual
			};


			f.MoveTo(0, 0).SizeTo(
					Native.window.Width - ShadowRightBottom,
					Native.window.Height - ShadowRightBottom
				);

			//f.Opacity = 0.5;

			f.Show();


			var t = new TrackBar
			{

				Maximum = 100,
				Minimum = 40,

				Dock = DockStyle.Top
			};
			t.AttachTo(f);
			t.ValueChanged += delegate
			{
				f.Opacity = (double)t.Value / (double)t.Maximum;

			};
			f.Opacity = 0.8;

			var w = new WebBrowser
			{

				// this wont work?
				//Dock = DockStyle.Fill

			}.AttachTo(f);
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:67,代码来源:Application.cs

示例6: Application


//.........这里部分代码省略.........
            var tt = new ScriptCoreLib.JavaScript.Runtime.Timer();

            Action AtCapture = null;

            tt.Tick +=
                delegate
                {
                    if (LocationChangedDisabled)
                        return;

                    if (f.Left == 0)
                        return;

                    if (f.Right == Native.window.Width)
                        return;

                    if (f.Capture)
                    {
                        if (AtCapture != null)
                            AtCapture();

                        return;
                    }


                    if (f.Left < SidebarIdleWidth)
                    {
                        if (c.checkBox1.Checked)
                        {
                            var fs = f.Size;

                            SetLeftSidebarWidth(f.ClientSize.Width);
                            f.MoveTo(0, 0);
                            f.SizeTo(f.ClientSize.Width, page.SidebarContainer.clientHeight);
                            f.MinimumSize = new System.Drawing.Size(SidebarIdleWidth, Native.window.Height);
                            f.MaximumSize = new System.Drawing.Size(Native.window.Width - page.RightSidebarContainer.clientWidth, Native.window.Height);


                            var done = false;
                            Action<IEvent> onresize =
                                delegate
                                {
                                    if (done)
                                        return;
                                    f.SizeTo(f.ClientSize.Width, page.SidebarContainer.clientHeight);
                                    f.MinimumSize = new System.Drawing.Size(SidebarIdleWidth, Native.window.Height);
                                    f.MaximumSize = new System.Drawing.Size(Native.window.Width - page.RightSidebarContainer.clientWidth, Native.window.Height);


                                };

                            Native.window.onresize += onresize;

                            AtCapture = delegate
                            {
                                done = true;

                                AtCapture = null;
                                f.MinimumSize = new System.Drawing.Size(100, 100);
                                f.SizeTo(fs.Width, fs.Height);
                            };
                        }
                    }
                    else if (f.Right > (Native.window.Width - SidebarIdleWidth))
                    {
                        if (c.checkBox2.Checked)
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:67,代码来源:Application.cs

示例7: Invoke


//.........这里部分代码省略.........


					that.InternalElement = (IHTMLIFrame)(object)webview;

					// src was not copied for some reason. force it.
					that.Size = that.Size;
					that.Refresh();

				};
				#endregion

				var css = Native.css[typeof(Form)][" .caption"];
				(css.style as dynamic).webkitAppRegion = "drag";


				// FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;

				// only if the host does alpha?
				var ShadowRightBottom = 8;

				#region Form
				var f = new Form
				{

					ShowIcon = false,

					Text = Native.document.title,

					//Text = Native.document.location.hash,
					StartPosition = FormStartPosition.Manual
				};


				f.MoveTo(0, 0).SizeTo(
						Native.window.Width - ShadowRightBottom,
						Native.window.Height - ShadowRightBottom
					);

				//f.Opacity = 0.5;

				f.Show();
				#endregion





				var w = new WebBrowser
				{

					// this wont work?
					//Dock = DockStyle.Fill

				}.AttachTo(f);

				w.Navigate(
					Native.document.title
				);


				f.FormClosing +=
					(sender, e) =>
					{
						// X:\jsc.svn\examples\javascript\chrome\apps\ChromeWebviewFullscreen\ChromeWebviewFullscreen\Application.cs
						if (chrome.app.window.current().isFullscreen())
						{
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:67,代码来源:Application.cs

示例8: a

            public a(IBeforeLogin ee)
            {
                //FormStyler.AtFormCreated = FormStyler.LikeVisualStudioMetro;
                //FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;

                var ff = new Form { FormBorderStyle = FormBorderStyle.None };


                var ScrollArea = new App().ScrollArea.AttachTo(ff.GetHTMLTargetContainer());



                //ScrollArea.style.backgroundColor = "#185D7B";
                //ScrollArea.style.backgroundColor = "#185D7B";
                ScrollArea.style.backgroundColor = "#105070";

                var SidebarWidth = 172;

                ff.MoveTo(SidebarWidth, 0);

                Action AtResize = delegate
                {

                    ff.SizeTo(Native.window.Width - SidebarWidth, Native.window.Height);
                };

                Native.window.onresize +=
                    delegate
                    {
                        AtResize();

                    };

                AtResize();
                var iii = global::CSSMinimizeFormToSidebar.ApplicationExtension.InitializeSidebarBehaviour(
                  ff,

                  // should be handle close instead!
                  HandleClosed: true,
                  HandleDragToLeft: false
                );

                iii.SidebarText.className = "AppPreviewText";
                //iii.SidebarText.innerText = "My Appz";
                //iii.SidebarText.innerText = "Synchronizing...";
                //var finish = iii.SidebarText.ToASCIIStyledLoadAnimation("My Appz");


                //Native.Document.body.style.backgroundColor = "#105070";
                Native.document.body.style.backgroundColor = "#185D7B";

                Native.window.onresize +=
                    delegate
                    {
                        // lets not centerize
                        //ff.Show();
                    };


                //var page = new App();

                //page.ScrollArea.AttachToDocument();

                var count = 0;

                var yield_BringToFront = false;

                var icon_throttle = 0;

                #region yield
                yield_ACTION_MAIN yield = (
                            packageName,
                            name,
                            __IsCoreAndroidWebServiceActivity,
                            label
                        ) =>
                {

                    if (string.IsNullOrEmpty(label))
                        label = packageName;

                    var IsCoreAndroidWebServiceActivity = System.Convert.ToBoolean(__IsCoreAndroidWebServiceActivity);

                    count++;

                    var a = new AppPreview();

                    #region icon
                    if (packageName != "foo")
                    {
                        // see also: X:\jsc.svn\examples\javascript\ImageCachedIntoLocalStorageExperiment\ImageCachedIntoLocalStorageExperiment\Application.cs

                        // extension to the system
                        // data.icon[packageName].With

                        Action loadicon = delegate
                        {
                            new ScriptCoreLib.JavaScript.Runtime.Timer(
                                delegate
                                {
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:Application.cs

示例9: Application

        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IApp page)
        {
            //content.AttachControlTo(page.Content);
            //content.AutoSizeControlTo(page.ContentSize);

            FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;

            // I want animated background!
            new WebGLClouds.Application();

            //Native.Document.body.lastChild.MoveNodeToFirst();

            var f = new Form();

            content.BackColor = Color.Transparent;
            content.Dock = DockStyle.Fill;
            content.AttachTo(f);

            f.Show();


            @"Hello world".ToDocumentTitle();
            // Send data from JavaScript to the server tier
            service.WebMethod2(
                @"A string from JavaScript.",
                value => value.ToDocumentTitle()
            );


            Action ResizeMargin = delegate
            {
                if (f.GetHTMLTarget().parentNode == null)
                    Native.Document.body.style.marginLeft = 16 + "px";
                else
                    Native.Document.body.style.marginLeft = (f.Width + 32) + "px";
            };

            Action AtResize = delegate
            {
                ResizeMargin();

                f.MoveTo(16, 16);
                f.SizeTo(
                    f.Width,
                    f.Height.Min(Native.window.Height - 32)
                );
            };

            // why this not working?
            //f.SizeChanged +=
            content.ClientSizeChanged +=
                delegate
                {
                    ResizeMargin();
                };


            //new ScriptCoreLib.JavaScript.Runtime.Timer(
            //    delegate
            //    {

            //    }
            //).StartInterval();

            Native.window.onresize +=
                delegate
                {
                    AtResize();
                };

            AtResize();


            f.PopupInsteadOfClosing(SpecialNoMovement: true);
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:79,代码来源:Application.cs


注:本文中的System.Windows.Forms.Form.SizeTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。