Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to create a style for a combobox in c#

How to create a style for a combobox in c#

Scheduled Pinned Locked Moved C#
csharphelptutorialquestion
14 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Arunkumar Koloth

    Thank you For your replay Richard MacCutchan Please see this link http://www.hv-designs.co.uk/tutorials/sliding_menu/sliding_menu.html[^] Styling combo box like this. Thank you Arunkumar.t

    V Offline
    V Offline
    Varsha Ramnani
    wrote on last edited by
    #4

    which frontend tech. you are using (WPF, Silverlight , etc.)?

    "Insanity is doing the same thing over and over again but expecting different results.” — Rita Mae Brown

    A 1 Reply Last reply
    0
    • A Arunkumar Koloth

      Thank you For your replay Richard MacCutchan Please see this link http://www.hv-designs.co.uk/tutorials/sliding_menu/sliding_menu.html[^] Styling combo box like this. Thank you Arunkumar.t

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #5

      That is a web site, so you need to look at the options available within ASP.NET for creating drop down lists. There are lots of articles here on CodeProject that will offer suggestions.

      Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

      A 1 Reply Last reply
      0
      • L Lost User

        That is a web site, so you need to look at the options available within ASP.NET for creating drop down lists. There are lots of articles here on CodeProject that will offer suggestions.

        Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

        A Offline
        A Offline
        Arunkumar Koloth
        wrote on last edited by
        #6

        Thank you for your valuable time I thing u misunderstand my question! iam not looking for a asp.net combo box. i want to integrate that type of combo box in my desktop application. Thank you Arunkumar

        V L 2 Replies Last reply
        0
        • V Varsha Ramnani

          which frontend tech. you are using (WPF, Silverlight , etc.)?

          "Insanity is doing the same thing over and over again but expecting different results.” — Rita Mae Brown

          A Offline
          A Offline
          Arunkumar Koloth
          wrote on last edited by
          #7

          iam using .net as my desktop application framework

          1 Reply Last reply
          0
          • A Arunkumar Koloth

            Thank you for your valuable time I thing u misunderstand my question! iam not looking for a asp.net combo box. i want to integrate that type of combo box in my desktop application. Thank you Arunkumar

            V Offline
            V Offline
            V 0
            wrote on last edited by
            #8

            I'm not sure Winforms or even WPF allows this kind of theming natively. What you'll need to do is write your own usercontrol that inherits from the standard combobox. I think this usercontrol will consist of several standard controls: - a textbox - a button (that resembles the down arrow) - an invisible panel, size: width = textbox, height = 0 (by default) You then load this panel with the items (via labels or textblocks) and on click of the button the panel grows in size (at the position right below the textbox). When a label/textblock was clicked, the panel is closed again andf the text put in the textbox. hope this helps. PS: Please avoid text speech and mind the spelling (even if you're not native English)

            V.

            S A 2 Replies Last reply
            0
            • A Arunkumar Koloth

              Thank you for your valuable time I thing u misunderstand my question! iam not looking for a asp.net combo box. i want to integrate that type of combo box in my desktop application. Thank you Arunkumar

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #9

              Lots of suggestions here[^].

              Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

              1 Reply Last reply
              0
              • A Arunkumar Koloth

                Hai I developing a software in c# i want to know how to write code for cute comboboxes for windows7. anyone can help me please ? Arunkumar

                A Offline
                A Offline
                Abhinav S
                wrote on last edited by
                #10

                WPF provides better styling support for controls.

                1 Reply Last reply
                0
                • A Arunkumar Koloth

                  Hai I developing a software in c# i want to know how to write code for cute comboboxes for windows7. anyone can help me please ? Arunkumar

                  B Offline
                  B Offline
                  BillWoodruff
                  wrote on last edited by
                  #11

                  Some replies here have assumed you are describing "theming:" (even though you never used that word, yourself): where theming means you want to create a control from which you could create any number of different look-and-feel variations from the base control. Looking at your question: and the example on the web page you linked to: are you really asking how to create a custom-themed control, or are you just asking how to make a drop-down that looks and behaves exactly like the one on that web-page ? Please clarify exactly what "style" and "styling" mean to you here. best, Bill

                  "Last year I went fishing with Salvador Dali. He was using a dotted line. He caught every other fish." Steven Wright

                  1 Reply Last reply
                  0
                  • V V 0

                    I'm not sure Winforms or even WPF allows this kind of theming natively. What you'll need to do is write your own usercontrol that inherits from the standard combobox. I think this usercontrol will consist of several standard controls: - a textbox - a button (that resembles the down arrow) - an invisible panel, size: width = textbox, height = 0 (by default) You then load this panel with the items (via labels or textblocks) and on click of the button the panel grows in size (at the position right below the textbox). When a label/textblock was clicked, the panel is closed again andf the text put in the textbox. hope this helps. PS: Please avoid text speech and mind the spelling (even if you're not native English)

                    V.

                    S Offline
                    S Offline
                    Subin Mavunkal
                    wrote on last edited by
                    #12

                    I was thinking the same. :-O

                    V 1 Reply Last reply
                    0
                    • S Subin Mavunkal

                      I was thinking the same. :-O

                      V Offline
                      V Offline
                      V 0
                      wrote on last edited by
                      #13

                      Yeah, genius minds think alike :-D

                      V.

                      1 Reply Last reply
                      0
                      • V V 0

                        I'm not sure Winforms or even WPF allows this kind of theming natively. What you'll need to do is write your own usercontrol that inherits from the standard combobox. I think this usercontrol will consist of several standard controls: - a textbox - a button (that resembles the down arrow) - an invisible panel, size: width = textbox, height = 0 (by default) You then load this panel with the items (via labels or textblocks) and on click of the button the panel grows in size (at the position right below the textbox). When a label/textblock was clicked, the panel is closed again andf the text put in the textbox. hope this helps. PS: Please avoid text speech and mind the spelling (even if you're not native English)

                        V.

                        A Offline
                        A Offline
                        Arunkumar Koloth
                        wrote on last edited by
                        #14

                        ok guys Thanks for your replays Now i am facing another problem

                        using System;
                        using System.Collections.Generic;
                        using System.ComponentModel;
                        using System.Runtime.InteropServices;
                        using System.Data;
                        using System.Drawing;
                        using System.Text;
                        using System.Windows.Forms;

                        namespace Combo
                        {

                        public class Combo //:IDisposable
                        {
                            private System.Windows.Forms.ComboBox li = new System.Windows.Forms.ComboBox(); //object
                           // public event EventHandler SelectedIndexChanged; //The event handler name must match the event name.
                           // private object\[\] eventObject; //One object\[\] for each event (one event here).
                            public void Addselect(Control FormName, string name, int top, int left, int width, int height, string Text)
                            {
                                li.Top = top;
                                li.Left = left;
                                li.Width = width;
                                li.Height = height;
                                li.Name = name;
                                li.FlatStyle = FlatStyle.Flat;
                                li.CreateGraphics();
                                li.Text = Text;
                                li.IntegralHeight = false;
                                li.MaxDropDownItems = 5;
                                li.DropDownStyle = ComboBoxStyle.DropDown;
                                li.Size = new System.Drawing.Size(136, 81);
                                li.BackColor = System.Drawing.Color.DarkGray;
                               
                        
                                FormName.Controls.Add(li);
                        
                               // eventObject = new object\[\] { this, "SelectedIndexChanged" }; //This is the object that will pass with the event.
                                //It must be in that format exactly.
                             //   li.SelectedIndexChanged += new EventHandler(SelectedIndexChanged);
                        

                        //

                            }
                        

                        // private void SelectedIndexChanged(object sender, EventArgs e)
                        // {
                        // if (SelectedIndexChanged != null) //You must test this.
                        // {
                        // SelectedIndexChanged(eventObject, null);
                        // }
                        // }

                            public void Additems(string\[\] items)
                            {
                                li.Items.AddRange(items);
                            }
                        
                            public bool Enabled
                            {
                                get { return li.Enabled; }
                                set { li.Enabled = value; }
                            }
                            public bool Visible
                            {
                                get { return li.Visible; }
                                set { li.Visible = value; }
                            }
                        
                        
                        }
                        

                        }

                        Iam Creating a library for combobox.(iam a newbie to c#) iam using this library for adding many combobox in my form can any one tell me how to create a selectedindexchanged event handler for each combobox i creating? i tried the commented code

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups