Click here to Skip to main content
15,792,063 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to make an click and drag program? Pin
Naveed Kamboh24-Apr-06 2:29
Naveed Kamboh24-Apr-06 2:29 
QuestionA control that extracts information re PDF fillable fields Pin
NewbieDude24-Apr-06 2:20
NewbieDude24-Apr-06 2:20 
QuestionHow to tell when LstView finished sorting Pin
michaelbaylon24-Apr-06 1:44
michaelbaylon24-Apr-06 1:44 
AnswerRe: How to tell when LstView finished sorting Pin
Ed.Poore24-Apr-06 1:51
Ed.Poore24-Apr-06 1:51 
AnswerRe: How to tell when LstView finished sorting Pin
Josh Smith24-Apr-06 8:24
Josh Smith24-Apr-06 8:24 
QuestionBitmaps and Unsafe Code Pin
stewwi24-Apr-06 1:41
stewwi24-Apr-06 1:41 
AnswerRe: Bitmaps and Unsafe Code Pin
Christian Graus24-Apr-06 2:35
protectorChristian Graus24-Apr-06 2:35 
GeneralRe: Bitmaps and Unsafe Code Pin
stewwi24-Apr-06 2:41
stewwi24-Apr-06 2:41 
Sure

i Create the bitmap here

Bitmap pane = new Bitmap(800, 800);

then i had to init the bitmap with a colour to get it working
<br />
   for (int i = 0; i < pane.Height; i++)<br />
            {<br />
                for (int j = 0; j < pane.Width; j++)<br />
                {<br />
                    pane.SetPixel(j, i, Color.Black); <br />
                    <br />
                }<br />
<br />
            }

basically i have to get rid of the code above

then i use unsafe mode to set colours to individual pixels


   public  Bitmap backup(Bitmap pane)<br />
        {           <br />
            BitmapData panedata = pane.LockBits(new Rectangle(0, 0, pane.Width, pane.Height),<br />
                ImageLockMode.ReadWrite, pane.PixelFormat);<br />
           <br />
            int stride = panedata.Stride;    //returns the location of the first pixel of the image<br />
            IntPtr Scan0 = panedata.Scan0;<br />
<br />
            unsafe<br />
            {                <br />
                byte* p = (byte*)(void*)Scan0;                <br />
             <br />
                int nOffset = stride - pane.Height *3  ;<br />
                int nWidth = pane.Width * 3;<br />
              <br />
                for (int y = 0; y < pane.Height; ++y)<br />
                {<br />
                    for (int x = 0; x < pane.Width; ++x)<br />
                    {                       <br />
                        *(p + 0) = (byte)255;<br />
                        *(p + 1) = (byte)0;<br />
                        *(p + 2) = (byte)0;<br />
                        p += 4;<br />
                    }                 <br />
                }<br />
            }<br />
            pane.UnlockBits(panedata);<br />
            return pane;              <br />
        }


like that it works but its takes ages to start
GeneralRe: Bitmaps and Unsafe Code Pin
Aaron Dilliard24-Apr-06 4:53
Aaron Dilliard24-Apr-06 4:53 
GeneralRe: Bitmaps and Unsafe Code Pin
stewwi24-Apr-06 5:04
stewwi24-Apr-06 5:04 
GeneralRe: Bitmaps and Unsafe Code Pin
Robert Rohde24-Apr-06 5:41
Robert Rohde24-Apr-06 5:41 
GeneralRe: Bitmaps and Unsafe Code Pin
stewwi24-Apr-06 5:54
stewwi24-Apr-06 5:54 
GeneralRe: Bitmaps and Unsafe Code Pin
Christian Graus24-Apr-06 13:13
protectorChristian Graus24-Apr-06 13:13 
QuestionHow to set ip address/hostname remotely Pin
lmyo23-Apr-06 22:48
lmyo23-Apr-06 22:48 
AnswerRe: How to set ip address/hostname remotely Pin
Ed.Poore24-Apr-06 1:33
Ed.Poore24-Apr-06 1:33 
QuestionRead mails from mail server Pin
AmitSumit23-Apr-06 22:09
AmitSumit23-Apr-06 22:09 
AnswerRe: Read mails from mail server Pin
Yuvi Panda23-Apr-06 23:59
Yuvi Panda23-Apr-06 23:59 
GeneralRe: Read mails from mail server Pin
Rob Philpott24-Apr-06 6:36
Rob Philpott24-Apr-06 6:36 
GeneralRe: Read mails from mail server Pin
AmitSumit24-Apr-06 22:11
AmitSumit24-Apr-06 22:11 
QuestionFile Systems in asp.net Pin
spokione23-Apr-06 22:03
spokione23-Apr-06 22:03 
QuestionProblem in Console application Pin
Sunny H23-Apr-06 21:59
Sunny H23-Apr-06 21:59 
AnswerRe: Problem in Console application Pin
karande2323-Apr-06 22:05
karande2323-Apr-06 22:05 
GeneralRe: Problem in Console application Pin
karande2323-Apr-06 22:11
karande2323-Apr-06 22:11 
AnswerRe: Problem in Console application Pin
HimaBindu Vejella23-Apr-06 22:45
HimaBindu Vejella23-Apr-06 22:45 
Questionthreading Pin
karande2323-Apr-06 21:55
karande2323-Apr-06 21:55 

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.