begin process at 2012 02 12 16:16:35
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Control

 > ENCORE UNE FORM AEROGLASS SANS API AVEC EFFET FLOU

ENCORE UNE FORM AEROGLASS SANS API AVEC EFFET FLOU


 Information sur la source

Note :
Aucune note
Catégorie :Control Source .NET ( DotNet ) Classé sous :aeroglass, control, form, transparente Niveau :Débutant Date de création :05/12/2006 Vu / téléchargé :7 836 / 1 174

Auteur : nicolas99

Ecrire un message privé
Commentaire sur cette source (7)
Ajouter un commentaire et/ou une note

 Description

Cliquez pour voir la capture en taille normale
Voila c'est un composant à glisser dans une form pour la transformer en aeroglass.
le code est en pure .net et j' ai utiliser la classe filtre ecrite en csharp trouvé sur le site code projet sous le nom csharpfilters pour les effets de flou,eau... cette classe est aussi en pure .net biensur. Ce code est beaucoup moins gourmand en ressource memoire que ce que j'ai pu trouver sur la toile.
L'idee generale ici n' est pas de rendre la form transparente, mais de copier la partie de l'ecran dessous la form la traiter puis la desinner sur la form. Toutefois la form doit quand meme etre transparente pour que la form elle meme n'appaisse pas pendant l'execution de la fonction CopyFromScreen.

Voila testez, notez, commentez.



 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

Source avec Zip Source .NET (Dotnet) UNE FENÊTRE PARENT POUR GIMP2-2
Source avec Zip Source avec une capture Source .NET (Dotnet) COURBE 2D SANS MSCHART

 Sources de la même categorie

Source avec Zip COMMUNICATION MODBUS MASTER par sergelapointe
Source avec Zip Source avec une capture DÉPLACEMENT AVEC FLÈCHES DANS UN PAVÉ DE TEXTBOX 9X9 DYNAMIQ... par EhJoe
Source avec Zip Source avec une capture Source .NET (Dotnet) CONTROLSTARS EN RÉPONSE À JAKNIGHT007 par bigboss9
Source avec Zip Source avec une capture Source .NET (Dotnet) CALENDRIER ANNUEL NORME ISO par Prog1001
Source avec Zip Source avec une capture Source .NET (Dotnet) CONTROLE STARS par jaknight007

 Sources en rapport avec celle ci

Source avec Zip Source avec une capture Source .NET (Dotnet) METTRE VOTRE FORM VB.NET EN PLEINE ÉCRAN par Gabilach
Source avec Zip Source avec une capture Source .NET (Dotnet) CRÉATION DE FORM ET DE CONTRÔLES par gillardg
Source avec Zip Source avec une capture Source .NET (Dotnet) AFFICHER DES BOUTONS DYNAMIQUEMENT SUR VOTRE FORM par ManuAntibes
COBJ - RETOURNE L'OBJET À PARTIR D'UN STRING par frank150
Source avec Zip Source avec une capture FORM TRANSPARENTE par joshrbz

Commentaires et avis

Commentaire de OneHacker le 06/12/2006 13:22:04

Tu oublies de préciser qu'il s'agit d'une source .NET 2 !

Commentaire de cacalex le 06/12/2006 15:50:28

Wow...

Un peu lent/flou sur déplacement de la fenêtre, mais wow quand même :)

Commentaire de bibelebons le 10/12/2006 02:23:35

C'est vrai que l'interface graphique est bien même si parfois la transparence se voit ralentir. Par contre j'aimerai savoir ce que contient la DLL "Filtre.dll"

Commentaire de nicolas99 le 10/12/2006 23:07:12

Salut BIBELEBONS comme je l'ai dit plus haut c'est une classe C# pris sur le site code project, je n'ai pas reussi a la traduire en vbnet.
voila je mes le contenu de la classe ci dessous .

using System;
using System.Drawing;
using System.Drawing.Imaging;

namespace CSharpFilters
{
public class ConvMatrix
{
public int TopLeft = 0, TopMid = 0, TopRight = 0;
public int MidLeft = 0, Pixel = 1, MidRight = 0;
public int BottomLeft = 0, BottomMid = 0, BottomRight = 0;
public int Factor = 1;
public int Offset = 0;
public void SetAll(int nVal)
{
TopLeft = TopMid = TopRight = MidLeft = Pixel = MidRight = BottomLeft = BottomMid = BottomRight = nVal;
}
}


public class BitmapFilter
{
public static bool Invert(Bitmap b)
{
// GDI+ still lies to us - the return format is BGR, NOT RGB.
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;

unsafe
{
byte * p = (byte *)(void *)Scan0;

int nOffset = stride - b.Width*3;
int nWidth = b.Width * 3;

for(int y=0;y<b.Height;++y)
{
for(int x=0; x < nWidth; ++x )
{
p[0] = (byte)(255-p[0]);
++p;
}
p += nOffset;
}
}

b.UnlockBits(bmData);
          
return true;
}

public static bool GrayScale(Bitmap b)
{
// GDI+ still lies to us - the return format is BGR, NOT RGB.
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;

unsafe
{
byte * p = (byte *)(void *)Scan0;

int nOffset = stride - b.Width*3;

byte red, green, blue;

for(int y=0;y<b.Height;++y)
{
for(int x=0; x < b.Width; ++x )
{
blue = p[0];
green = p[1];
red = p[2];

p[0] = p[1] = p[2] = (byte)(.299 * red + .587 * green + .114 * blue);

p += 3;
}
p += nOffset;
}
}

b.UnlockBits(bmData);

return true;
}

public static bool Brightness(Bitmap b, int nBrightness)
{
if (nBrightness < -255 || nBrightness > 255)
return false;

// GDI+ still lies to us - the return format is BGR, NOT RGB.
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;

int nVal = 0;

unsafe
{
byte * p = (byte *)(void *)Scan0;

int nOffset = stride - b.Width*3;
int nWidth = b.Width * 3;

for(int y=0;y<b.Height;++y)
{
for(int x=0; x < nWidth; ++x )
{
nVal = (int) (p[0] + nBrightness);

if (nVal < 0) nVal = 0;
if (nVal > 255) nVal = 255;

p[0] = (byte)nVal;

++p;
}
p += nOffset;
}
}

b.UnlockBits(bmData);

return true;
}

public static bool Contrast(Bitmap b, sbyte nContrast)
{
if (nContrast < -100) return false;
if (nContrast >  100) return false;

double pixel = 0, contrast = (100.0+nContrast)/100.0;

contrast *= contrast;

int red, green, blue;

// GDI+ still lies to us - the return format is BGR, NOT RGB.
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;

unsafe
{
byte * p = (byte *)(void *)Scan0;

int nOffset = stride - b.Width*3;

for(int y=0;y<b.Height;++y)
{
for(int x=0; x < b.Width; ++x )
{
blue = p[0];
green = p[1];
red = p[2];

pixel = red/255.0;
pixel -= 0.5;
pixel *= contrast;
pixel += 0.5;
pixel *= 255;
if (pixel < 0) pixel = 0;
if (pixel > 255) pixel = 255;
p[2] = (byte) pixel;

pixel = green/255.0;
pixel -= 0.5;
pixel *= contrast;
pixel += 0.5;
pixel *= 255;
if (pixel < 0) pixel = 0;
if (pixel > 255) pixel = 255;
p[1] = (byte) pixel;

pixel = blue/255.0;
pixel -= 0.5;
pixel *= contrast;
pixel += 0.5;
pixel *= 255;
if (pixel < 0) pixel = 0;
if (pixel > 255) pixel = 255;
p[0] = (byte) pixel;

p += 3;
}
p += nOffset;
}
}

b.UnlockBits(bmData);

return true;
}

public static bool Gamma(Bitmap b, double red, double green, double blue)
{
if (red < .2 || red > 5) return false;
if (green < .2 || green > 5) return false;
if (blue < .2 || blue > 5) return false;

byte [] redGamma = new byte [256];
byte [] greenGamma = new byte [256];
byte [] blueGamma = new byte [256];

for (int i = 0; i< 256; ++i)
{
redGamma[i] = (byte)Math.Min(255, (int)(( 255.0 * Math.Pow(i/255.0, 1.0/red)) + 0.5));
greenGamma[i] = (byte)Math.Min(255, (int)(( 255.0 * Math.Pow(i/255.0, 1.0/green)) + 0.5));
blueGamma[i] = (byte)Math.Min(255, (int)(( 255.0 * Math.Pow(i/255.0, 1.0/blue)) + 0.5));
}

// GDI+ still lies to us - the return format is BGR, NOT RGB.
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;

unsafe
{
byte * p = (byte *)(void *)Scan0;

int nOffset = stride - b.Width*3;

for(int y=0;y<b.Height;++y)
{
for(int x=0; x < b.Width; ++x )
{
p[2] = redGamma[ p[2] ];
p[1] = greenGamma[ p[1] ];
p[0] = blueGamma[ p[0] ];

p += 3;
}
p += nOffset;
}
}

b.UnlockBits(bmData);

return true;
}

public static bool Color(Bitmap b, int red, int green, int blue)
{
if (red < -255 || red > 255) return false;
if (green < -255 || green > 255) return false;
if (blue < -255 || blue > 255) return false;

// GDI+ still lies to us - the return format is BGR, NOT RGB.
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

int stride = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;

unsafe
{
byte * p = (byte *)(void *)Scan0;

int nOffset = stride - b.Width*3;
int nPixel;

for(int y=0;y<b.Height;++y)
{
for(int x=0; x < b.Width; ++x )
{
nPixel = p[2] + red;
nPixel = Math.Max(nPixel, 0);
p[2] = (byte)Math.Min(255, nPixel);

nPixel = p[1] + green;
nPixel = Math.Max(nPixel, 0);
p[1] = (byte)Math.Min(255, nPixel);

nPixel = p[0] + blue;
nPixel = Math.Max(nPixel, 0);
p[0] = (byte)Math.Min(255, nPixel);

p += 3;
}
p += nOffset;
}
}

b.UnlockBits(bmData);

return true;
}

public static bool Conv3x3(Bitmap b, ConvMatrix m)
{
// Avoid divide by zero errors
if (0 == m.Factor) return false;

Bitmap bSrc = (Bitmap)b.Clone();

// GDI+ still lies to us - the return format is BGR, NOT RGB.
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
BitmapData bmSrc = bSrc.LockBits(new Rectangle(0, 0, bSrc.Width, bSrc.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

int stride = bmData.Stride;
int stride2 = stride * 2;
System.IntPtr Scan0 = bmData.Scan0;
System.IntPtr SrcScan0 = bmSrc.Scan0;

unsafe
{
byte * p = (byte *)(void *)Scan0;
byte * pSrc = (byte *)(void *)SrcScan0;

int nOffset = stride + 6 - b.Width*3;
int nWidth = b.Width - 2;
int nHeight = b.Height - 2;

int nPixel;

for(int y=0;y < nHeight;++y)
{
for(int x=0; x < nWidth; ++x )
{
nPixel = ( ( ( (pSrc[2] * m.TopLeft) + (pSrc[5] * m.TopMid) + (pSrc[8] * m.TopRight) +
(pSrc[2 + stride] * m.MidLeft) + (pSrc[5 + stride] * m.Pixel) + (pSrc[8 + stride] * m.MidRight) +
(pSrc[2 + stride2] * m.BottomLeft) + (pSrc[5 + stride2] * m.BottomMid) + (pSrc[8 + stride2] * m.BottomRight)) / m.Factor) + m.Offset);

if (nPixel < 0) nPixel = 0;
if (nPixel > 255) nPixel = 255;

p[5 + stride]= (byte)nPixel;

nPixel = ( ( ( (pSrc[1] * m.TopLeft) + (pSrc[4] * m.TopMid) + (pSrc[7] * m.TopRight) +
(pSrc[1 + stride] * m.MidLeft) + (pSrc[4 + stride] * m.Pixel) + (pSrc[7 + stride] * m.MidRight) +
(pSrc[1 + stride2] * m.BottomLeft) + (pSrc[4 + stride2] * m.BottomMid) + (pSrc[7 + stride2] * m.BottomRight)) / m.Factor) + m.Offset);

if (nPixel < 0) nPixel = 0;
if (nPixel > 255) nPixel = 255;

p[4 + stride] = (byte)nPixel;

nPixel = ( ( ( (pSrc[0] * m.TopLeft) + (pSrc[3] * m.TopMid) + (pSrc[6] * m.TopRight) +
(pSrc[0 + stride] * m.MidLeft) + (pSrc[3 + stride] * m.Pixel) + (pSrc[6 + stride] * m.MidRight) +
(pSrc[0 + stride2] * m.BottomLeft) + (pSrc[3 + stride2] * m.BottomMid) + (pSrc[6 + stride2] * m.BottomRight)) / m.Factor) + m.Offset);

if (nPixel < 0) nPixel = 0;
if (nPixel > 255) nPixel = 255;

p[3 + stride] = (byte)nPixel;

p += 3;
pSrc += 3;
}

p += nOffset;
pSrc += nOffset;
}
}

b.UnlockBits(bmData);
bSrc.UnlockBits(bmSrc);
            
return true;
}
public static bool Smooth(Bitmap b, int nWeight /* default to 1 */)
{
ConvMatrix m = new ConvMatrix();
m.SetAll(1);
m.Pixel = nWeight;
m.Factor = nWeight + 8;

return  BitmapFilter.Conv3x3(b, m);
}

public static bool GaussianBlur(Bitmap b, int nWeight /* default to 4*/)
{
ConvMatrix m = new ConvMatrix();
m.SetAll(1);
m.Pixel = nWeight;
m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 2;
m.Factor = nWeight + 30;

return  BitmapFilter.Conv3x3(b, m);
}
public static bool MeanRemoval(Bitmap b, int nWeight /* default to 9*/ )
{
ConvMatrix m = new ConvMatrix();
m.SetAll(-1);
m.Pixel = nWeight;
m.Factor = nWeight - 8;

return BitmapFilter.Conv3x3(b, m);
}
public static bool Sharpen(Bitmap b, int nWeight /* default to 11*/ )
{
ConvMatrix m = new ConvMatrix();
m.SetAll(0);
m.Pixel = nWeight;
m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = -2;
m.Factor = nWeight - 8;

return  BitmapFilter.Conv3x3(b, m);
}
public static bool EmbossLaplacian(Bitmap b)
{
ConvMatrix m = new ConvMatrix();
m.SetAll(-1);
m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 0;
m.Pixel = 4;
m.Offset = 127;

return  BitmapFilter.Conv3x3(b, m);
}
public static bool EdgeDetectQuick(Bitmap b)
{
ConvMatrix m = new ConvMatrix();
m.TopLeft = m.TopMid = m.TopRight = -1;
m.MidLeft = m.Pixel = m.MidRight = 0;
m.BottomLeft = m.BottomMid = m.BottomRight = 1;

m.Offset = 127;

return  BitmapFilter.Conv3x3(b, m);
}
}
}

Commentaire de mastercatz le 11/12/2006 08:03:17

Peut-on avoir le lien svp ?

Commentaire de SpyBall le 11/12/2006 17:19:56

L'auteur à fait plusieurs articles sur CodeProject à ce sujet, normalement celle concernant cette source est la N°2: http://www.codeproject.com/cs/media/csharpfilters.asp

Pour ceux qui veulent plus d'infos, c'est tout sur le profil de l'auteur dans la section GDI+:

http://www.codeproject.com/script/Articles/list_articles.asp?userid=6556

Commentaire de sperot51 le 13/06/2007 14:33:42

c'est super lent !!
y a des méthodes pour faire ca mieux je pense
deja avec 3 lignes en plus genre le doublebuffer et c'est deja moins pire
mais ca reste inutilisable...

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

form transparente ou invisible [ par Mahfoud ] je vsut que ma forme soit invisible ou transparenteet merci d'avance . Aide !!!!! Comment mettre une form transparente help!!!!! [ par ironzvsutbest ] Je cherche comment mettre une form semi-transparente(translucide) pas de (visible,ou hide).Je sais que mon probleme est un peu expert mais si vous tro Superposer une Form transparente [ par machto ] Bonjour à tous.J'ai besoin de superposer une Form transparente où je fais défiler une ligne (scroll) sur une Form qui contient un graphique audio.Je n form transparente !!! [ par EXOCET ] je cherche une fonction simple pour rendre une form transparente toute celle que j'ai vu pour l'instant ne sont pas très simple ou sont dans des progr Form transparente [ par sb ] Comment rendre une form transparente ? VB.net : Comment acceder a un control d'une form depuis un module ? [ par jeanh1 ] SVP je cherche a acceder a un control d'une form depuis un module comme on fesai en VB6 genre :Form1.button1.text = "toto"Mais impossible .... Pb control activé... [ par sonoboss ] Hélo a tousse!Bon voila mon pb : je me suis lancé sur access pour une appli tte mini et qui ne vaux pas le coup de créer un projet VB... (du moins c'e Nombre maximal de control par form???????? [ par shkinmi ] Salut a tous..j'ai un probleme.J'ai attein le nombre maximal se controls(combobox,textbox etc..) pour une form et je doit absolument continuer a trav vb6 pour access copier un control [ par Rizar21 ] j'aimerais savoir comment copier mon control ActiveXMyNewControlde la form "form01"j'aimerais le copier dans la form "form02" to "form20"je sais comme Utilisation de For Each... avec Control et Form ??? [ par salazar ] Je voudrais afficher dans le debug, le nom de tous les controles dans toutes les fenetres du projet en cours...Je ne sais pas trop comment faire...&nb


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,217 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales