Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
QuestionListing information of backgroud process Pin
sarang_k28-Apr-11 19:01
sarang_k28-Apr-11 19:01 
AnswerRe: Listing information of backgroud process Pin
CodingLover28-Apr-11 19:23
CodingLover28-Apr-11 19:23 
AnswerRe: Listing information of backgroud process Pin
ambarishtv29-Apr-11 23:05
ambarishtv29-Apr-11 23:05 
QuestionMinimizing to system tray causes stack overflow Pin
Helfdane28-Apr-11 12:52
Helfdane28-Apr-11 12:52 
AnswerRe: Minimizing to system tray causes stack overflow Pin
Luc Pattyn28-Apr-11 13:01
sitebuilderLuc Pattyn28-Apr-11 13:01 
GeneralRe: Minimizing to system tray causes stack overflow Pin
Helfdane29-Apr-11 8:35
Helfdane29-Apr-11 8:35 
QuestionGradient Texture with Transparency Pin
BoneSoft28-Apr-11 3:54
BoneSoft28-Apr-11 3:54 
AnswerRe: Gradient Texture with Transparency Pin
BoneSoft28-Apr-11 9:02
BoneSoft28-Apr-11 9:02 
In case anyone cares. Until I find a nicer cleaner way to accomplish this, I've decided to brute force it pixel by pixel.

For my purposes, the image is meant to be a background image for a range between 0 and 255. This example does the gradient vertically. To do a different direction, I assume anybody who cares can work out the necessary changes. I'll settle for this only because my image will be very small, but I'd still like to find a more elegant solution.

C#
private Image GradientTransparent(Image src) {
    Rectangle bmpBox = new Rectangle(0, 0, src.Width, src.Height);
    Bitmap bmp = new Bitmap(src);
    Graphics g = Graphics.FromImage(bmp);
    for (int y = 0; y < bmp.Height; y++) {
        // image is meant to represent a range from 0 to 255
        int alpha = (int)((float)y * 255f / (float)bmp.Height);
        for (int x = 0; x < bmp.Width; x++) {
            Color pixel = bmp.GetPixel(x, y);
            pixel = Color.FromArgb(alpha, pixel);
            bmp.SetPixel(x, y, pixel);
        }
    }
    return bmp;
}

"Political correctness is a doctrine, fostered by a delusional, illogical minority, and rabidly promoted by an unscrupulous mainstream media, which holds forth the proposition that it is entirely possible to pick up a turd by the clean end" - Unknown

AnswerRe: Gradient Texture with Transparency Pin
Manfred Rudolf Bihy28-Apr-11 12:30
professionalManfred Rudolf Bihy28-Apr-11 12:30 
GeneralRe: Gradient Texture with Transparency Pin
BoneSoft28-Apr-11 16:04
BoneSoft28-Apr-11 16:04 
QuestionHow to list network connections Pin
sarang_k28-Apr-11 0:31
sarang_k28-Apr-11 0:31 
AnswerRe: How to list network connections Pin
Blue_Boy28-Apr-11 3:25
Blue_Boy28-Apr-11 3:25 
GeneralRe: How to list network connections Pin
ambarishtv28-Apr-11 5:16
ambarishtv28-Apr-11 5:16 
AnswerRe: How to list network connections Pin
RaviRanjanKr29-Apr-11 9:03
professionalRaviRanjanKr29-Apr-11 9:03 
QuestionDataset selection question Pin
minnie mouse27-Apr-11 23:34
minnie mouse27-Apr-11 23:34 
AnswerRe: Dataset selection question Pin
Eddy Vluggen28-Apr-11 0:06
professionalEddy Vluggen28-Apr-11 0:06 
GeneralRe: Dataset selection question Pin
minnie mouse28-Apr-11 0:51
minnie mouse28-Apr-11 0:51 
AnswerRe: Dataset selection question Pin
wizardzz28-Apr-11 5:54
wizardzz28-Apr-11 5:54 
GeneralRe: Dataset selection question Pin
minnie mouse28-Apr-11 10:04
minnie mouse28-Apr-11 10:04 
QuestionHow to use c++ dll in c#.net Pin
sarang_k27-Apr-11 23:02
sarang_k27-Apr-11 23:02 
AnswerRe: How to use c++ dll in c#.net Pin
Pete O'Hanlon27-Apr-11 23:31
mvePete O'Hanlon27-Apr-11 23:31 
QuestionRename a file from his String Path [Resolved] Pin
Pierre besquent27-Apr-11 22:21
Pierre besquent27-Apr-11 22:21 
AnswerRe: Rename a file from his String Path Pin
Groulien27-Apr-11 22:37
Groulien27-Apr-11 22:37 
GeneralRe: Rename a file from his String Path Pin
Pierre besquent27-Apr-11 22:48
Pierre besquent27-Apr-11 22:48 
GeneralRe: Rename a file from his String Path Pin
ambarishtv28-Apr-11 5:32
ambarishtv28-Apr-11 5:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.