Line colors in a bargraph

ColorNum and m_Array are set before entry which works fine except for all 
bars are outlined in black
which is not a major problem, but would like to eliminate.
How do I draw the line in the code below a different color than the bars?

Below is a snip from my BarChart() routine:

  CBrush BlackBrush(RGB(10,10,10));
  CBrush CyanBrush(RGB(1,39,229));
  CBrush MagentaBrush(RGB(176,4,174));
  CBrush YellowBrush(RGB(187,176,3));
  CBrush GrayBrush(RGB(230,230,230));

  if (m_Array.GetSize())
  {

// ***** THE PROBLEM IS HERE WHERE I WOULD LIKE THE DRAWN LINE TO BE LIGHT 
GRAY *****

    MemDC.SelectObject(GrayBrush);
    MemDC.Rectangle(1, (cr.Height()/2), cr.Width()-1, (cr.Height()/2)+1);

// ***** THIS LINE IS ALLWAYS BLACK *****


    int c=35,b=5;
    int d = (cr.Width()-20)/m_Array.GetSize();

    if (ColorNum==0)
      MemDC.SelectObject(BlackBrush);
    if (ColorNum==1)
      MemDC.SelectObject(CyanBrush);
    if (ColorNum==2)
      MemDC.SelectObject(MagentaBrush);
    if (ColorNum==3)
      MemDC.SelectObject(YellowBrush);
    for (b=0; b<m_Array.GetSize(); b++)
    {
      int a = (m_Array.GetAt(b))+1;
      MemDC.Rectangle(c, cr.Height()-17, c+10, cr.Height()-a-17);
      c+=d;
    }
  }
  dc.BitBlt(0,0,cr.Width(),cr.Height(),&MemDC,0,0,SRCCOPY);  //dump 
everything from memory dc to dialog

  MemDC.RestoreDC(SavedDC1);


0
kahlua (69)
4/3/2008 4:52:21 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
780 Views

Similar Articles

[PageSpeed] 58

On 3 Apr., 18:52, "Kahlua" <kah...@right.here> wrote:
> ColorNum and m_Array are set before entry which works fine except for all
> bars are outlined in black
> which is not a major problem, but would like to eliminate.
> How do I draw the line in the code below a different color than the bars?
>
> Below is a snip from my BarChart() routine:
>
>   CBrush BlackBrush(RGB(10,10,10));
>   CBrush CyanBrush(RGB(1,39,229));
>   CBrush MagentaBrush(RGB(176,4,174));
>   CBrush YellowBrush(RGB(187,176,3));
>   CBrush GrayBrush(RGB(230,230,230));
>
>   if (m_Array.GetSize())
>   {
>
> // ***** THE PROBLEM IS HERE WHERE I WOULD LIKE THE DRAWN LINE TO BE LIGHT
> GRAY *****
>
>     MemDC.SelectObject(GrayBrush);
>     MemDC.Rectangle(1, (cr.Height()/2), cr.Width()-1, (cr.Height()/2)+1);
>
> // ***** THIS LINE IS ALLWAYS BLACK *****
>
>     int c=35,b=5;
>     int d = (cr.Width()-20)/m_Array.GetSize();
>
>     if (ColorNum==0)
>       MemDC.SelectObject(BlackBrush);
>     if (ColorNum==1)
>       MemDC.SelectObject(CyanBrush);
>     if (ColorNum==2)
>       MemDC.SelectObject(MagentaBrush);
>     if (ColorNum==3)
>       MemDC.SelectObject(YellowBrush);
>     for (b=0; b<m_Array.GetSize(); b++)
>     {
>       int a = (m_Array.GetAt(b))+1;
>       MemDC.Rectangle(c, cr.Height()-17, c+10, cr.Height()-a-17);
>       c+=d;
>     }
>   }
>   dc.BitBlt(0,0,cr.Width(),cr.Height(),&MemDC,0,0,SRCCOPY);  //dump
> everything from memory dc to dialog
>
>   MemDC.RestoreDC(SavedDC1);

have you considered using a pen?
0
clqrq (258)
4/3/2008 5:05:18 PM
LOL, missed that
Works great, thanks for the reminder

"Kahlua" <kahlua@right.here> wrote in message 
news:9X7Jj.14956$oE1.12735@trndny09...
> ColorNum and m_Array are set before entry which works fine except for all 
> bars are outlined in black
> which is not a major problem, but would like to eliminate.
> How do I draw the line in the code below a different color than the bars?
>
> Below is a snip from my BarChart() routine:
>
>  CBrush BlackBrush(RGB(10,10,10));
>  CBrush CyanBrush(RGB(1,39,229));
>  CBrush MagentaBrush(RGB(176,4,174));
>  CBrush YellowBrush(RGB(187,176,3));
>  CBrush GrayBrush(RGB(230,230,230));
>
>  if (m_Array.GetSize())
>  {
>
> // ***** THE PROBLEM IS HERE WHERE I WOULD LIKE THE DRAWN LINE TO BE LIGHT 
> GRAY *****
>
>    MemDC.SelectObject(GrayBrush);
>    MemDC.Rectangle(1, (cr.Height()/2), cr.Width()-1, (cr.Height()/2)+1);
>
> // ***** THIS LINE IS ALLWAYS BLACK *****
>
>
>    int c=35,b=5;
>    int d = (cr.Width()-20)/m_Array.GetSize();
>
>    if (ColorNum==0)
>      MemDC.SelectObject(BlackBrush);
>    if (ColorNum==1)
>      MemDC.SelectObject(CyanBrush);
>    if (ColorNum==2)
>      MemDC.SelectObject(MagentaBrush);
>    if (ColorNum==3)
>      MemDC.SelectObject(YellowBrush);
>    for (b=0; b<m_Array.GetSize(); b++)
>    {
>      int a = (m_Array.GetAt(b))+1;
>      MemDC.Rectangle(c, cr.Height()-17, c+10, cr.Height()-a-17);
>      c+=d;
>    }
>  }
>  dc.BitBlt(0,0,cr.Width(),cr.Height(),&MemDC,0,0,SRCCOPY);  //dump 
> everything from memory dc to dialog
>
>  MemDC.RestoreDC(SavedDC1);
>
> 


0
kahlua (69)
4/3/2008 5:21:10 PM
Reply:

Similar Artilces:

Line Spacing and Line Justification
I am a Publisher novice. On a blank page I pasted a PowerPoint Presentation slide. Below the slide I drew a line and copied that same line multiple times. How do I make the spacing between theses lines of equal ditance? How do I align these lines so that they are basically at the same starting point on the left side of the page? Any assistance would be greatly appreciated! Regards, Mercury The best way would be to create guidelines. Select your created line, while holding the ctrl, (the cursor will turn into a + sign) pull the copy to the next guideline. If you go the copy route, ...

Converting Excel table with multi-line cells into Access DB
Hello ~ I need to export a MSWord table to an Access table. The original Word table contains multiple lines of text in each cell, separated with carriage-return(line return). .. I would like to retain these multiple lines within in each destination field in Access or Excel I have the following structure in my Word table: Column1: PhotoID (alphanumeric,single line) Column2: Image of the photos(jpeg/bmp) Column3: Description(text, multiline) Column4: Code#(alphanumeric, single line) Column5: Notes(text, multiline) In short, how do you tranfer those multi-line cells(with carriage-return...

Skipping a line by condition
Thanks for reading this. I have a report that is grouped by [positiontitle] in a two column report. It prints out ok. The thing is what I want it to do is when a new [positiontitle] comes up I want it to skip a line in the report. For example: Worker George Fred Non Worker Bill Tom The way it comes up now is: Worker George Tom Non Worker Bill Tom The [positiontitle] is located in the header of the report. Thanks for your help. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/2...

Step Line Charts
Does anyone know how I can create a step line chart without having to have 2 data points per x-axis point. What I want is a horizontal line until the next data point and then I want the line to go vertical. Hi Carrie, You Will need some form of extra data to get excel to create a step chart. Take a look at these methods. (http://www.andypope.info/charts/stepchart.htm) Carrie wrote: > Does anyone know how I can create a step line chart without having to have 2 data points per x-axis point. What I want is a horizontal line until the next data point and then I want the line to go vert...

Line colors in a bargraph
ColorNum and m_Array are set before entry which works fine except for all bars are outlined in black which is not a major problem, but would like to eliminate. How do I draw the line in the code below a different color than the bars? Below is a snip from my BarChart() routine: CBrush BlackBrush(RGB(10,10,10)); CBrush CyanBrush(RGB(1,39,229)); CBrush MagentaBrush(RGB(176,4,174)); CBrush YellowBrush(RGB(187,176,3)); CBrush GrayBrush(RGB(230,230,230)); if (m_Array.GetSize()) { // ***** THE PROBLEM IS HERE WHERE I WOULD LIKE THE DRAWN LINE TO BE LIGHT GRAY ***** MemDC.Sele...

Please help me .... (CListCtrl multi-line column)
Dear all, I use VC++ 6.0 MFC CListCtrl. And, some data displayed in the control contains multiple lines. By default, the control displays the multiple-line text in a single line. In the multiple-line text, it uses "\r\n" (CR-LF). How can I set the column of CListCtrl to display the column text in multiple line like the data cell in Excel? -- Kathy This is the nearest i can find. Hope it helps http://www.codeguru.com/Cpp/controls/controls/lists,treesandcombos/article.php/c2291/ "Kathy" wrote: > Dear all, > > I use VC++ 6.0 MFC CListCtrl. And, some data di...

OWA - Hangs "Loading" Inbox
2 of our OWA servers have recently stopped functioning. The login appears ok and the interface starts to load, but the fonts are wrong (times new roman is shown) and the inbox doesn't load at all, showing "Loading..." I've searched the forums/web and can see many people had the same issue, but have found no fixes that work. "Error on Page" Line: 56 Char: 1 Error: Object expected. Any suggestions or help really will be gratefully received. Thanks I had this same issue except one of my owa boxes would work and the other one didn't. I don't have a KB ar...

How to: text color depend on value
Anyone know how to make the text change colors, depending on what valu certain data is? I'm sure it's easy... -- bobsmith58 ----------------------------------------------------------------------- bobsmith58d's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1452 View this thread: http://www.excelforum.com/showthread.php?threadid=26148 bobsmith58d Wrote: > Anyone know how to make the text change colors, depending on what valu > certain data is? I'm sure it's easy.... Go to Format/Cells/Custom and inside the "Type" box, choose th...

Line chart with value on the line
Hi, I have implement a line chart by thousands of data rows for a stock. Now I want to show values on 10 particular points with the lable E.g, one extra column for displaying the label. TradeDate Ticker Close Label 04/01/1999 1234 63.67 05/01/1999 1234 63 06/01/1999 1234 63 Mr. A buy 07/01/1999 1234 67.33 08/01/1999 1234 68.33 11/01/1999 1234 68.67 Mr. B buy Does anyone teach me how to do this ?? thanks Ginola "Ginola" <ginola@fake.email.com> schrieb im Newsbeitrag news:3fdc1aa6.8209734@msnews.microsoft.com... > Hi, > > I have implement a line chart b...

removing black lines
Sometimes I type an underline bar across the page. At the end of the page I'll hit the return (enter) key. When I do, the underline bar turns into a big black bar. Then I can't get rid of it. It just stays there. How can I get rid of this black bar? See http://word.mvps.org/FAQs/Formatting/CantGetRidOfLine.htm -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> &...

want to filter out emails, with subjest line starting with a specfic sring
Hi All, I am using MS outlook 2003, I am trying to find out how can i create a rule to filter out emails with subject line starting with a specific string, but not to filter if that string is in the middle of subject line. i.e. lets take the sting as Foo Filer if Foo is in the starting don't filter if if the Foo is not in the starting. if any of you aware of the trick to make this happen please let me know, i tried to google it, but couldn't find anything related to it. Thanks Anand outlook doesn't offer anyway to build that sort of rule. If you can coun...

Button text and bg color does not change
Changing the the COLOR_BTNFACE and COLOR_BTNTEXT with SetSysColors, does not seem to work for buttons under XP style. Is this correct? And what are the options? Hi, yes, in Common Controls 6 with Visual Styles enabled you should process NM_CUSTOMDRAW (button) notification. -- WBR, Vitaly Brusentsev, AWinstall development team. http://www.awinstall.com mailto:vb@awinstall.com "Sveinung" <sveinung@marine-technologies.com> wrote in message news:087d01c38ffb$66a57ab0$a101280a@phx.gbl... > Changing the the COLOR_BTNFACE and COLOR_BTNTEXT with > SetSysColors, does not s...

HEX/RGB color value to &H conversion
I know the HEX and RGB value of a code, but do not know the &H... value. Anybode knows a converison tool on the web, or what is the VB code. I want to fill it as color value for the backgroundcolor of a command button. Bart Bart, not sure but the addin here http://www.andrewsexceltips.com/my_utilities.htm will make a sheet showing the colors and Color Index ,HTML Colors, RGB Index, Color Name you may want to give it a try and see if that is what you are looking for, when you install it, look under other unities # 19 -- Paul B Always backup your data before trying something new Ple...

Line graph question
How do I get my date axes (the horizontal axes) to start at zero followed by the first day of the month. -- WH99 Hi, If your dates are entered in the spreadsheet as dates then you may have problems - Excel stores dates as numbers so today is 39594 and 0 would be January 0, 1900. This would tend to spread the x-axis out quite a ways. If your dates are not entered as dates then make the first entry 0,0 - that is put another entry in the data area whose date value is 0 and whose value is 0. There are potential problems with this approach - each entry will be spaced equidistant apart ...

formatting color based on source column
Hi and thanks to anyone who reads this. I have a worksheet which contains two columns of dates. In a second worksheet i have a column which adds the two dates together as TEXT and ommits dates which are blank which works perfectly, however: I would like to know how i could format each of the 2 dates in the 1 cell to have different font colors? Here is my existing cell formula: =IF('Data'!E2=0,"",(TEXT('Data'!E2,"dd/mm/yy"))&" "&IF('Data'!F2=0,"",TEXT('Data'!F2,"dd/mm/yy"))) I have a feeling its not ...

reading line by line
Dear all, I have a big problem, but I don't known how excel can solve it. I have a sheet with like it: process process_line status values_USD 0255155 10 44 10 0255155 20 44 20 0255156 10 33 11 0255156 20 44 21 0256157 10 33 12 0256157 20 33 22 0256157 30 33 23 0256158 10 ...

Adding background color to an existing field in a table
My earlier post on changing font color was mis-stated. I'm trying to add a background color in one data field in a simple Access database and can't seem to make that happen. I've tried using the [color] option in the Format section in Design View in Table Properties but that doesn't work. Samcam - Change the Back Color property, not the Format. -- Daryl S "samcam" wrote: > My earlier post on changing font color was mis-stated. I'm trying to add a > background color in one data field in a simple Access database and can't seem ...

Adding a line to the line/column chart?
Is there anyway I can add a second line to the line/column chart? Basically I have 3 sets of data that I want to plot vs. time on the same graph. 1 using the column format, the other 2 being lines connected by data points. Create the chart using all the data, right click on the one you want to change to a line and select chart type from the dialogue box and choose the type you want. There are a few restrictions on the mix you can have though. -- John MOS Master Instructor Please reply & rate any replies you get Ice Hockey rules (especially the Wightlink Raiders) "Steven"...

Can I link timeline labels to a line chart?
I've been trying to do this for a bit and can't seem to find a way. I am trying to do a line chart of weekly sales for two product lines over several years (2 separate lines). What I would like to do is overlay labels for press releases (so you can see if they have an impact on sales) on the same chart, and have a line from the name of the press release to the correct corresponding point on the line chart that is "active", so as more points are added to the chart, the line indicating the unit corresponding to the date of the press release will move also. Additionally, the...

fonts line by line
I'm doing line by line translation. How can I easily use different fonts for alternating lines? Assuming you're pressing Enter at the end of each line, so each line is a separate paragraph: Define two paragraph styles, one for each font.* In the definition of each style, specify the other style as the "style for following paragraph". *In case you don't know, to define a style, click Format > Styles and Formatting (Word 2003 and earlier) or press Ctrl+Alt+Shift+S (Word 2007) to open the Styles pane, then click the New Style button. -- Regards, Jay ...

Dynamically control how many lines on a graph?
I apologize if this is a FAQ, for some reason my newsreader isn't picking up any messages from this group (looks like no postings) so hopefully I'll be able to access responses, if not, I'll googlesearch for responses later today and tomorrow... ------------------------------------------------ I have many sets of data, all on the same sheet (in a repeated pattern- starting in row 1, then 11, then 21, etc) My single graph is based on named ranges, and the named range(s) are based on Steve Bullen's funchart1 (autoexpanding chart) to control how many x-axis values are shown- whic...

Write from one file to a specific line of another
I need to make Excel read a value from a specific cell (A3 for instance) in a specific file (Input file), read a group of cells on that file (for instance D5:G5) and write them in a specific row (that corresponds to the value in cell A3) on a different file (Database). It would be really helpfull if somebody could give me some help on that. Thanks in advance Savvo, Would you want to overwrite the values that are already there, or would you want to insert a blank row? Is the value in A3 a row number? Where to you want D5:G5 to go? D to G of Database? Or would you rather that the numbers j...

Default Border Color Problem
I have Excel 2002. When I try to add a border to a cell, the color defaults to light grey instead of black, even though the color control under Format>> Cells>> Border says "Automatic". How can I change the default color for automatic to be black instead of light grey for ALL spreadsheets? I've seen a similar string about this before, but there was never a resolution that worked. looking forward to your help! bb Hi! One possibility: Goto>Tools>Options>View Under Window Options make sure Gridlines color is set to Automatic. Biff "Bobbie&qu...

Printing in "Coloring-Book" mode...
Can Publisher 2002 be set up to print in "coloring-book" mode so that my children can color the clip-art found in the publisher library? momof2inaz wrote: > Can Publisher 2002 be set up to print in "coloring-book" mode so that > my children can color the clip-art found in the publisher library? ============================= Insert the clip you want and on your Picture Toolbar...click...Color / Black and White. And...there's lots of coloring pages you can find with a google image search: Have a look: http://tinyurl.com/ylsfng -- ******John Inzer******** **M...

simple line graph
I am a church consultant, and I want to make a simple line graph to paste into my Powerpoint presentation, showing the rise and fall of our membership numbers, from nothing up to 11 million, and then down to 7 million. I don't know how to do that. Tom in Texas Why not just create the chart in PowerPoint? It uses the same tools, as does Excel. You don't give enough info regarding the data to be plotted for any specific direction, but if you have a look at either Word or PPT Help on the topic: Create a chart you shouldn't have any problem. HTH |:>) Bob Jones ...