Skip to content

Instantly share code, notes, and snippets.

View vereperrot's full-sized avatar
😀
Out sick

vere perrot vereperrot

😀
Out sick
View GitHub Profile
private void button1_Click(object sender, System.EventArgs e) {
// Takes the selected text from a text box and puts it on the clipboard.
if(textBox1.SelectedText != "")
Clipboard.SetDataObject(textBox1.SelectedText);
else
textBox2.Text = "No text selected in textBox1";
}
private void button2_Click(object sender, System.EventArgs e) {
// Declares an IDataObject to hold the data returned from the clipboard.
@vereperrot
vereperrot / 0_reuse_code.js
Created November 25, 2015 10:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
function getSelectionText() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
}
return text;
<html>
<head>
<!-- For ease i'm just using a JQuery version hosted by JQuery- you can download any version and link to it locally -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
var refreshId = setInterval(function() {
location.reload();
}, 1000);
$.ajaxSetup({ cache: false });
<h1>My Gists</h1>
<ul id="list"></ul>
using System.Runtime.InteropServices
public const int TVIF_STATE = 0x8;
public const int TVIS_STATEIMAGEMASK = 0xF000;
public const int TV_FIRST= 0x1100;
public const int TVM_SETITEM = TV_FIRST + 63;
public struct TVITEM
{
public int mask;
class Program
{
static void Main(string[] args)
{
var dictionary = new Dictionary<string, int>()
{
{"1", 1}, {"2", 2}, {"3", 3}
};
string[] keyArray = new string[dictionary.Keys.Count];
* Download the ObjectListView project
* Add the ObjectListView project to your project (right click on your solution; choose “Add...”, “Existing Project”, then choose the ObjectListView.csproj)
* In your project, add a reference to the ObjectListView project (right click on your project; choose “Add Reference...”, choose “Projects” tab; then double click on the ObjectListView project)
* there should now be a new section in your Toolbox, “ObjectListView Components”. In that section should be ObjectListView and its friends. (If you are using SharpDevelop, the section is called “Custom Components” and it appears at the bottom of the toolbox.) You can then drag an ObjectListView onto your window, and use it as you would a standard ListView control.
* add reference to your code
using System.Collections;
using BrightIdeasSoftware;
* sample code
// let the OLV know that a person node can expand
Set auto will reorder the sub item,So don't set the width of column as auto.
You can set the column width as a fixed width, like column.width=120 .