How to display selection handles

Hello all,

A quick question .. I have been developing Windows Apps for some time, 
but heretofore have not had the requirement to display graphics in a 
document view that have to be selectable via a left mouse click.

The standard Windows procedure to to left click the graphic and have the 
graphic highlighted via display of the familar selection rectangles.  
These 
selection rectangles are typically small filled black rectangles on the 
periphery of the graphic.  For a line, these selection rectangles are at 
the endpoints.  For a rectangle, the selection rectangles are at each 
rectangle corner (vertex) and at the midpoint of each side. The filled 
rectangles seem to be 2 x 2 or 4 x 4 (in terms of pixels).

I assume that MFC or the Windows API already has this functionality 
implemented, as it seems to be ubiquotous in the Windows world.  I have 
looked at various sample pieces of code supplied with VS .NET 2003 and 
while some of these samples (drawcli, for example) have this 
functionality implemented, I can not trace the code to find where these 
rectangles are commanded to be displayed.

Darn ..

Can anyone enlighten me on how to display these selection rectangles?

Regards,

Harvey


0
2/17/2005 7:48:45 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
731 Views

Similar Articles

[PageSpeed] 50

The program draws that itself.  Look at the CDrawObj::DrawTracker method.

If you follow the code in the CDrawView::OnDraw method, you see that toward
the end it calls CDrawDoc::Draw(..) which in turn loops throw all the
available objects and tells them to draw themselves, and if the object is
the selected object then it calls DrawTracker on it.

If it was me I would tell the object that it is selected, so that when it is
told to draw itself it can draw it's size boxes also.

AliR.

"Harvey J Cohen" <HarveyNOSPAM.Co_NOSPAM_hen@adelphNOSPAMia.net> wrote in
message news:MIidnb5sYuGAaInfRVn-jw@adelphia.com...
> Hello all,
>
> A quick question .. I have been developing Windows Apps for some time,
> but heretofore have not had the requirement to display graphics in a
> document view that have to be selectable via a left mouse click.
>
> The standard Windows procedure to to left click the graphic and have the
> graphic highlighted via display of the familar selection rectangles.
> These
> selection rectangles are typically small filled black rectangles on the
> periphery of the graphic.  For a line, these selection rectangles are at
> the endpoints.  For a rectangle, the selection rectangles are at each
> rectangle corner (vertex) and at the midpoint of each side. The filled
> rectangles seem to be 2 x 2 or 4 x 4 (in terms of pixels).
>
> I assume that MFC or the Windows API already has this functionality
> implemented, as it seems to be ubiquotous in the Windows world.  I have
> looked at various sample pieces of code supplied with VS .NET 2003 and
> while some of these samples (drawcli, for example) have this
> functionality implemented, I can not trace the code to find where these
> rectangles are commanded to be displayed.
>
> Darn ..
>
> Can anyone enlighten me on how to display these selection rectangles?
>
> Regards,
>
> Harvey
>
>


0
AliR1 (391)
2/17/2005 8:00:29 PM
Harvey,

To ease your work, do I dare recommend my own CDiagramEditor on CodeProject?

http://www.codeproject.com/miscctrl/diagrameditor.asp

This is a complete and free framework for vector editing that you can derive
from and incorporate in your own application. There is also an UML- and
flowchart editor based on the framework on CodeProject.

Johan Rosengren
Abstrakt Mekanik AB

"Harvey J Cohen" <HarveyNOSPAM.Co_NOSPAM_hen@adelphNOSPAMia.net> a �crit
dans le message de news:MIidnb5sYuGAaInfRVn-jw@adelphia.com...
> Hello all,
>
> A quick question .. I have been developing Windows Apps for some time,
> but heretofore have not had the requirement to display graphics in a
> document view that have to be selectable via a left mouse click.
>
> The standard Windows procedure to to left click the graphic and have the
> graphic highlighted via display of the familar selection rectangles.
> These
> selection rectangles are typically small filled black rectangles on the
> periphery of the graphic.  For a line, these selection rectangles are at
> the endpoints.  For a rectangle, the selection rectangles are at each
> rectangle corner (vertex) and at the midpoint of each side. The filled
> rectangles seem to be 2 x 2 or 4 x 4 (in terms of pixels).
>
> I assume that MFC or the Windows API already has this functionality
> implemented, as it seems to be ubiquotous in the Windows world.  I have
> looked at various sample pieces of code supplied with VS .NET 2003 and
> while some of these samples (drawcli, for example) have this
> functionality implemented, I can not trace the code to find where these
> rectangles are commanded to be displayed.
>
> Darn ..
>
> Can anyone enlighten me on how to display these selection rectangles?
>
> Regards,
>
> Harvey
>
>


0
2/20/2005 7:22:18 AM
Harvey,

First, Johan Rosengren's CDiagramEditor is phenomenal, especially 
considering the price (free).

But, you may want to start with something a little easier.  MS has a sample 
called Blocks32 that
demonstrates the idea of graphic objects and makes extensive use of the 
CRectTracker class.

Good Luck
RickL




"Johan Rosengren" <johan.rosengren@telia.com> wrote in message 
news:OiGfg3xFFHA.3200@TK2MSFTNGP10.phx.gbl...
> Harvey,
>
> To ease your work, do I dare recommend my own CDiagramEditor on 
> CodeProject?
>
> http://www.codeproject.com/miscctrl/diagrameditor.asp
>
> This is a complete and free framework for vector editing that you can 
> derive
> from and incorporate in your own application. There is also an UML- and
> flowchart editor based on the framework on CodeProject.
>
> Johan Rosengren
> Abstrakt Mekanik AB
>
> "Harvey J Cohen" <HarveyNOSPAM.Co_NOSPAM_hen@adelphNOSPAMia.net> a �crit
> dans le message de news:MIidnb5sYuGAaInfRVn-jw@adelphia.com...
>> Hello all,
>>
>> A quick question .. I have been developing Windows Apps for some time,
>> but heretofore have not had the requirement to display graphics in a
>> document view that have to be selectable via a left mouse click.
>>
>> The standard Windows procedure to to left click the graphic and have the
>> graphic highlighted via display of the familar selection rectangles.
>> These
>> selection rectangles are typically small filled black rectangles on the
>> periphery of the graphic.  For a line, these selection rectangles are at
>> the endpoints.  For a rectangle, the selection rectangles are at each
>> rectangle corner (vertex) and at the midpoint of each side. The filled
>> rectangles seem to be 2 x 2 or 4 x 4 (in terms of pixels).
>>
>> I assume that MFC or the Windows API already has this functionality
>> implemented, as it seems to be ubiquotous in the Windows world.  I have
>> looked at various sample pieces of code supplied with VS .NET 2003 and
>> while some of these samples (drawcli, for example) have this
>> functionality implemented, I can not trace the code to find where these
>> rectangles are commanded to be displayed.
>>
>> Darn ..
>>
>> Can anyone enlighten me on how to display these selection rectangles?
>>
>> Regards,
>>
>> Harvey
>>
>>
>
> 


0
nospam2504 (11)
2/21/2005 5:41:32 AM
Reply:

Similar Artilces:

How to handle blank date and time?
I use MFC Visual C++ 4.2 I am developing a database application using MS Access 2000. The problem I am dealing with is how to handle if the user does not enter the date. There is a condition where they can do that for Finish Process Date / Finish Process Time. I make the Date and Time as separate fields, both in the database and the application. On my application I use the COleDateTime data type. I have to save the blank Date and the blank Time, and I also have to acquire them back in order to display the data using the CListCtrl. What I am confusing is how to make the query? Is it...

Dual Displays
I want to connect my Sharp Aquos flat screen TV to my computer, and see my desktop on both the TV and computer monitor. Windows Vista Home Premium. HP Pavilion a1610n computer. Galaxy GeForce 8400 GS graphics card, outputs: 1-VGA, 1-DVI, and 1-SVGA. There is no HDMI port on the card. I connected a VGA cable between the motherboard "on-board" VGA port and the TV, figuring that I could use that output to work with the TV. The computer monitor is plugged into the GeForce graphics card. Tried the Desktop "Display Setting". It says, the number 2 monitor is "N...

Vba code cannot select text pasted from .txt file
The data I'm working with is from a .txt file which was created by exporting a .pdf to a text file. I copy all of the text from the .txt file and paste it into a column in Excel. When trying to reference any column, row, or range on the sheet with the pasted text, I get the following error: Run-time error '1004': Application-defined or object-defined error. Sample code: Sheets("Sheet5").Select ' <this works fine Columns("A:A").Select ' <this gets the error I've tried pasting the text with other paste special options. I'v...

Folder could not be displayed
I am running Windows XP and Outlook Express 6 just fine then one day my husband does something to my computer and his email account won't work. My email is working just fine but in his he cannot open his inbox. It says folder could not be displayed, and when you send and receive it gives you this error message: "An unknown error has occured. Account: 'incoming.verizon.net'. Server:'incoming.verizon.net'.Protocol:POP3, port: 110, Secure(SSL): No, error number: 0x800C013B" If anyone could help me with this I would greatly appreciate it. Thank you T...

Display a message box "this entry is a duplicate"
How can I display a message box on a form if the shipment number is a duplicate? I need a message box to pop up when user attempts to tab out of the field. Thank you. Something like: Private Sub txtShipNum_BeforeUpdate(Cancel As Integer) If DCount("*", "MyTable", "ShipNum = '" & Me.txtShipNum & "'") > 0 Then Msgbox Me.txtShipNum & " already exists." Cancel = True End If End Sub This assumes that your text box is named txtShipNum, that the name of the field in table MyTable is ShipNum...

how to display values in 3 cells into one cell
Anyone can help me how do I display the 3 separate different values in 3 cells into just one single cell ? thanks so much in advance. Either there was a typo or there's an echo in here. That line should have been: = A1 & " " & B1 & " " & C1 "Bradley Dawson" <bradleydawson@earthlink.net> wrote in message news:l464b.2224$Lk5.2093@newsread3.news.pas.earthlink.net... > In the target cell, type: > > = A1 & B1 & C1 > > where A1, B1, C1 are the cell addresses that you want to concatenate. > > If these have number...

How to select & display distinct values
Hello, I need help with a form please. My form has two controls, the first being a combo box. This box should select the company name from a lookup table. The lookup table has only two companies in it, however, they each are repeated several time. Company 1 has about 10 rows, company 2 has 3 rows. I used the query builder and came up with the statement: "SELECT DISTINCT Lktbl_Role_Master.CompanyName FROM Lktbl_Role_Master;" When I run the statement directly from query view, it executes perfectly and returns exactly two rows (one for each company, in a datasheet view) ho...

Display Time in Outlook
The time setting in my Outlook is one hour behind my actual time. I cannot determine how to change the time. Outlook is the only item that is incorrect. Other display times in operating system are correct. Thanks, Jodi ...

PK and FK Displayed
I am a complete Visio newbie, and cannot find the answer I need in books or online help. I am trying to create ER diagrams from scratch, and not connected to real tables, using VEA. I have added tables ('Entities') to the form, connected them with a Relationship connector, and, in the Database Properties window I've assigned the end points to a Primary Key on the left and a Foreign Key on the right. But the model shows the connector as running between the top colums on both sides, whereas I want the keys to be in that upper box and provide the connector's end points. Wh...

How do I shade a region between two selected points on the x axis?
In a line graph of monthly unemployment rates over many years, economists like to shade a region between 2 selected months (x axis) in order to denote a recsession. How can this be done in an Excel chart? Hello: I am sure that someone very cleaver will tell you there is an automated way to do this. But given the irregular nature of the data, and not frequently the easiest way to do it would be to dislay the drawing toolbar. Now choose the rectangle shape and draw the area you want high lighted. Once you have the area you want covered, right click the rectangle and choose format autosh...

Formulas are displayed, results are not
Hello, For some reason, when I enter a formula into a cell and press enter, the formula just stays there. Anyone know what I can do to show the results? I tried pressing Cntrl + `, but that didn't work. FYI, when I cut and paste a column from a separate workbook, that column works like normal (i.e., the formulas produce results). Thanks for any suggestions! Hi Mike, Maybe your cell is preformatted as Text. Try formatting to general then erase your = and type it in again. HTH Martin "Mike C" <js2k111@yahoo.com> wrote in message news:f699bcd4-ad82-4a88-9759-5638c147b...

Stop displaying a line
I have a line graph/chart and it gets its values using a formula and the values of another column. However this poses a problem because if there is nothing in the targetted column the formula returns 0 cause the line to drop to the bottom, instead of casuing the line to just end until a value is added to the target column. How can I do this? Change your formula to use NA() if the cell is empty. For example: =IF(A1="",NA(),A1) To hide the resulting #N/A errors on the worksheet, you can use conditional formatting. There are instructions here: http://www.contextures.com/xlC...

A question about Console window(display or not display)
I've redirected the (stdin stdout stderr) of a console window process I spawned to a pipe. And I want to display the redirected console window, the question is: If I display it(set Create_new_CONSOLE in createprocess and some flags in startupinfo), I cannot use the redirected way of pipe, which means if i do not display, i can use the pipe communicating with the child process. Does it mean that as long as I disply the console window, windows will change stdin stdout to "screen&keyboard" instead of my pipe? That's right. If you redirect stdin or stdout then you preemp...

unattached textboxes disappear when a msgbox is displayed on a tab control
I'm using Access 2003. I have a form with a tab control on it. I was having problems with labels flashing and I followed the suggesting from Allen Browne - http://allenbrowne.com/ser-46.html. The flashing went away but now when a msgbox is displayed the unattached textboxes that I'm using as labels disappear. They come back as soon as the msgbox is removed from the screen. I've searched google looking for an answer but have come up short. Does anyone know why I'm experiencing this behavior and how to make it go away? Thanks, Rick That *is* strange. Have you tr...

Axis not highlighting when viewing selections
Hello! When using Office 2003, we are experiencing a problem with excel graphs. When viewing the source data, I select a series. Then choose the X Values, it WILL show the selected values. I then close out of that which takes me back to the Source data, I then choose the Y Values. This does NOT show the selected values. I tried going directly to the Y Values first on another series, and it appears that whichever axis is selected first will show, the second will not. This is a major hassle when you are dealing with complicated graphs that contain many many rows and several diff...

More than one cell is selected when I left click. Why?
I have an Excel 2007 worksheet. When I left click on a cell, instead of that cell having a box around it, the selection box is around that cell and 5 others under it. And when I try to select a row, that row and five below it are selected. How do I fix this? I'm betting that you have merged some cells. This gives the appearance of a giant cell. Rightclick on that cell Format|cells|alignment tab|uncheck merge (select all the cells on the worksheet first to get get rid of all these merged cells) womusic wrote: > > I have an Excel 2007 worksheet. When I left click on a cell,...

Select column range in VB?
Hi - I am using MS XL 2002 and I have created a macro that inputs data to a specific cell. I want the macro to input this data in a range of cells; the data should be input into all the same row cells in column A, providing there is data in the same rows in Column B. For example, it should look at column B, realize that there is data in all cells B2:B121 and input the data into cells A2:A121 I am not concerned with the inputting of the data, it is specifying the range of cells to be affected that I am having trouble with. Hope that is clear enough...... Thanks! Alan Sub demo() Dim r As...

does Excel support multiple display monitors?
Hello All Excel Experts How do I move chart windows to multiple display montors?? (one computer runnng three monitors... Excel Charts will not move off the primary monitor. Your advice is EXTREMELY appreciated thanks. Denni ...

Display or not display series
I have a graph with four series but some of the series may be blank, i.e. the series name is <blank series>. Is there a way to not display these series on the graph and/or legend if they are blank, and display them if they are without deleting the series? Thanks! Clay Create a chart from all the data Select the data on which the chart is based. Choose Data>Filter>AutoFilter In the heading cell for the series name column, select (NonBlanks) from the dropdown list The series with blank name cells will be hidden in the chart. Clay wrote: > I have a graph with four serie...

Displaying an equation
I have an equation setup that is referencing a few other cells that have equations in them. I want to have a cell that displays this equation with the answers that are calculated from these other cells displayed as values in the new equation. Any help would be greatly appreciated. Thanks Check out http://www.mvps.org/dmcritchie/excel/formula.htm#getformula In article <E4143E2B-360A-4B43-955F-73BF8EC60694@microsoft.com>, "hoising8" <hoising8@discussions.microsoft.com> wrote: > I have an equation setup that is referencing a few other cells that have > eq...

how to handle Emplyee Stock Purchase Plan
I'm not sure how to handle an employee stock purchase plan in Money 2006? I have deductions from my paycheck that go into a special Fidelity Account. At the end of the year stock is purchased using this account at a 15% discount to the minimum of a) price at start of period or b) price at the end of the period. I also do not appear to be able to download transactions from Fideilty related to this account. My brokerage and 401K accounts are fine but I cannot see how to link to the ESPP. TIA KIWI > I have deductions from my paycheck that go into a special Fidelity Account. &g...

storing multiple list selections in access
i have 2 tables, table a and table b. is it possibile for a control bound to table a (a list box, with multiple selections eneabled) to be able to select multiple records from table b, and store them? i.e. table A record 1 has table B records 1,2,3,4,8,12, and so on selected while Table A record 2 only has table B records 3, 8 and 15 selected, and so on.. is there some way to store those selections within table A? for those curious, i'm making a character sheet for an RPG.. table A is the actual sheet, while B is the list of spells.. i'm looking for a way to store which spells each ...

Serialisation
A general query Im serialising a person object with the following member variables Class Person Private _forenames As String Private _surname As String Private _dob As Date Private _marital_status As MaritalStatus 'Public Get and Set Properties here for each of the above ' I'll not detail them all to save space but Ill show attributes <XmlElementAttribute(Elementname:="forename")> _ <XmlElementAttribute(Elementname:="surname")> _ <XmlElementAttribute(Elementname:="dob"...

Selecting gridlines using VBA
Hi, I'm writing a Macro to smarten up some graphs. I get a problem when trying to format the style of the gridlines. I get the error "Select method of gridlines class failed". The code below works fine on graphs with only a primary axis, but doesn't when you have primary and secondary axes. What am I doing wrong? ActiveChart.Axes(xlCategory).MajorGridlines.Select With Selection.Border .ColorIndex = 16 .Weight = xlHairline .LineStyle = xlDot End With Hi Jon, You can test whether the gridlines are being used first. You can also sp...

New Email does not display
When new email arrives you don't know it. You don't know you have new mail until you click on an existing email in your inbox. Any ideas? It's a setting. But... 1. You don't tell us the program you're using. 2. We can't guess if it's Outlook or Outlook Express. 3. This is the Excel newsgroup; you're in the wrong place. :) ******************* ~Anne Troy www.OfficeArticles.com "Travis" <Travis@discussions.microsoft.com> wrote in message news:D864BC01-7D98-48DA-A132-614D02E45963@microsoft.com... > When new email arrives you don't know ...