Click here to Skip to main content
12,399,799 members (52,922 online)
   

C#

 
GeneralRe: The .exe application file isn't obfuscated after installing setup ? Pin
taibc25-Feb-13 4:53
membertaibc25-Feb-13 4:53 
AnswerRe: The .exe application file isn't obfuscated after installing setup ? Pin
Samer AlRawi26-Feb-13 17:41
memberSamer AlRawi26-Feb-13 17:41 
GeneralRe: The .exe application file isn't obfuscated after installing setup ? Pin
taibc28-Feb-13 14:36
membertaibc28-Feb-13 14:36 
QuestionC# Pin
MohanKrishna.Kota24-Feb-13 4:06
memberMohanKrishna.Kota24-Feb-13 4:06 
AnswerASP.NET Pin
Jegan Thiyagesan25-Feb-13 12:14
memberJegan Thiyagesan25-Feb-13 12:14 
General[TUTORIAL] Native Cocoa Apps with C# and MonoMac Pin
Jake Rieger23-Feb-13 14:36
memberJake Rieger23-Feb-13 14:36 
GeneralRe: [TUTORIAL] Native Cocoa Apps with C# and MonoMac Pin
Dave Kreskowiak23-Feb-13 14:39
mvpDave Kreskowiak23-Feb-13 14:39 
GeneralRe: [TUTORIAL] Native Cocoa Apps with C# and MonoMac Pin
Mycroft Holmes24-Feb-13 18:17
memberMycroft Holmes24-Feb-13 18:17 
Questionprograme Pin
ongwere23-Feb-13 9:35
memberongwere23-Feb-13 9:35 
AnswerRe: programe Pin
SoMad23-Feb-13 10:37
memberSoMad23-Feb-13 10:37 
GeneralRe: programe Pin
Manfred R. Bihy23-Feb-13 11:37
memberManfred R. Bihy23-Feb-13 11:37 
GeneralRe: programe Pin
SoMad23-Feb-13 11:46
memberSoMad23-Feb-13 11:46 
AnswerRe: programe Pin
Amir Mohammad Nasrollahi29-Jul-13 21:45
professionalAmir Mohammad Nasrollahi29-Jul-13 21:45 
QuestionCustomize windows scroll bar in combobox Pin
Kaizen20223-Feb-13 7:45
memberKaizen20223-Feb-13 7:45 
I am trying to customize default windows scrollbar in combobox like below.

public partial class ComboEx : ComboBox
{
    internal ScrollbarEx vScrollBar;
    NativeListWindow listControl;
    public ComboEx()
    {
        InitializeComponent();
        DropDownHeight = 100;
        vScrollBar = new ScrollbarEx();
    }
 
    protected override void OnPaint(PaintEventArgs pe)
    {
        base.OnPaint(pe);
    }
 
    protected override void OnHandleCreated(EventArgs e)
    {
        base.OnHandleCreated(e);
        COMBOBOXINFO combInfo = new COMBOBOXINFO();
        combInfo.cbSize = Marshal.SizeOf(combInfo);
        Win32.GetComboBoxInfo( this.Handle, ref combInfo );
 
        listControl = new NativeListWindow(this, combInfo.hwndList);
    }
 
    protected override void WndProc(ref Message m)
    {
         if (m.Msg == (Win32.WM_REFLECT + Win32.WM_COMMAND))
        {
            if (Win32.HIWORD( (int)m.WParam ) == Win32.CBN_DROPDOWN)
            {
                COMBOBOXINFO combInfo = new COMBOBOXINFO();
                combInfo.cbSize = Marshal.SizeOf(combInfo);
                Win32.GetComboBoxInfo( this.Handle, ref combInfo );
 
                vScrollBar.Location = new Point( this.Width-23, 1 );
                vScrollBar.Size = new Size( 23, DropDownHeight );
                vScrollBar.Visible = true;
                Win32.SetParent(vScrollBar.Handle, combInfo.hwndList);
                Win32.ShowWindow(vScrollBar.Handle, ShowWindowCommands.Show);
                Win32.SetWindowPos(vScrollBar.Handle,HWND.TopMost, 155, 1, 23, 105, SetWindowPosFlags.SWP_SHOWWINDOW);
            }
        }
        base.WndProc(ref m);
    }
 
    // MyNativeWindow class to create a window given a class name.
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
    internal class NativeListWindow : NativeWindow
    {
        // Constant values were found in the "windows.h" header file.
        private const int WS_CHILD = 0x40000000,
                          WS_VISIBLE = 0x10000000,
                          WM_ACTIVATEAPP = 0x001C;
 
        private int windowHandle;
 
        private ComboEx parent;
 
        public NativeListWindow(ComboEx owner,IntPtr handle)
        {
            AssignHandle(handle);
            parent = owner;
 
        }
 
        // Listen to when the handle changes to keep the variable in sync
        [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
        protected override void OnHandleChange()
        {
            windowHandle = (int)this.Handle;
        }
 
        private void AdjustClientRect(ref RECT rect)
        {
            rect.right -= 23;
        }
 
        [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
        protected override void WndProc(ref Message message)
        {
            // Listen for messages that are sent to the button window. Some messages are sent 
            // to the parent window instead of the button's window. 

            switch (message.Msg)
            {
                case Win32.NCCALCSIZE:
                    {
                        if (message.WParam != IntPtr.Zero)
                        {
                            NCCALCSIZE_PARAMS rcsize = (NCCALCSIZE_PARAMS)Marshal.PtrToStructure(message.LParam, typeof(NCCALCSIZE_PARAMS));
                            AdjustClientRect(ref rcsize.rect0);
                            Marshal.StructureToPtr(rcsize, message.LParam, false);
                        }
                        else
                        {
                            RECT rcsize = (RECT)Marshal.PtrToStructure(message.LParam, typeof(RECT));
                            AdjustClientRect(ref rcsize);
                            Marshal.StructureToPtr(rcsize, message.LParam, false);
                        }
                        message.Result = new IntPtr(1);
                        return;
                        break;
                    }
 
                    case Win32.WM_NCMOUSEMOVE:
                    {
                        base.WndProc(ref message);
                        Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
                        break;
                        break;
                    }
                    case Win32.WM_NCLBUTTONDOWN:
                    {
                        base.WndProc(ref message);
                        Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
                        break;
                    }
                    case Win32.WM_NCACTIVATE:
                    {
                        base.WndProc(ref message);
                        Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
                        break;
                    }
                    case Win32.WM_NCMOUSELEAVE:
                    {
                        base.WndProc(ref message);
                        Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
                        break;
                    }
                    case Win32.WM_NCLBUTTONUP:
                    {
                        base.WndProc(ref message);
                        Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
                        break;
                    }
                    case Win32.WM_NCHITTEST:
                    {
                        base.WndProc(ref message);
                        Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
                        break;
                    }
                    case Win32.WM_MOUSEMOVE:
                    {
                        base.WndProc(ref message);
                        if ((int)message.LParam > 0)
                        {
                            int x = Win32.LOWORD((int)message.LParam);
                            int y = Win32.HIWORD((int)message.LParam);
                            RECT rect = new RECT(); ;
                            Win32.GetWindowRect(new HandleRef(parent.vScrollBar, parent.vScrollBar.Handle),out rect);
                            Rectangle rc = new Rectangle(parent.vScrollBar.Location.X, parent.vScrollBar.Location.Y,
                                (rect.right - rect.left), (rect.bottom - rect.top));
                            if (rc.Contains(new Point(x, y)))
                            {
                                Win32.SetFocus(parent.vScrollBar.Handle);
                                Win32.SetWindowPos(parent.vScrollBar.Handle, HWND.TopMost, 155, 1, 23, 105, SetWindowPosFlags.SWP_SHOWWINDOW);
                                Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
                            }
                        }
                        break;
                    }
            }
            base.WndProc(ref message);
        }
    }
}
In the above code, I did the following 1. created a NativeWindow to catch the messages of combobox listcontrol by assigning combInfo.hwndList handle. 2. Placed my custom scrollbar(ScrollBarEx) in the non-client area of combobox listcontrol.

But my custom scrollbar(ScrollBarEx) doesn't receives any messages or focus. It looks like it is dead. Please look into this code and share some idea to make the scrollbar live.
AnswerRe: Customize windows scroll bar in combobox Pin
SledgeHammer0123-Feb-13 9:20
memberSledgeHammer0123-Feb-13 9:20 
GeneralRe: Customize windows scroll bar in combobox Pin
Kaizen20224-Feb-13 6:01
memberKaizen20224-Feb-13 6:01 
GeneralRe: Customize windows scroll bar in combobox Pin
SledgeHammer0124-Feb-13 8:20
memberSledgeHammer0124-Feb-13 8:20 
Questionunable to start program, unrecognized error in windows web services framework Pin
bonosa23-Feb-13 5:06
memberbonosa23-Feb-13 5:06 
Questionwhy System.NullReferenceException occurred? Pin
Jassim Rahma23-Feb-13 1:54
memberJassim Rahma23-Feb-13 1:54 
AnswerRe: why System.NullReferenceException occurred? Pin
Alan N23-Feb-13 2:04
memberAlan N23-Feb-13 2:04 
GeneralRe: why System.NullReferenceException occurred? Pin
Jassim Rahma23-Feb-13 2:10
memberJassim Rahma23-Feb-13 2:10 
GeneralRe: why System.NullReferenceException occurred? Pin
Alan N23-Feb-13 2:33
memberAlan N23-Feb-13 2:33 
GeneralRe: why System.NullReferenceException occurred? Pin
Jassim Rahma23-Feb-13 2:44
memberJassim Rahma23-Feb-13 2:44 
GeneralRe: why System.NullReferenceException occurred? Pin
Alan N23-Feb-13 2:54
memberAlan N23-Feb-13 2:54 
AnswerRe: why System.NullReferenceException occurred? Pin
jschell24-Feb-13 7:05
memberjschell24-Feb-13 7:05 
QuestionHow to read gmail mails using C# (only Unread Email ) Pin
AeroIT22-Feb-13 18:13
groupAeroIT22-Feb-13 18:13 
AnswerRe: How to read gmail mails using C# (only Unread Email ) Pin
Dave Kreskowiak22-Feb-13 18:22
mvpDave Kreskowiak22-Feb-13 18:22 
AnswerRe: How to read gmail mails using C# (only Unread Email ) Pin
OriginalGriff22-Feb-13 21:42
mvpOriginalGriff22-Feb-13 21:42 
AnswerRe: How to read gmail mails using C# (only Unread Email ) Pin
Marco Bertschi23-Feb-13 8:02
memberMarco Bertschi23-Feb-13 8:02 
AnswerRe: How to read gmail mails using C# (only Unread Email ) Pin
Amir Mohammad Nasrollahi29-Jul-13 21:51
professionalAmir Mohammad Nasrollahi29-Jul-13 21:51 
Questionsimplest hacking software in C# Pin
Member 985741522-Feb-13 16:44
memberMember 985741522-Feb-13 16:44 
AnswerRe: simplest hacking software in C# Pin
Dave Kreskowiak22-Feb-13 18:21
mvpDave Kreskowiak22-Feb-13 18:21 
AnswerRe: simplest hacking software in C# Pin
SoMad22-Feb-13 19:13
memberSoMad22-Feb-13 19:13 
AnswerRe: simplest hacking software in C# PinPopular
OriginalGriff22-Feb-13 21:44
mvpOriginalGriff22-Feb-13 21:44 
GeneralRe: simplest hacking software in C# Pin
Jibesh22-Feb-13 22:46
memberJibesh22-Feb-13 22:46 
GeneralRe: simplest hacking software in C# Pin
Shubh Agrahari23-Feb-13 2:03
memberShubh Agrahari23-Feb-13 2:03 
AnswerRe: simplest hacking software in C# Pin
Marco Bertschi23-Feb-13 8:04
memberMarco Bertschi23-Feb-13 8:04 
AnswerRe: simplest hacking software in C# Pin
V.25-Feb-13 0:25
memberV.25-Feb-13 0:25 
Questionsourceafis probleme Pin
arissem22-Feb-13 8:02
memberarissem22-Feb-13 8:02 
AnswerRe: sourceafis probleme Pin
Dave Kreskowiak22-Feb-13 8:47
mvpDave Kreskowiak22-Feb-13 8:47 
GeneralRe: sourceafis probleme Pin
arissem22-Feb-13 8:55
memberarissem22-Feb-13 8:55 
GeneralRe: sourceafis probleme Pin
Dave Kreskowiak22-Feb-13 9:26
mvpDave Kreskowiak22-Feb-13 9:26 
GeneralRe: sourceafis probleme Pin
arissem23-Feb-13 3:21
memberarissem23-Feb-13 3:21 
GeneralRe: sourceafis probleme Pin
Dave Kreskowiak23-Feb-13 4:19
mvpDave Kreskowiak23-Feb-13 4:19 
GeneralRe: sourceafis probleme Pin
arissem23-Feb-13 6:48
memberarissem23-Feb-13 6:48 
GeneralRe: sourceafis probleme Pin
Dave Kreskowiak23-Feb-13 8:10
mvpDave Kreskowiak23-Feb-13 8:10 
Questionfile transer using wifi with out socket programming in c# Pin
raythatha721-Feb-13 23:02
memberraythatha721-Feb-13 23:02 
SuggestionRe: file transer using wifi with out socket programming in c# Pin
Richard MacCutchan21-Feb-13 23:56
mvpRichard MacCutchan21-Feb-13 23:56 
GeneralRe: file transer using wifi with out socket programming in c# Pin
raythatha728-Feb-13 23:25
memberraythatha728-Feb-13 23:25 
GeneralRe: file transer using wifi with out socket programming in c# Pin
Richard MacCutchan1-Mar-13 0:36
mvpRichard MacCutchan1-Mar-13 0:36 

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.


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 26 Jul 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid