Skip to content

Instantly share code, notes, and snippets.

View Willy-Kimura's full-sized avatar
🎯
Building front-end experiences

Willy Kimura Willy-Kimura

🎯
Building front-end experiences
View GitHub Profile
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
namespace ICTest
{
// Destination object for touch/mouse/pen gestures.
@Willy-Kimura
Willy-Kimura / gist:d3d3541dee057c583f39005b25df65c8
Created May 15, 2019 17:09 — forked from darkfall/gist:1656050
A simple class that converts a image to a icon in c# without losing image color data, unlike System.Drawing.Icon; ico with png data requires Windows Vista or above
class PngIconConverter
{
/* input image with width = height is suggested to get the best result */
/* png support in icon was introduced in Windows Vista */
public static bool Convert(System.IO.Stream input_stream, System.IO.Stream output_stream, int size, bool keep_aspect_ratio = false)
{
System.Drawing.Bitmap input_bit = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromStream(input_stream);
if (input_bit != null)
{
int width, height;
@Willy-Kimura
Willy-Kimura / Events.cs
Created February 2, 2018 13:34
Events designed to modify the Form's cursor at movements during runtime.
using System;
using System.Windows.Forms;
namespace BunifuDragForm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
@Willy-Kimura
Willy-Kimura / Events.vb
Last active February 2, 2018 13:26
Events designed to modify the Form's cursor at movements during runtime.
Imports System
Imports System.Windows.Forms
Namespace BunifuDragForm
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
@Willy-Kimura
Willy-Kimura / MoveTabIndicator.cs
Created December 8, 2017 12:54
This moves our "Tabs" indicator to the position of the control clicked.
private void TabsClicked(Object sender, EventArgs e) {
// This will firstly off reset the colors of the two Tab labels to the default inactive color.
BunifuCustomLabel1.ForeColor = Color.FromArgb(136, 144, 157);
BunifuCustomLabel2.ForeColor = Color.FromArgb(136, 144, 157);
// This will then set the location of the Tab indicator based on the currently clicked BunifuCustomLabel location (X coordinate).
tab_indicator.Location = New Point(CType(sender, Bunifu.Framework.UI.BunifuCustomLabel).Location.X, tab_indicator.Location.Y);
// Thereafter, we can set the width of the tab inidicator to fit the width of the BunifuCustomLabel clicked. (This is however optional)
@Willy-Kimura
Willy-Kimura / MoveTabIndicator.vb
Created December 8, 2017 12:44
This moves our "Tabs" indicator to the position of the control clicked.
Private Sub BunifuCustomLabels_Click(sender As Object, e As EventArgs) Handles BunifuCustomLabel12.Click, BunifuCustomLabel11.Click
' This will firstly off reset the colors of the two Tab labels to the default inactive color.
BunifuCustomLabel11.ForeColor = Color.FromArgb(136, 144, 157)
BunifuCustomLabel12.ForeColor = Color.FromArgb(136, 144, 157)
' This will then set the location of the Tab indicator based on the currently clicked BunifuCustomLabel location (X coordinate).
tab_indicator.Location = New Point(CType(sender, Bunifu.Framework.UI.BunifuCustomLabel).Location.X, tab_indicator.Location.Y)
' Thereafter, we can set the width of the tab inidicator to fit the width of the BunifuCustomLabel clicked. (This is however optional)
@Willy-Kimura
Willy-Kimura / VerificationProcess.cs
Last active December 8, 2017 11:55
This assists us in managing all the five steps in the Dashboard's verification process.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Verifications
@Willy-Kimura
Willy-Kimura / VerificationProcess.vb
Created December 8, 2017 08:53
This assists us in managing all the five steps in the Dashboard's verification process.
' This library provides us with handy features for designing our control effectively.
Imports System.ComponentModel
Public Class VerificationProcess
' This contains an enumerable list of the verification steps to undergo.
Public Enum VerificationSteps
None
First
@Willy-Kimura
Willy-Kimura / Load.cs
Created November 21, 2017 11:30
Dashboard's form-loading event.
private void Dashboard_Load(object sender, EventArgs e)
{
// Add custom colors to our Area and Line charts.
BunifuDataViz1.colorSet.Add(Color.FromArgb(76, 131, 115));
BunifuDataViz1.colorSet.Add(Color.FromArgb(116, 231, 148));
// Add custom colors to our Doughnut chart.
BunifuDataViz2.colorSet.Add(Color.FromArgb(85, 159, 127));
BunifuDataViz2.colorSet.Add(Color.FromArgb(70, 118, 126));
@Willy-Kimura
Willy-Kimura / Load.vb
Created November 21, 2017 11:27
Dashboard's form-loading event.
Private Sub Dashboard_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Add custom colors to our Area and Line charts.
BunifuDataViz1.colorSet.Add(Color.FromArgb(76, 131, 115))
BunifuDataViz1.colorSet.Add(Color.FromArgb(116, 231, 148))
' Add custom colors to our Doughnut chart.
BunifuDataViz2.colorSet.Add(Color.FromArgb(85, 159, 127))
BunifuDataViz2.colorSet.Add(Color.FromArgb(70, 118, 126))
BunifuDataViz2.colorSet.Add(Color.FromArgb(123, 197, 222))