tag:blogger.com,1999:blog-1823047306722101134.post6030535571366542079..comments2022-04-28T15:00:09.362-05:00Comments on Spyglass' Ramblings: Tutorial: Using .NET GUI Widgets in PowerShellGlen Mark Martinhttp://www.blogger.com/profile/06592122769805439088noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-1823047306722101134.post-57318704960227508542010-04-17T00:47:39.248-05:002010-04-17T00:47:39.248-05:00================================================
...================================================<br /><br><br /><i>Hi the picture i would like to show are below:</i><br /><br><br />I didn't add the entire Columns So,<br /><br><br />When the form is load for the first time its look like below<br /><br><br /><a href="http://lh4.ggpht.com/_C61pFyD-p7M/S8ZWUSaoOHI/AAAAAAAAAIU/oxNL3Xq6NRM/001.jpg" rel="nofollow">Click here for the picture.</a><br /><br><br />This how the form look like after it's pull information.<br /><br><br />I know it's agley but I want to make a point.<br /><br><br /><a href="http://lh4.ggpht.com/_C61pFyD-p7M/S8ZWUwgyDWI/AAAAAAAAAIc/FQsfl6keug0/s512/002.jpg" rel="nofollow">Click here for the picture.</a><br /><br><br /><br /><i><b>from - Doron Zilber</b></i><br />=============================================D/..\Zhttps://www.blogger.com/profile/00732290548408999831noreply@blogger.comtag:blogger.com,1999:blog-1823047306722101134.post-12763468642961028532010-04-14T19:57:08.203-05:002010-04-14T19:57:08.203-05:00# 2 Column
$myDGTB_2 = New-Object System.Windows.F...<b><br /><br># 2 Column<br /><br>$myDGTB_2 = New-Object System.Windows.Forms.DataGridViewTextBoxColumn<br /><br>$myDGTB_2.MaxInputLength = 160<br /><br>$myDGTB_2.AutoSizeMode = 6 <br /><br>$myDGTB_2.DataPropertyName = "Account" # <== Connection<br /><br>$myDGTB_2.DividerWidth = 1<br /><br>$myDGTB_2.HeaderText = "Account"<br /><br>$myDGTB_2.MinimumWidth = 50<br /><br>$myDGTB_2.Name = "10"<br /><br>$myDGTB_2.ToolTipText = "Doron Zilber and Sigal"<br /><br>$myDGTB_2.Width = 140<br /><br> <br /><br>$myDGTB_2_Style = New-Object System.Windows.Forms.DataGridViewCellStyle<br /><br>$myDGTB_2_Style.Format = "N0" # "d" #N2<br /><br>$myDGTB_2_Style.WrapMode = 2<br /><br>$myDGTB_2_Style.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",14,2,3,177)<br /><br>$myDGTB_2_Style.ForeColor = "Red"<br /><br>$myDGTB_2_Style.BackColor = "yellow"<br /><br>$myDGTB_2.DefaultCellStyle = $myDGTB_2_Style<br /><br><br /><br>$myDataGrid2.Columns.Add($myDGTB_2) <br /><br><br /><br># 3 Column<br /><br>$myDGTB_3 = New-Object System.Windows.Forms.DataGridViewTextBoxColumn<br /><br>$myDGTB_3.DataPropertyName = "Prohibit Send Quota (MB)" # <== Connection<br /><br>$myDGTB_3.HeaderText = "Prohibit Send Quota (MB)"<br /><br>$myDGTB_3.Width = 30<br /><br>$myDataGrid2.Columns.Add($myDGTB_3) <br /><br># Costume Column<br /><br><br /><br>$mbTable.Columns.Add("Display Name")<br /><br>$mbTable.Columns.Add("Account")<br /><br><br /><br># Add Data Grid View for mailboxes<br /><br><br /><br># $myDataGrid2 = new-object System.windows.forms.DataGridView<br /><br>$myDataGrid2.Location = new-object System.Drawing.Size(480,60)<br /><br>$myDataGrid2.size = new-object System.Drawing.Size(500,500)<br /><br>$myDataGrid2.AllowUserToAddRows = $False<br /><br># $myDataGrid2.AutoSizeColumnsMode = [System.Windows.Forms.DataGridViewAutoSizeColumnsMode]::Fill<br /><br># $myDataGrid2.RowsDefaultCellStyle.BackColor = [System.Drawing.Color]::Bisque<br /><br># $myDataGrid2.AlternatingRowsDefaultCellStyle.BackColor = [System.Drawing.Color]::Beige<br /><br>$myDataGrid2.BorderStyle = [System.Windows.Forms.BorderStyle]::Fixed3D<br /><br>$myDataGrid2.ColumnHeadersDefaultCellSTyle.ForeColor = [System.Drawing.Color]::Maroon<br /><br><br /><br>I hope that it will be some help to some one <br /><br></b><br /># :: # End Part tree By Doron ZilberD/..\Zhttps://www.blogger.com/profile/00732290548408999831noreply@blogger.comtag:blogger.com,1999:blog-1823047306722101134.post-4645778751108053272010-04-14T19:55:17.853-05:002010-04-14T19:55:17.853-05:00The Code:
$mbTable.TableName = "Mailboxes&quo...<b><br />The Code:<br><br />$mbTable.TableName = "Mailboxes"<br><br /><br># Costume Column <br /><br># Move from Section -- Add Data Grid View for mailboxes<br /><br>$myDataGrid2 = new-object System.windows.forms.DataGridView <br /><br># Column 1<br /><br>$myDGTB_1 = New-Object System.Windows.Forms.DataGridViewTextBoxColumn<br /><br>$myDGTB_1.MaxInputLength = 160<br /><br># $myDGTB_1.AutoSizeMode = 6<br /></b><i><br /><br>. . . Column Header = 2<br /><br>. . . All Cells Except Headr = 4<br /><br>. . . All Cells = 6<br /><br>. . . Displayed Cells Except Header = 8<br /><br>. . . Displayed Cells = 10<br /><br>. . . Fill = 16<br /></i><b><br /><br>$myDGTB_1.DataPropertyName = "Display name" <i># <== Connection Shuld Be with the same name as Column Name</i><br /><br>$myDGTB_1.DividerWidth = 1<br /><br>$myDGTB_1.HeaderText = "Display Name"<br /><br>$myDGTB_1.MinimumWidth = 50<br /><br>$myDGTB_1.Name = "10"<br /><br>$myDGTB_1.ToolTipText = "This is The Display Name Column"<br /><br>$myDGTB_1.Width = 140<br /><br><br /><br># Colum 1 View Style<br /><br>$myDGTB_1_Style = New-Object System.Windows.Forms.DataGridViewCellStyle<br /><br>$myDGTB_1_Style.Format = "N0"<br /></b><i><br /><br>. . . Numbers = N2 - 1,000.22 , N0 1,000<br /><br>. . . Date = dd/mm/yy "d" <br /><br>. . . Date = D ,f ,d<br /></i><b><br /><br>$myDGTB_1_Style.WrapMode = 2 <br /></b><i><br /><br>. . . flase = 1<br /><br>. . . true = 2<br /></i><b><br /><br>$myDGTB_1_Style.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",14,0,3,177)<br /><br>$myDGTB_1_Style.ForeColor = "Red"<br /><br>$myDGTB_1_Style.BackColor = "yellow"<br /><br>$myDGTB_1_Style.SelectionBackColor = "Green"<br /><br>$myDGTB_1.DefaultCellStyle = $myDGTB_1_Style<br /><br><br /><br>$myDataGrid2.Columns.Add($myDGTB_1) <br /><br><br /><br></b><br /># :: # End Part tow By Doron ZilberD/..\Zhttps://www.blogger.com/profile/00732290548408999831noreply@blogger.comtag:blogger.com,1999:blog-1823047306722101134.post-8173319290244015522010-04-14T19:52:23.499-05:002010-04-14T19:52:23.499-05:00I would like to have set the FillWeight properties...<i>I would like to have set the FillWeight properties on each column so that less space is occupied by the "Store Size(MB)" column,<br><br />but I have been unable to determine the proper syntax for doing so within PowerShell<br></i><br><br />This post really helps me with the understanding of how to crate winform Application with powershell,<br><br />and boost my ability - So Glan wish is my Demand .<br><br />You have to Add the line Blow & to comma out some line ,I give almost full option you don’t have to use all of them ,<br><br />look at Column 3 for minimum requirement.<br><br />'DataPropertyName' Should be with the same name as '$mbTable.Columns.Add()' This is the Connection between the Column Data & The Column style.<br><br />When you use Column Style you must disable Defaults Row Styles.<br><br />See Cell Styles in the Windows Forms DataGridView Control <a href="http://msdn.microsoft.com/en-us/library/1yef90x0.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/1yef90x0.aspx</a>)<br><br />I didnot add the entire Columns So,When the form is load for the first time its look like below<br><br />I limit the width of column 'Prohibit Send..' to 30.<br><br /><a href="http://lh4.ggpht.com/_C61pFyD-p7M/S8ZWUSaoOHI/AAAAAAAAAIU/oxNL3Xq6NRM/s144/001.jpg" rel="nofollow"><br />Click on the link to view the picture</a><br><br />This how the form look like after it's pull information. I know it's agley but I want to make a point.<br><br /><a href="http://lh4.ggpht.com/_C61pFyD-p7M/S8ZWUwgyDWI/AAAAAAAAAIc/FQsfl6keug0/s144/002.jpg" rel="nofollow"><br />Click on the link to view the picture</a><br><br /><br /># :: # End Part one By Doron ZilberD/..\Zhttps://www.blogger.com/profile/00732290548408999831noreply@blogger.comtag:blogger.com,1999:blog-1823047306722101134.post-81862066835156123212009-09-15T14:08:13.171-05:002009-09-15T14:08:13.171-05:00Glad it helped. Be sure to check out Glen Scales&...Glad it helped. Be sure to check out Glen Scales' blog (the link is in the article). He has many more examples.Glen Mark Martinhttps://www.blogger.com/profile/06592122769805439088noreply@blogger.comtag:blogger.com,1999:blog-1823047306722101134.post-75095591807551027602009-09-13T16:27:29.613-05:002009-09-13T16:27:29.613-05:00Excellent! Thanks for this - I have been strugglin...Excellent! Thanks for this - I have been struggling with the syntax for some of the windows forms bits and this helped clear things up.Unknownhttps://www.blogger.com/profile/11845227707271625173noreply@blogger.com