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


C# DataGridView.AttachControlToDocument方法代码示例

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


在下文中一共展示了DataGridView.AttachControlToDocument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
        {
            Action getData = async delegate
            {
                var dt = await GetDataTable();
                var dg = new DataGridView ();
                dg.DataSourceChanged += delegate
                {
                    Console.WriteLine(new { DataSourceChangedEvent = "Inside Datagridsource changed" });
                    //foreach (var i in dg.Columns)
                    //{
                    //    Console.WriteLine(new { i });
                    //}
                    dg.Columns["Foo"].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;

                        Console.WriteLine(dg.Columns["Foo"].Width.ToString());
                        dg.Columns["Foo"].Width = 0;

                   
                };
                dg.AttachControlToDocument();
                dg.DataSource = dt;
                dg.DataMember = "Sheet1";
                
                
            };
            getData();
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:32,代码来源:Application.cs

示例2: AttachDataGridViewToDocument

        public static async Task<DataGridView> AttachDataGridViewToDocument(this Task<DataTable> data)
        {
            // tested by
            // X:\jsc.svn\examples\javascript\appengine\DataGridWithHeaders\DataGridWithHeaders\Application.cs

            var x = await data;

            var grid = new DataGridView();


            grid.DataSource = x;

            grid.AttachControlToDocument();

            Native.document.title = x.TableName;

            return grid;
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:18,代码来源:AsyncDataGridViewExtensions.cs

示例3: 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)
        {
            //var z = ScriptCoreLib.Shared.Drawing.Color.FromKnownName(
            //        "rgba(" + 255 + ", " + 0 + ", " + 0 + ", " + (127 / 255.0) + ")"
            //    );

            //var x = Color.FromArgb(0x10, 255, 255, 0);

            //Console.WriteLine(
            //    new { z, x }
            //    );

            //Native.document.body.style.backgroundColor = x.ToString();


            var data = Book1.GetDataSet();

            // X:\jsc.svn\examples\javascript\WebGL\WebGLGoldDropletTransactions\WebGLGoldDropletTransactions\Application.cs
            var g = new DataGridView
            {
                BackgroundColor = Color.Transparent,


                // does this work?
                DefaultCellStyle = new DataGridViewCellStyle
                {

                    SelectionBackColor = Color.Black,
                    SelectionForeColor = Color.Yellow,


                    //BackColor = Color.Transparent
                    BackColor = Color.FromArgb(0x05, 0, 0, 0)
                },

                ColumnHeadersDefaultCellStyle = new DataGridViewCellStyle
                {
                    //BackColor = Color.Yellow,
                    BackColor = Color.FromArgb(0x7f, 255, 255, 255),
                    ForeColor = Color.Black
                },

                RowHeadersDefaultCellStyle = new DataGridViewCellStyle
                {
                    //BackColor = Color.Yellow,
                    BackColor = Color.FromArgb(0x7f, 255, 255, 255),
                    ForeColor = Color.Black
                },


                GridColor = Color.FromArgb(0x7f, 0, 0, 0),

                SelectionMode = DataGridViewSelectionMode.FullRowSelect,
                AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,

                // do we have a test for this?
                AllowUserToAddRows = false,

                //AllowUserToDeleteRows = false,

                //RowHeadersVisible = false,


                // cannot hide column headers yet
                // script: error JSC1000: No implementation found for this native method, please implement [System.Windows.Forms.DataGridView.set_ColumnHeadersVisible(System.Boolean)]
                //ColumnHeadersVisible = false,

                DataSource = data,
                DataMember = "Assets",
            };


            g.AttachControlToDocument();


            (g.Parent as Form).GetHTMLTarget().style.margin = "3em";

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


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