Solved

CDC::FillRect() and CDC::FillSolidRect()

Posted on 1998-04-28
7
2,081 Views
Last Modified: 2012-05-04
Hi,
What is the major difference between CDC::FillRect() and the CDC::FillSolidRect() function in VC 4.0? I want to draw colored rectangles in a CView. I used CDC::FillRect() to draw them at the screen and CDC::FillSolidRect() to draw them at the printer. When I want to print my view in PostScript, these rectangles are not printed whereas it is working correctly in PCL5. Why?
Thanks
0
Comment
Question by:adnrwin
  • 3
  • 3
7 Comments
 

Author Comment

by:adnrwin
ID: 1165979
Edited text of question
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165980
The  difference is that FillSolidRect() fills with a single, specified color.  FillRect() fills with a brush.  The brush COULD be a single solid color, but could be a dithered color, a pattern, a hatched brush etc.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165981
If your brush is a solid brush, you should get the same results.  Is the printer a color printer?  If not the color you should fill with should be black or white, is it?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:adnrwin
ID: 1165982
It's a solid brush who is used with FillRect(). I've tried on both color and black/white printer. In either case, the result is the same : when I print in PostScript, the rectangles are not printed.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165983
Have you tried GetDeviceCaps(DC,RASTERCAPS) to see if the PC_RECTANGLE flag is set.   If not, the device cannot draw rectangles.
0
 

Author Comment

by:adnrwin
ID: 1165984
The PC_RECTANGLE flag is set. I've tried to use FillRect() instead of FillSolidRect() when I'm printing and it's working correctly even in PostScript. What can make FillRect() able to print in PostScript whereas FillSolidRect() is not able?
0
 
LVL 2

Accepted Solution

by:
jstolan earned 50 total points
ID: 1165985
The problem is probably in your Post Script driver.  Not all drivers necessarily implement all of the CDC functions.  I know it's not exactly what you're looking for, but your best work around is to use FillRect when printing.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now