Click here to Skip to main content
15,918,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GDI: Changing pen color Pin
6-Jun-01 3:37
suss6-Jun-01 3:37 
GeneralRe: GDI: Changing pen color Pin
Tomasz Sowinski6-Jun-01 3:50
Tomasz Sowinski6-Jun-01 3:50 
GeneralRe: GDI: Changing pen color Pin
6-Jun-01 4:02
suss6-Jun-01 4:02 
GeneralRe: GDI: Changing pen color Pin
Tomasz Sowinski6-Jun-01 4:29
Tomasz Sowinski6-Jun-01 4:29 
GeneralMemory fragmentation? Pin
6-Jun-01 5:21
suss6-Jun-01 5:21 
GeneralRe: Memory fragmentation? Pin
Tomasz Sowinski6-Jun-01 5:41
Tomasz Sowinski6-Jun-01 5:41 
GeneralRe: Memory fragmentation? Pin
Pavlos Touboulidis6-Jun-01 9:06
Pavlos Touboulidis6-Jun-01 9:06 
GeneralRe: Memory fragmentation? Pin
Christian Graus6-Jun-01 9:40
protectorChristian Graus6-Jun-01 9:40 
Wow - this is quite a lengthy conversation you two have had. My 2 cents worth, which is just over 1 cent, US.

1/ You *can* use DrawSolidRect and pass in a colour to draw a line without creating a pen, but the API will just create one internally.

2/ There is *no* way that 'thousands' of different line colours will be visible to the naked eye unless they form a gradient and the interaction between them is the point. The only other reason to do this would be colour keying

3/ MFC is a thin wrapper for the API - look at the code and it more often than not calls an API function directly. CPen is just a wrapper that helps prevent memory leaks.

4/ Windows does have finite GDI space, and you will find that unless you are careful handling all these pens and deleting them properly you will find your system will go down. I strongly recommend running the resource meter while you work on this code. This is also why I would not recommend pre-creating your pens in memory.

5/ The other option if you feel so strongly about it is to grab a DIBSection wrapper to help you get access to the bits and set the pixel data yourself. No CPens or HANDLEs needed, just an implimentation of the Bresenham algorithm, which is pretty simple stuff.

Christian

#include "std_disclaimer.h"

People who love sausage and respect the law should never watch either one being made.

The things that come to those who wait are usually the things left by those who got there first.

GeneralRe: GDI: Changing pen color Pin
NormDroid6-Jun-01 3:26
professionalNormDroid6-Jun-01 3:26 
GeneralRe: GDI: Changing pen color Pin
6-Jun-01 3:52
suss6-Jun-01 3:52 
GeneralRe: GDI: Changing pen color Pin
NormDroid6-Jun-01 3:58
professionalNormDroid6-Jun-01 3:58 
GeneralRe: GDI: Changing pen color Pin
Rick York6-Jun-01 7:01
mveRick York6-Jun-01 7:01 
GeneralRe: GDI: Changing pen color Pin
Christian Graus6-Jun-01 9:43
protectorChristian Graus6-Jun-01 9:43 
GeneralRe: GDI: Changing pen color Pin
Rick York6-Jun-01 11:59
mveRick York6-Jun-01 11:59 
GeneralRe: GDI: Changing pen color Pin
Christian Graus6-Jun-01 12:47
protectorChristian Graus6-Jun-01 12:47 
GeneralRe: GDI: Changing pen color Pin
6-Jun-01 21:04
suss6-Jun-01 21:04 
GeneralRe: GDI: Changing pen color Pin
Vivek Rajan6-Jun-01 20:33
Vivek Rajan6-Jun-01 20:33 
GeneralYou convinced me guys Pin
6-Jun-01 21:35
suss6-Jun-01 21:35 
QuestionSDI to MDI ??? Pin
mr20036-Jun-01 2:21
mr20036-Jun-01 2:21 
GeneralSending Short Message Service Pin
Nagajothi6-Jun-01 1:40
Nagajothi6-Jun-01 1:40 
GeneralHTML to RTF Pin
6-Jun-01 0:22
suss6-Jun-01 0:22 
GeneralWizard bug? (DAO and Combo boxes.) Pin
Erik Essegard6-Jun-01 0:06
Erik Essegard6-Jun-01 0:06 
QuestionHow to print UNICODE string in Window 98? Pin
zhishao5-Jun-01 23:26
zhishao5-Jun-01 23:26 
AnswerRe: How to print UNICODE string in Window 98? Pin
Michael Dunn6-Jun-01 9:28
sitebuilderMichael Dunn6-Jun-01 9:28 
GeneralPopping up a message box from a library in C code used in a C++ program Pin
hearties5-Jun-01 21:48
hearties5-Jun-01 21:48 

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.