473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to set DrawFocusRectangle()?

How can I set e.DrawFocusRectangle() correct in an owerdrawn
multiselect listbox?

I do all my drawing (e.g. OnMouseMove) calling OnDrawItem and
constructing the DrawItemEventArgs. The problem is that I never know
exactly when to draw the focus rectangle. The DrawFocusRectangle()
method is always called, but keeping track of which DrawItemState
needed to pass is hard work. I have a gut feeling this can be done
easier, but don't know how. It seems redundant that I will need to
pass on every time a mouse click is done or arrows or pgup/dn/home/end
etc are pressed. This info must be kept somewhere in the listBox, I'm
sure.

- Peder -
Nov 16 '05 #1
3 5144
ControlPaint.DrawFocusRectangle(........);

Maybe?

"Peder Y" <py*****@ec.auckland.ac.nz> wrote in message
news:10**************************@posting.google.c om...
How can I set e.DrawFocusRectangle() correct in an owerdrawn
multiselect listbox?

I do all my drawing (e.g. OnMouseMove) calling OnDrawItem and
constructing the DrawItemEventArgs. The problem is that I never know
exactly when to draw the focus rectangle. The DrawFocusRectangle()
method is always called, but keeping track of which DrawItemState
needed to pass is hard work. I have a gut feeling this can be done
easier, but don't know how. It seems redundant that I will need to
pass on every time a mouse click is done or arrows or pgup/dn/home/end
etc are pressed. This info must be kept somewhere in the listBox, I'm
sure.

- Peder -

Nov 16 '05 #2
Never mind, maybe I should try reading the whole post before answering. Duh

"Rene" <no****@nospam.nospam> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
ControlPaint.DrawFocusRectangle(........);

Maybe?

"Peder Y" <py*****@ec.auckland.ac.nz> wrote in message
news:10**************************@posting.google.c om...
How can I set e.DrawFocusRectangle() correct in an owerdrawn
multiselect listbox?

I do all my drawing (e.g. OnMouseMove) calling OnDrawItem and
constructing the DrawItemEventArgs. The problem is that I never know
exactly when to draw the focus rectangle. The DrawFocusRectangle()
method is always called, but keeping track of which DrawItemState
needed to pass is hard work. I have a gut feeling this can be done
easier, but don't know how. It seems redundant that I will need to
pass on every time a mouse click is done or arrows or pgup/dn/home/end
etc are pressed. This info must be kept somewhere in the listBox, I'm
sure.

- Peder -


Nov 16 '05 #3
....when I invalidate the control, the win API kicks in and draws the
focusrectangle as it should be. Unfortunately, this is not an option
since it will cause a lot of flicker. I simply (?) need something to
test on (like an ideal Item.focused), so I can pass the proper
DrawItemEventArgs. Surely, someone must have bounced into problem
before...

- Peder -
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Karuppasamy | last post by:
Hi I have created a User Control. I want to set Dotted Border when the control is getting focus and also set it back to solid border when it loses its focus. How to do that? Thanks and...
7
by: GregT | last post by:
I program in C#. Is there a way to determine which of the local machine's logical drives are associated with CD drive(s)?
3
by: Jeroen Ceuppens | last post by:
I need a selection tracker on a graphic Idea: left click: rectangle appear en grows when you move the mouse, again clicking is lock te rectangle How do you do that? Greetz Jeroen
4
by: Beeeeeeeeeeeeves | last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
0
by: Peder Y | last post by:
I'm making an ownerdrawn multiselect multiextended ListBox where I'm calling the DrawItem event in my code on specific events and need to make my own DrawItemEventArgs. However, when do I need to...
0
by: Peder Y | last post by:
How can I set e.DrawFocusRectangle() correct in an owerdrawn multiselect listbox? I do all my drawing (e.g. OnMouseMove) calling OnDrawItem and constructing the DrawItemEventArgs. The problem is...
1
by: TT (Tom Tempelaere) | last post by:
Hi there, I made a custom drawn ComboBox. The DrawItem event handler is (explanation follows) <code> private void OnDrawItem ( object sender, System.Windows.Forms.DrawItemEventArgs e ) {
1
by: Lars Netzel | last post by:
Hi! In VB.NET want to draw my own items in a ComboBox I have added a ComboBox to the Form with this. -----------------------------------------------------------------------------------...
0
by: Brian Henry | last post by:
I cant seem to remember this one... I have a list view, and im owner drawing the items, i dont want the selection to hide when it loses focus so i have hideselection = false, but when i owner draw...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.