Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralGeneric / Text Only print Pin
MadsJ24-Jul-03 3:13
MadsJ24-Jul-03 3:13 
GeneralRe: Generic / Text Only print Pin
Ista24-Jul-03 6:52
Ista24-Jul-03 6:52 
GeneralRe: Generic / Text Only print Pin
MadsJ24-Jul-03 19:41
MadsJ24-Jul-03 19:41 
GeneralRe: Generic / Text Only print Pin
J. Dunlap24-Jul-03 20:13
J. Dunlap24-Jul-03 20:13 
GeneralRe: Generic / Text Only print Pin
Ista25-Jul-03 4:15
Ista25-Jul-03 4:15 
GeneralProcess Monitoring Pin
vikramlinux24-Jul-03 1:56
vikramlinux24-Jul-03 1:56 
GeneralRe: Process Monitoring Pin
Tom Archer24-Jul-03 2:18
Tom Archer24-Jul-03 2:18 
GeneralCreate Bitmap and LockBits Pin
novachen24-Jul-03 0:51
novachen24-Jul-03 0:51 
Hi! I try to create a target bitmap alike the source bitmap ( in size, in pallete). I hope the target bitmap will be created black(or 0) on every pixel. And then program generate the content of target according to the source one, if some pixel isn't be filled it will be still black.

first trial:

dst = (Bitmap)src.Clone();
BitmapData bmSrcData = src.LockBits(new Rectangle(0, 0, src.Width, src.Height), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
BitmapData bmDstData = dst.LockBits(new Rectangle(0, 0, dst.Width, dst.Height), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
//do some processing on BitmapData

This one work! but it seems clone waste much on copying the content. i wanna it be black, so i have to fill it 0 myself. copy and fill are useless duplicate work.

Second trial:
dst = new Bitmap(src.Width, src.Height, src.PixelFormat);
BitmapData bmSrcData = src.LockBits(new Rectangle(0, 0, src.Width, src.Height), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
BitmapData bmDstData = dst.LockBits(new Rectangle(0, 0, dst.Width, dst.Height), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);

dst will not has the same palette as src. After the process, dst will be a color image even src is a formerly gray one.

Third one:
dst = new Bitmap(src);
BitmapData bmSrcData = src.LockBits(new Rectangle(0, 0, src.Width, src.Height), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
BitmapData bmDstData = dst.LockBits(new Rectangle(0, 0, dst.Width, dst.Height), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);

can't execute! the second LockBits will raise error. anybody know why?

I really puzzled by these methods! any guru can explain what's on earth are these create functions doing? and what's the best way to get my aim?
GeneralRe: Create Bitmap and LockBits Pin
leppie24-Jul-03 7:26
leppie24-Jul-03 7:26 
Questionhow to add component???? Pin
don7cry24-Jul-03 0:46
don7cry24-Jul-03 0:46 
Generalfunction parameter with default value Pin
zecodela23-Jul-03 23:17
zecodela23-Jul-03 23:17 
GeneralRe: function parameter with default value Pin
monrobot1324-Jul-03 2:37
monrobot1324-Jul-03 2:37 
GeneralRe: function parameter with default value Pin
Frank Olorin Rizzi24-Jul-03 3:26
Frank Olorin Rizzi24-Jul-03 3:26 
GeneralRe: function parameter with default value Pin
Tom Archer24-Jul-03 7:13
Tom Archer24-Jul-03 7:13 
GeneralRe: function parameter with default value Pin
leppie24-Jul-03 7:30
leppie24-Jul-03 7:30 
GeneralRe: function parameter with default value Pin
Tom Archer24-Jul-03 7:36
Tom Archer24-Jul-03 7:36 
GeneralRe: function parameter with default value Pin
leppie24-Jul-03 8:17
leppie24-Jul-03 8:17 
GeneralRe: function parameter with default value Pin
Tom Archer24-Jul-03 8:19
Tom Archer24-Jul-03 8:19 
GeneralRe: function parameter with default value Pin
Nemanja Trifunovic24-Jul-03 10:01
Nemanja Trifunovic24-Jul-03 10:01 
GeneralRe: function parameter with default value Pin
Tom Archer24-Jul-03 10:38
Tom Archer24-Jul-03 10:38 
GeneralRe: function parameter with default value Pin
Nemanja Trifunovic24-Jul-03 12:04
Nemanja Trifunovic24-Jul-03 12:04 
GeneralXML selialize Pin
Mazdak23-Jul-03 22:04
Mazdak23-Jul-03 22:04 
GeneralRe: XML selialize Pin
pseudonym6724-Jul-03 7:15
pseudonym6724-Jul-03 7:15 
GeneralToolTip on GDI+ figure Pin
r923-Jul-03 21:13
r923-Jul-03 21:13 
GeneralRe: ToolTip on GDI+ figure Pin
Valeria Bogdevich23-Jul-03 23:15
Valeria Bogdevich23-Jul-03 23:15 

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.