?
Solved

1 pixel wide Brush ?

Posted on 1998-08-10
1
Medium Priority
?
460 Views
Last Modified: 2013-11-20
Hi,
My program's view is based on the CZoomView by Brad Pirtle(codeguru.com Doc-View catagory), which is derieved from CSrollView.

I used the SelectStockObject(BLACK_PEN) to do most of my drawing, so when I zoom in and out the lines stay a the same thickness(1 pixel), this works great.

The problem is when certain items are selected they are redrawn using a brush similar to the PS_ALTERNATE pen in NT (Drawing dotted lines - Jean-Edouard Lachand-Robert/GDI catagory). This works great when you stay in the default zoom mode, but when you zoom in/out the lines really look bad. Sometimes some lines are thicker than others.

What I would like to do is keep them(the dotted lines) at the same 1 pixel width regaurdless of how far in/out you zoom.

I also implement the DrawDragRect, which as you might guessed works great in the default mode. When I zoom in/out things get crazy, it does not redraw it's self correctly. I've testet the CRectTracker which uses the DrawDragRect and it works fine at any zoom. When I call the DrawDragRect I pass it a CSize(1,1) like CRectTracker.

Can anybody help? I'm really stuck :(

Mark

0
Comment
Question by:studebaker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
scs1 earned 400 total points
ID: 1320533
Mark,
       I have been writing an MFC Application that uses several different pen colors.  I am only using continous lines with 1 pixel thickness.  I use the following commands to create the pen object, define it, and use it.  I think it should work for you.  I also have a zoom-in and zoom-out command in my application and it still works fine.

// creating the pens
CPen *oldpen, redPen, blackPen, yellowPen;

// defining the pens.  The 1 is the pixel width.
redPen.CreatePen(PS_SOLID, 1, RGB(255,0,0));
blackPen.CreatePen(PS_SOLID, 1, RGB(0,0,0));
yellowPen.CreatePen(PS_SOLID, 1, RGB(255,255,0));

//selecting the pen to be used
oldpen=pDC->SelectObject(&redPen);

I hope this is clear and helpful
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

801 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