c#, codigos utiles y simples

(1/2) > >>

CrÄsH:
Hola, podrias poners codigos simples y utiles como estos:

  Código:

            Console.BackgroundColor = ConsoleColor.Green;
            Console.ForegroundColor = ConsoleColor.Black;
            Console.Clear();

tb...

Código:

\n


Por ejemplo, me gustaria saber como abrir y cerrar un programa, apagar el pc,como ejecutar comandos de msdos,..

gusman:
Aquí va una función para dibujar imágenes con un alpha definido por la aplicación:

Código
 
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
 
namespace DrGusman
{
 
   class AlphaRenderer
   {
 
       public static void DrawAlphaImage(Graphics Target,Rectangle TargetRectangle, Image Source, Rectangle SourceRectangle,float Alpha)
       {
 
           float[][] colorMatrixPoints = new float[][] {
 
               new float[]{1, 0, 0, 0, 0},
               new float[]{0, 1, 0, 0, 0},
               new float[]{0, 0, 1, 0, 0},
               new float[]{0, 0, 0, Alpha, 0},
               new float[]{0, 0, 0, 0, 1}
 
           };
 
           ColorMatrix cm = new ColorMatrix(colorMatrixPoints);
 
           ImageAttributes imgAttr = new ImageAttributes();
           imgAttr.SetColorMatrix(cm);
 
           Target.DrawImage(Source, TargetRectangle, SourceRectangle.X,
           SourceRectangle.Y, SourceRectangle.Width, SourceRectangle.Height,
           GraphicsUnit.Pixel, imgAttr);
 
           imgAttr.Dispose();
 
       }
 
   }
 
}
 
 

Si quieres ver más códigos útiles mira en mi web, www.drgusman.info.

Un saludo.

gusman:
Aquí dejo como ejecutar un programa:

Código
System.Diagnostics.Process.Start("archivo");

CrÄsH:
gusman no me deja ejecutar tu codigo me saltan errores en la linea de public static void.


I como es para ejecutar comandos msdos¿?¿

~~:
Wenas, hace no mucho deje un hilo de ejercicios basicos, mira:
http://foro.elhacker.net/index.php/topic,185614.0.html

Navegación

[0] Índice de Mensajes

[#] Página Siguiente