Skip to content

Instantly share code, notes, and snippets.

Sach sachintha81

Block or report user

Report or block sachintha81

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sachintha81
sachintha81 / ExtendedDisplay.cpp
Last active Jan 13, 2017
Set Display Settings to EXTEND mode in Windows 7 using C++
View ExtendedDisplay.cpp
public void main(int argc, char const *argv[])
{
// To identify the current configuration:
UINT32 PathArraySize = 0;
UINT32 ModeArraySize = 0;
DISPLAYCONFIG_PATH_INFO* PathArray;
DISPLAYCONFIG_MODE_INFO* ModeArray;
DISPLAYCONFIG_TOPOLOGY_ID CurrentTopology;
@sachintha81
sachintha81 / CustomControl.cs
Last active Jan 13, 2017
Drawing a Custom Control on C# WinForms
View CustomControl.cs
using System;
using System.Drawing;
using System.Windows.Forms;
namespace CustomControls
{
public class NodeControl : Control
{
private Graphics G = null;
@sachintha81
sachintha81 / ExtractSubstring.cs
Created Jan 13, 2017
WPF + C# Extract a Substring from a String between two specified Parts
View ExtractSubstring.cs
using System;
using System.Collections.Generic;
using System.Windows;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows.Input;
using System.Xml.Linq;
namespace StringProgram
@sachintha81
sachintha81 / ValidateXMLUsingSchema.cs
Created Jan 13, 2017
C# Validating XML using Schemas
View ValidateXMLUsingSchema.cs
using System;
using System.IO;
using System.Xml.Linq;
using System.Xml.Schema;
namespace XmlValidation
{
class Program
{
static void Main(string[] args)
@sachintha81
sachintha81 / ReadInto2DArray.c
Created Jan 13, 2017
Reading a Text File into a 2D Array in C
View ReadInto2DArray.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
// Allocate memory for the array like this:
int** array;
array = malloc(n * sizeof(*array)); /* Assuming `n` is the number of rows */
@sachintha81
sachintha81 / MaskTextbox.cs
Created Jan 13, 2017
WPF TextBox Input Restrictions
View MaskTextbox.cs
/// <summary>
/// Provides masking behavior for any TextBox
/// </summary>
public static class Masking
{
private static readonly DependencyPropertyKey _maskExpressionPropertyKey = DependencyProperty.RegisterAttachedReadOnly(""MaskExpression"",
typeof(Regex),
typeof(Masking),
new FrameworkPropertyMetadata());
@sachintha81
sachintha81 / AllCombinations.cs
Created Jan 13, 2017
All Possible Combinations of a list of Values
View AllCombinations.cs
namespace Combinations
{
public class Combinations
{
public static void Main(string[] args)
{
GetCombination(new List<int> { 1, 2, 3 });
}
public static void GetCombination(List<int> list)
@sachintha81
sachintha81 / DynamicallySetDGRows.cs
Created Jan 13, 2017
WPF Dynamically Setting number of Rows/Columns in a Grid Control
View DynamicallySetDGRows.cs
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace PrisonersDilemma.Utility
{
/// <summary>
/// Taken from: https://rachel53461.wordpress.com/2011/09/17/wpf-grids-rowcolumn-count-properties/
/// </summary>
public class GridHelpers
@sachintha81
sachintha81 / WPFMessengerClass.cs
Created Jan 13, 2017
Messenger Class for the WPF + MVVM Pattern
View WPFMessengerClass.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MVVMMessenger
{
public class Messenger
@sachintha81
sachintha81 / MoveListViewItems.cs
Created Jan 13, 2017
WPF + C# Move Multiple Items from one ListView to Another
View MoveListViewItems.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace ListViewOperations.SOURCE.GUI
{
public partial class ListViewOperations : Window
{
You can’t perform that action at this time.