Click here to Skip to main content
15,921,028 members
Home / Discussions / C#
   

C#

 
AnswerRe: Sending Email using Hotmail Account Pin
Vasudevan Deepak Kumar7-Mar-06 21:16
Vasudevan Deepak Kumar7-Mar-06 21:16 
QuestionDetecting Hardware Button Press in C# Pin
Flynn Arrowstarr / Regular Schmoe7-Mar-06 10:16
Flynn Arrowstarr / Regular Schmoe7-Mar-06 10:16 
QuestionHighlight GridView Row at runtime Pin
mamatharam7-Mar-06 10:06
mamatharam7-Mar-06 10:06 
AnswerRe: Highlight GridView Row at runtime Pin
shaluhyd7-Mar-06 21:11
shaluhyd7-Mar-06 21:11 
Questionhow do I create a version of the server explorer? Pin
cakewalkr77-Mar-06 9:40
cakewalkr77-Mar-06 9:40 
QuestionHow to delete record from .csv file Pin
Rajendra Rana7-Mar-06 9:26
Rajendra Rana7-Mar-06 9:26 
QuestionDirectX - adding a bitmap to a drawing Pin
melanieab7-Mar-06 9:16
melanieab7-Mar-06 9:16 
AnswerRe: DirectX - adding a bitmap to a drawing Pin
melanieab8-Mar-06 9:55
melanieab8-Mar-06 9:55 
QuestionGMail CAPTCHA transform Pin
Joe Programm3r7-Mar-06 8:56
Joe Programm3r7-Mar-06 8:56 
AnswerRe: GMail CAPTCHA transform Pin
Steve Maier7-Mar-06 9:19
professionalSteve Maier7-Mar-06 9:19 
GeneralRe: GMail CAPTCHA transform Pin
Joe Programm3r7-Mar-06 9:39
Joe Programm3r7-Mar-06 9:39 
GeneralRe: GMail CAPTCHA transform Pin
Steve Maier7-Mar-06 10:16
professionalSteve Maier7-Mar-06 10:16 
AnswerRe: GMail CAPTCHA transform Pin
leppie7-Mar-06 11:38
leppie7-Mar-06 11:38 
QuestionInserting my C# component class in a MFC Window… Pin
anderslundsgard7-Mar-06 8:16
anderslundsgard7-Mar-06 8:16 
AnswerRe: Inserting my C# component class in a MFC Window… Pin
Judah Gabriel Himango7-Mar-06 8:47
sponsorJudah Gabriel Himango7-Mar-06 8:47 
QuestionClientRectangle in VS 2005 Pin
MBursill7-Mar-06 8:05
MBursill7-Mar-06 8:05 
AnswerRe: ClientRectangle in VS 2005 Pin
MBursill7-Mar-06 13:23
MBursill7-Mar-06 13:23 
After doing some research (and using Reflector to poke around in the ClientRectangle property) I can see that there is no simple way to do what I want. I came up with a solution:

/// Return the client area of the form after subtracting docked controls
public new Rectangle ClientRectangle
{
    get
    {
        Rectangle _clientRectangle = base.ClientRectangle;

        foreach (Control currentControl in Controls)
        {
            switch (currentControl.Dock)
            {
                case DockStyle.Top:
                    _clientRectangle.Height -= currentControl.Height;
                    _clientRectangle.Offset(0, currentControl.Height);
                    break;

                case DockStyle.Bottom:
                    _clientRectangle.Height -= currentControl.Height;
                    break;

                case DockStyle.Left:
                    _clientRectangle.Width -= currentControl.Width;
                    _clientRectangle.Offset(currentControl.Width, 0);
                    break;

                case DockStyle.Right:
                    _clientRectangle.Width -= currentControl.Width;
                    break;
            }
        }

        return _clientRectangle;
    }
}


However, iterating over every control in the forms Contols collection every time you want to grab ClientRectangle is slow. Anyone have any tips on optimizing this?

-Mike.
AnswerRe: ClientRectangle in VS 2005 Pin
Insincere Dave7-Mar-06 13:39
Insincere Dave7-Mar-06 13:39 
QuestionIssue using a Treeview to control a listview Pin
digicd17-Mar-06 7:44
digicd17-Mar-06 7:44 
QuestionKeyPress event Pin
JoeSox7-Mar-06 7:43
JoeSox7-Mar-06 7:43 
AnswerRe: KeyPress event Pin
Judah Gabriel Himango7-Mar-06 10:16
sponsorJudah Gabriel Himango7-Mar-06 10:16 
GeneralRe: KeyPress event Pin
JoeSox7-Mar-06 12:14
JoeSox7-Mar-06 12:14 
GeneralRe: KeyPress event Pin
Judah Gabriel Himango8-Mar-06 3:50
sponsorJudah Gabriel Himango8-Mar-06 3:50 
GeneralRe: KeyPress event Pin
JoeSox8-Mar-06 7:27
JoeSox8-Mar-06 7:27 
GeneralRe: KeyPress event Pin
Judah Gabriel Himango8-Mar-06 7:34
sponsorJudah Gabriel Himango8-Mar-06 7:34 

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.