Click here to Skip to main content
15,900,511 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to change Web Service url dynamically when it's referenced in a class library (dll) ? Pin
Pete O'Hanlon30-Jun-09 0:35
mvePete O'Hanlon30-Jun-09 0:35 
GeneralThanks but this solution is not relevant for my scenario... Pin
shaul-y30-Jun-09 1:12
shaul-y30-Jun-09 1:12 
GeneralRe: Thanks but this solution is not relevant for my scenario... Pin
Pete O'Hanlon30-Jun-09 1:17
mvePete O'Hanlon30-Jun-09 1:17 
GeneralRe: Thanks but this solution is not relevant for my scenario... Pin
shaul-y30-Jun-09 3:08
shaul-y30-Jun-09 3:08 
Questionis there anyway to know default icon or user specified icon showing in the form currently Pin
mutpan29-Jun-09 23:42
mutpan29-Jun-09 23:42 
AnswerRe: is there anyway to know default icon or user specified icon showing in the form currently Pin
stancrm29-Jun-09 23:56
stancrm29-Jun-09 23:56 
GeneralRe: is there anyway to know default icon or user specified icon showing in the form currently Pin
mutpan30-Jun-09 1:35
mutpan30-Jun-09 1:35 
Questioncontrol winforms application from remote computer Pin
Jan198229-Jun-09 23:38
Jan198229-Jun-09 23:38 
AnswerRe: control winforms application from remote computer Pin
Christian Graus30-Jun-09 0:23
protectorChristian Graus30-Jun-09 0:23 
AnswerRe: control winforms application from remote computer Pin
musefan30-Jun-09 2:12
musefan30-Jun-09 2:12 
QuestionVideo Processing - ColorMatrix Pin
tvbarnard29-Jun-09 23:19
tvbarnard29-Jun-09 23:19 
AnswerRe: Video Processing - ColorMatrix Pin
Christian Graus30-Jun-09 0:20
protectorChristian Graus30-Jun-09 0:20 
GeneralRe: Video Processing - ColorMatrix Pin
tvbarnard30-Jun-09 1:03
tvbarnard30-Jun-09 1:03 
GeneralRe: Video Processing - ColorMatrix Pin
musefan30-Jun-09 2:08
musefan30-Jun-09 2:08 
GeneralRe: Video Processing - ColorMatrix Pin
tvbarnard30-Jun-09 2:21
tvbarnard30-Jun-09 2:21 
GeneralRe: Video Processing - ColorMatrix Pin
musefan30-Jun-09 2:29
musefan30-Jun-09 2:29 
GeneralRe: Video Processing - ColorMatrix Pin
tvbarnard30-Jun-09 2:34
tvbarnard30-Jun-09 2:34 
GeneralRe: Video Processing - ColorMatrix Pin
musefan30-Jun-09 2:39
musefan30-Jun-09 2:39 
JokeRe: Video Processing - ColorMatrix Pin
tvbarnard30-Jun-09 3:13
tvbarnard30-Jun-09 3:13 
QuestionCustom border color for Textbox is not working when using WS_EX_COMPOSITED style to the windows forms Pin
mutpan29-Jun-09 22:48
mutpan29-Jun-09 22:48 
I am trying to give the custom boder color for the text box in C#. I am using XP operating system and visual studio 2008. I have subclassed the Textbox and override the WndProc method to handle the WM_PAINT message to give the custom border color to the text box.

// Text box code
public class SampleTextBox : TextBox
    {
        public SampleTextBox()
        {
            BorderStyle = BorderStyle.FixedSingle;
        }

        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case 0x000F: // WM_PAINT
                    base.WndProc(ref m);
                        
                    Control control = Control.FromHandle(Handle);
                    Graphics g = Graphics.FromHwnd(Handle);

                    ControlPaint.DrawBorder(g, control.ClientRectangle, Color.YellowGreen, ButtonBorderStyle.Solid);
                  
                    g.Dispose();
                    break;                
                default:
                    base.WndProc(ref m);
                    break;
            }
        }
    }

// Form code

public class SampleForm : Form
    {
        public SampleForm()
        {
            BackColor = Color.SteelBlue;
        }

        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x02000000; /*WS_EX_COMPOSITED*/
                return cp;
            }
        }
    }


public class Form2 : SampleForm
    {
        private SampleTextBox textbox1;

        public Form2()
        {

            textbox1 = new SampleTextBox();
            textbox1.Location = new Point(50, 50);

            this.Controls.Add(textbox1);

        }
    }


I am using WS_EX_COMPOSITED extened window style to my form to avoid the filckering because i am doing custom painting in my form. If i use WS_EX_COMPOSITED style with form , the border color of Text box comes with default color, that is black color while opening the form . But if i click and move the mouse in the non client area like border or titlebar of the form, the border color changes to color (Color.YellowGreen) which i specified in the Paint message of Textbox.


If I comment the "cp.ExStyle |= 0x02000000; /*WS_EX_COMPOSITED*/ " line, then the border always comes with the color what i specified in the Paint message of Textbox.

Can anyone please tell why this is happening and how can I achieve the custom border for the text box when WS_EX_COMPOSITED style applied to its parent control(form)?

Thanks in advance.

Mutpan.
AnswerRe: Custom border color for Textbox is not working when using WS_EX_COMPOSITED style to the windows forms Pin
Svetlin Panayotov29-Jun-09 23:36
Svetlin Panayotov29-Jun-09 23:36 
GeneralRe: Custom border color for Textbox is not working when using WS_EX_COMPOSITED style to the windows forms Pin
mutpan29-Jun-09 23:44
mutpan29-Jun-09 23:44 
Questionhelp needed for httpwebreqest and postback Pin
aamirzada29-Jun-09 21:34
aamirzada29-Jun-09 21:34 
AnswerRe: help needed for httpwebreqest and postback Pin
Manas Bhardwaj29-Jun-09 21:58
professionalManas Bhardwaj29-Jun-09 21:58 
GeneralRe: help needed for httpwebreqest and postback Pin
aamirzada6-Jul-09 0:47
aamirzada6-Jul-09 0:47 

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.