Skip to content

Instantly share code, notes, and snippets.

@RicardoACS
RicardoACS / PDF C#
Last active August 29, 2015 14:20
Crear PDF en C#
// Se crea el documento con el tamaño de página tradicional
Document doc = new Document(PageSize.LETTER);
// Indicamos donde vamos a guardar el documento
PdfWriter writer = PdfWriter.GetInstance(doc,
new FileStream(@"C:\nombreDoc.pdf", FileMode.Create));
// Se le coloca el título y el autor
// **Nota: Esto no será visible en el documento
doc.AddTitle("Mi primer PDF");
doc.AddCreator("Ricardo Carrasco S.-");
@RicardoACS
RicardoACS / App.config SQLServer
Created May 3, 2015 00:47
App.config SQLServer
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="connection" connectionString="Data Source=RICARDO-PC\SQLEXPRESS;Initial Catalog=graficos;Integrated Security=True"
providerName="System.Data.SqlClient" />
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
@RicardoACS
RicardoACS / App.Config SQLite
Last active August 29, 2015 14:20
App.Config SQLite
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="connection" connectionString="Data Source=|DataDirectory|NombreBD.db;Version=3;New=False;Compress=True;"
providerName="System.Data.SQLite" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
@RicardoACS
RicardoACS / ConexionSQLite.cs
Last active August 29, 2015 14:20
Clase Conexion DLL
//referencias
//System.configuration;
//System.Data.SQLite;
//System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
@RicardoACS
RicardoACS / Button
Created May 20, 2015 23:28
Crear Boton en WPF C#
<Button Content="Button" HorizontalAlignment="Left" Margin="35,219,0,0" VerticalAlignment="Top" Width="93" RenderTransformOrigin="0.471,0.432" Height="41">
<Button.Background>
<SolidColorBrush Color="Brown"/>
</Button.Background>
</Button>
@RicardoACS
RicardoACS / Boton con imagen
Created May 20, 2015 23:35
Crear Boton con imagen
<Button Margin="3">
<StackPanel>
<TextBlock Margin="3" Text="Texto del boton"></TextBlock>
<Image Source="C:\Users\Ricardo\Desktop\link.jpg" Stretch="None" Height="120"></Image>
</StackPanel>
</Button>
@RicardoACS
RicardoACS / Poligono Boton
Created May 20, 2015 23:46
Crear Poligono dentro de un boton
<Button Margin="3">
<Grid>
<Polygon Points="100,25 125,0 200,25 125, 50"
Fill="Blue"></Polygon>
<Polygon Points="100,25 75,0 0,25 75, 50"
Fill="White"></Polygon>
</Grid>
</Button>
@RicardoACS
RicardoACS / poligonos.cs
Created May 21, 2015 00:00
Poligonos, Elipses y lineas
<Canvas>
<Rectangle Fill="Blue" Stroke="Black" Canvas.Left="40"
Canvas.Top="40" Height="40" Width="40">
</Rectangle>
<Ellipse Fill="Green" Stroke="Blue" StrokeThickness="2"
Canvas.Left="60" Canvas.Top="120" Height="55" Width="55">
</Ellipse>
<Path Stroke="DarkBlue" StrokeThickness="3">
<Path.Data>
@RicardoACS
RicardoACS / juegoAvion.cpp
Created May 25, 2015 02:47
Juego de avion C++
#include <stdio.h>
#include <Windows.h>
#include <conio.h>
#include <stdlib.h>
#include <list>
#include <mmsystem.h>
using namespace std;
#define ARRIBA 72
#define IZQUIERDA 75
@RicardoACS
RicardoACS / validarRut.cs
Created June 19, 2015 23:14
Validar Rut Chile
public bool validarRut(string rut ) {
bool validacion = false;
try
{
rut = rut.ToUpper();
rut = rut.Replace(".", "");
rut = rut.Replace("-", "");
int rutAux = int.Parse(rut.Substring(0, rut.Length - 1));
char dv = char.Parse(rut.Substring(rut.Length - 1, 1));