Click here to Skip to main content
15,905,914 members
Home / Discussions / C#
   

C#

 
Generalerror with tab page Pin
robmays19-Apr-04 22:14
robmays19-Apr-04 22:14 
GeneralRe: error with tab page(Heath) Pin
robmays19-Apr-04 22:31
robmays19-Apr-04 22:31 
GeneralRe: error with tab page Pin
Heath Stewart20-Apr-04 4:34
protectorHeath Stewart20-Apr-04 4:34 
GeneralA managed DirectDraw / DirectX question Pin
yoaz19-Apr-04 21:32
yoaz19-Apr-04 21:32 
GeneralRe: A managed DirectDraw / DirectX question Pin
Jeremy Kimball20-Apr-04 6:42
Jeremy Kimball20-Apr-04 6:42 
GeneralRe: A managed DirectDraw / DirectX question Pin
yoaz20-Apr-04 8:15
yoaz20-Apr-04 8:15 
Questioncan i get a 256 colors bitmap from DC directly ? Pin
fu019-Apr-04 21:04
fu019-Apr-04 21:04 
AnswerRe: can i get a 256 colors bitmap from DC directly ? Pin
Heath Stewart20-Apr-04 4:47
protectorHeath Stewart20-Apr-04 4:47 
First, don't assume the desktop is 800x600. Use either SystemInformation.VirtualScreen or Screen.WorkingArea to get the Rectangle to use to size the Bitmap.

Second, you can create a 256-color bitmap by using the Bitmap.Bitmap(int, int, PixelFormat) constructor. Then create a new Graphics object for that bitmap and use GetHdc to get the DC which you could paint into. Make sure you call ReleaseHdc and then dispose your Graphics object, but do not call GC.Collect - just call Graphics.Dispose on anything you create. Calling GC.Collect can be very expensive and - if you dispose things correctly (in order to free native resources, which GC.Collect won't do) - is unnecessary.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: can i get a 256 colors bitmap from DC directly ? Pin
yoaz20-Apr-04 21:24
yoaz20-Apr-04 21:24 
GeneralRe: can i get a 256 colors bitmap from DC directly ? Pin
Heath Stewart21-Apr-04 3:09
protectorHeath Stewart21-Apr-04 3:09 
GeneralRe: can i get a 256 colors bitmap from DC directly ? Pin
yoaz21-Apr-04 5:26
yoaz21-Apr-04 5:26 
GeneralRe: can i get a 256 colors bitmap from DC directly ? Pin
fu024-Apr-04 15:38
fu024-Apr-04 15:38 
Generalhelp convert a line of code Pin
User 96257819-Apr-04 19:41
User 96257819-Apr-04 19:41 
GeneralRe: help convert a line of code Pin
Mazdak19-Apr-04 19:54
Mazdak19-Apr-04 19:54 
GeneralRe: help convert a line of code Pin
Roman Rodov20-Apr-04 2:54
Roman Rodov20-Apr-04 2:54 
GeneralRe: help convert a line of code Pin
User 96257820-Apr-04 9:53
User 96257820-Apr-04 9:53 
GeneralRe: help convert a line of code Pin
Roman Rodov20-Apr-04 14:52
Roman Rodov20-Apr-04 14:52 
GeneralRe: help convert a line of code Pin
User 96257820-Apr-04 15:38
User 96257820-Apr-04 15:38 
GeneralWebconfig question Pin
dabuskol19-Apr-04 19:17
dabuskol19-Apr-04 19:17 
GeneralRe: Webconfig question Pin
Mazdak19-Apr-04 19:57
Mazdak19-Apr-04 19:57 
GeneralRe: Webconfig question Pin
dabuskol19-Apr-04 21:40
dabuskol19-Apr-04 21:40 
GeneralRe: Webconfig question Pin
Mazdak19-Apr-04 21:55
Mazdak19-Apr-04 21:55 
GeneralRe: Webconfig question Pin
Heath Stewart20-Apr-04 5:09
protectorHeath Stewart20-Apr-04 5:09 
Questionshowing dialog with topLevel ? Pin
azusakt19-Apr-04 17:45
azusakt19-Apr-04 17:45 
AnswerRe: showing dialog with topLevel ? Pin
LongRange.Shooter20-Apr-04 2:35
LongRange.Shooter20-Apr-04 2:35 

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.