Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
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 
QuestionUnassigned local variable Pin
gwithey29-Jun-09 21:23
gwithey29-Jun-09 21:23 
AnswerRe: Unassigned local variable Pin
SeMartens29-Jun-09 21:35
SeMartens29-Jun-09 21:35 
AnswerRe: Unassigned local variable Pin
dan!sh 29-Jun-09 21:37
professional dan!sh 29-Jun-09 21:37 
GeneralRe: Unassigned local variable Pin
gwithey29-Jun-09 21:41
gwithey29-Jun-09 21:41 
GeneralRe: Unassigned local variable Pin
OriginalGriff29-Jun-09 21:53
mveOriginalGriff29-Jun-09 21:53 
GeneralRe: Unassigned local variable Pin
gwithey30-Jun-09 0:38
gwithey30-Jun-09 0:38 
QuestionWIA Video Problem...?? Pin
S K Y29-Jun-09 20:44
S K Y29-Jun-09 20:44 
AnswerRe: WIA Video Problem...?? Pin
Nuri Ismail29-Jun-09 21:08
Nuri Ismail29-Jun-09 21:08 
GeneralRe: WIA Video Problem...?? Pin
S K Y29-Jun-09 21:38
S K Y29-Jun-09 21:38 
GeneralRe: WIA Video Problem...?? Pin
Nuri Ismail29-Jun-09 22:01
Nuri Ismail29-Jun-09 22:01 
GeneralRe: WIA Video Problem...?? Pin
S K Y29-Jun-09 22:16
S K Y29-Jun-09 22:16 
AnswerRe: WIA Video Problem...?? Pin
Nuri Ismail29-Jun-09 22:22
Nuri Ismail29-Jun-09 22:22 

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.