Search found 13286 matches

by jvierra
Mon Mar 18, 2019 1:28 pm
Forum: PowerShell GUIs
Topic: RichTextBox: Adding dynamically-generated picture to existing content
Replies: 23
Views: 267

Re: RichTextBox: Adding dynamically-generated picture to existing content

The code you posted is titled "How do I backup and restore the system clipboard in C#?" It has nothing to do with adding an image to the clipboard and pasting it into a control. Also note that none of the answers were marked as correct because the code does not work in C#. The last guess on the page...
by jvierra
Mon Mar 18, 2019 1:22 pm
Forum: PowerShell GUIs
Topic: RichTextBox: Adding dynamically-generated picture to existing content
Replies: 23
Views: 267

Re: RichTextBox: Adding dynamically-generated picture to existing content

That is not what you want to do. Just copy the image to the clipboard and paste it into the control. It takes two steps. Copy then paste. The rest of that has nothing to do with what you are trying to do. And yes, I am fully aware of how to copy and restore the clipboard formats in C/C++/C# and VB. ...
by jvierra
Mon Mar 18, 2019 12:55 pm
Forum: PowerShell GUIs
Topic: RichTextBox: Adding dynamically-generated picture to existing content
Replies: 23
Views: 267

Re: RichTextBox: Adding dynamically-generated picture to existing content

You also must add the "Dispose()" or the file will remain open.
by jvierra
Mon Mar 18, 2019 12:52 pm
Forum: PowerShell GUIs
Topic: RichTextBox: Adding dynamically-generated picture to existing content
Replies: 23
Views: 267

Re: RichTextBox: Adding dynamically-generated picture to existing content

Most of the code you posted is unnecessary. You are trying to add every format to the clipboard but have not really added anything. Just do this: [System.Windows.Forms.Clipboard]::SetImage([System.Drawing.Image]::FromFile("$ScriptDirectory/barcode.png")) $richTextBox2.Select($richTextBox2.Text.Lengt...
by jvierra
Mon Mar 18, 2019 8:47 am
Forum: PowerShell GUIs
Topic: RichTextBox: Adding dynamically-generated picture to existing content
Replies: 23
Views: 267

Re: RichTextBox: Adding dynamically-generated picture to existing content

Here is the version with resizing example:

The hard part is learning how to calculate the image size based on the document, text and size desired.
by jvierra
Mon Mar 18, 2019 7:28 am
Forum: PowerShell GUIs
Topic: RichTextBox: Adding dynamically-generated picture to existing content
Replies: 23
Views: 267

Re: RichTextBox: Adding dynamically-generated picture to existing content

Here is the code snippet. It places the text after the currently inserted text. $button1_Click={ $f = 'd:\Epson\IM_A0037.JPG' $image = [System.Drawing.Bitmap]::FromFile($f) [System.Windows.Forms.Clipboard]::SetImage($image) $richtextbox1.Select($richtextbox1.TextLength,0) $richtextbox1.Paste() $imag...
by jvierra
Mon Mar 18, 2019 7:25 am
Forum: PowerShell GUIs
Topic: RichTextBox: Adding dynamically-generated picture to existing content
Replies: 23
Views: 267

Re: RichTextBox: Adding dynamically-generated picture to existing content

Nice Max. Here is what we decided on I think: https://social.technet.microsoft.com/Forums/en-US/b18c87d1-fe7e-4970-bd06-d37c4027ab56/rich-text-box-how-to-add-picture?forum=winserverpowershell It is similar but much easier. Sizing the picture takes a few more lines (~10). The code in the link can be ...
by jvierra
Mon Mar 18, 2019 6:58 am
Forum: Windows PowerShell
Topic: Creating a Kerberos or NTLM logon to an Active Directory Domain Controller at will.
Replies: 7
Views: 265

Re: Creating a Kerberos or NTLM logon to an Active Directory Domain Controller at will.

Please also understand that "ValidateCredentials" does NOT create a login session. The only login that is used is the user account executing the call. There is no create session for AD. Sessions are validated via the TKT that a user obtains when logging into Windows. All authentication is don by Win...
by jvierra
Mon Mar 18, 2019 6:25 am
Forum: Windows PowerShell
Topic: Creating a Kerberos or NTLM logon to an Active Directory Domain Controller at will.
Replies: 7
Views: 265

Re: Creating a Kerberos or NTLM logon to an Active Directory Domain Controller at will.

Using alternate credentials is the same as remoting. You are asking the remote system to authenticate for you using a different account. There will be no TKT in your session. It will only exists during the remote connection in the remote session. To use the Account Management classes we would do thi...
by jvierra
Fri Mar 15, 2019 3:01 pm
Forum: PowerShell GUIs
Topic: PictureBox Timer
Replies: 8
Views: 195

Re: PictureBox Timer

You can also just add an elapsed time timer at any time in the form. On load or a button click. $form1_Load={ $timer = [System.Timers.Timer]::New(16000) $timer.AutoReset = $false $timer.SynchronizingObject = $form1 $timer.add_Elapsed({ Write-Host 'Done!' }) $timer.Start() }