Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with System.IO, Please Help Pin
Shadow Sprite27-Apr-06 23:59
Shadow Sprite27-Apr-06 23:59 
QuestionHow to stop Backgroundworker ? Pin
ALQallaf27-Apr-06 12:50
ALQallaf27-Apr-06 12:50 
AnswerRe: How to stop Backgroundworker ? Pin
Josh Smith27-Apr-06 13:07
Josh Smith27-Apr-06 13:07 
QuestionDrawReversibleFrame? Pin
melanieab27-Apr-06 10:08
melanieab27-Apr-06 10:08 
AnswerRe: DrawReversibleFrame? Pin
Guffa27-Apr-06 10:23
Guffa27-Apr-06 10:23 
GeneralRe: DrawReversibleFrame? Pin
melanieab27-Apr-06 11:08
melanieab27-Apr-06 11:08 
AnswerRe: DrawReversibleFrame? Pin
Guffa27-Apr-06 14:07
Guffa27-Apr-06 14:07 
GeneralRe: DrawReversibleFrame? Pin
melanieab28-Apr-06 9:57
melanieab28-Apr-06 9:57 
Thank you very much for that explanation! That clears up one of the mysteries.

What my problem has been from the start is that when I load a tabpage, if the first control is one of my buttons, it doesn't highlight and you can't tell that it has focus. What I've been doing to get around this is to focus on the control that's one tabstop before my button and SendKeys.Send("{Tab}"); which does highlight the button. As soon as a button on the tabpage has been highlighted, all buttons will highlight when focused on until I leave the tabpage and return again.

So I've deleted the focus call since the button has tabstop 0. I want the rectangle to disappear when focus is lost, so if it would just draw this first time, I'd be happy (is there a way to tell the system that it has control without having to call anything?). But nothing at all draws after deleting the button2.Focus(), regardless of whether there's a MessageBox before, after, or not at all.
So I tried adding the PaintEventArg for the button and moved the code into it. I also added a bool called focus since I only want the button to have the rectangle when it's in focus.
private void focusPaint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
    {<br />
        if (focus == true)<br />
        {<br />
            int x = toggleLength.ClientRectangle.Location.X + 3;<br />
            int y = toggleLength.ClientRectangle.Location.Y + 3;<br />
            int w = toggleLength.ClientRectangle.Width - 6;<br />
            int h = toggleLength.ClientRectangle.Height - 6;<br />
            Rectangle r = new Rectangle(x,y,w,h); <br />
            ControlPaint.DrawFocusRectangle(e.Graphics, r, Color.Red, Color.Red);<br />
            focus = false;<br />
        }       <br />
    }

This results in me never being able to move to another control (using the up/down arrow keys - only with the mouse). When I returned control to the system (by adding a Messagebox above the if (focus == true)), I could move without problem.
I also noticed that if I replace the e.Graphics with my original Graphics.FromHwnd(toggleLength.Handle), it wouldn't draw with or without system control, which I don't understand. (Maybe if I get that working I wouldn't need to add a Paint event?)
I'm not sure what else to try.
Thanks so much for any thoughts!!!!!!
Mel


-- modified at 15:59 Friday 28th April, 2006
QuestionTips for writing a Web Service in C# which will be used by a Java app... Pin
Josh Smith27-Apr-06 9:49
Josh Smith27-Apr-06 9:49 
QuestionThe correct way to dispose of objects Pin
Mark0627-Apr-06 9:32
Mark0627-Apr-06 9:32 
AnswerRe: The correct way to dispose of objects Pin
Colin Angus Mackay27-Apr-06 10:00
Colin Angus Mackay27-Apr-06 10:00 
QuestionRichTextBox tables Pin
Authorof2227-Apr-06 9:24
Authorof2227-Apr-06 9:24 
QuestionWriting Web Control Library Pin
thompson_3827-Apr-06 8:50
thompson_3827-Apr-06 8:50 
AnswerRe: Writing Web Control Library Pin
Josh Smith27-Apr-06 13:03
Josh Smith27-Apr-06 13:03 
Questionexpander control Pin
awu2527-Apr-06 8:25
awu2527-Apr-06 8:25 
AnswerRe: expander control Pin
Ravi Bhavnani27-Apr-06 8:37
professionalRavi Bhavnani27-Apr-06 8:37 
QuestionCalling a method in another form Pin
awu2527-Apr-06 8:24
awu2527-Apr-06 8:24 
AnswerRe: Calling a method in another form Pin
S. Senthil Kumar27-Apr-06 18:29
S. Senthil Kumar27-Apr-06 18:29 
QuestionOverride TextBox portion of a ComboBox? Pin
secovel27-Apr-06 7:46
secovel27-Apr-06 7:46 
AnswerRe: Override TextBox portion of a ComboBox? Pin
Robert Rohde27-Apr-06 8:22
Robert Rohde27-Apr-06 8:22 
QuestionRotate the world Pin
Sabry190527-Apr-06 7:43
Sabry190527-Apr-06 7:43 
AnswerRe: Rotate the world Pin
Anubhava Dimri28-Jun-10 19:24
Anubhava Dimri28-Jun-10 19:24 
QuestionHow to retrieve DVD interfaces from a custom DirectSHow graph? Pin
manusse27-Apr-06 5:45
manusse27-Apr-06 5:45 
AnswerRe: How to retrieve DVD interfaces from a custom DirectSHow graph? Pin
manusse28-Apr-06 1:00
manusse28-Apr-06 1:00 
QuestionDatalist with CheckboxList Pin
ZeedijkMike27-Apr-06 4:38
ZeedijkMike27-Apr-06 4:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.