| | |
What does this control need?
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
I have been working on a custom Hue Slider, when you drag the knob the color of it changes to its hue value. (ex 0 is red). I added a little gloss to the knob, I feel its not done, I Just don't have any Ideas as to how to give it finishing touches...
any ideas people?
I would like it to look a little more professional.
image attached:
any ideas people?
I would like it to look a little more professional.
image attached:
I see it's very simple in design and this is good, if it does its functionality well so you don't over care about its design.
Nice work, Diamonddrake
Nice work, Diamonddrake
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Pretty 
The top one looks a little funny on the far left. It looks like the area to the left of the slider knob is a "stop" of some sort. It looks like a block to me.

The top one looks a little funny on the far left. It looks like the area to the left of the slider knob is a "stop" of some sort. It looks like a block to me.
•
•
•
•
Pretty
The top one looks a little funny on the far left. It looks like the area to the left of the slider knob is a "stop" of some sort. It looks like a block to me.
but if you mean how the top of the slider knob covers a pixel of the spectrum in the backcolor on either side, then yeah. I couldn't figure out how to stop that from happening.
if the control is on an image, then a pixel of the image shows through there. but an easy fix was to keep the control sized where the hue image doesn't extend above the knob at the point where it has a curve.
but when the control is too tall it happens anyhow. because the knob is currently a fixed size.
also if you drag the knob to 0 there is a ugly blocky explosion of pixels behind the knob I can't see any reason or solution of that.
any ideas would be great.
also, if any one knows how to give a control a fixed height, that would help here, or maybe attach it to an enum that only allows like 3 variations like (short, normal, tall).
and thanks for the compliments. I have worked hard on it.
I have plans for a more compact version as well, and eventually an entire library of custom drawn controls.
The button's height/size aren't marked virtual in this case but you would want to declare the properties yourself. Hiding members like I have done here isn't a good solution, but it is a good example:
C# Syntax (Toggle Plain Text)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace daniweb { public partial class frmButton : Form { public frmButton() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { button1.Height = 800; } } public class ButtonEx2 : Button { public const int MAX_SIZE = 50; public ButtonEx2() : base() { } public new Size Size { get { return base.Size; } set { base.Size = new Size(value.Width, Math.Min(value.Height, MAX_SIZE)); } } public new int Height { get { return base.Height; } set { base.Height = Math.Min(value, MAX_SIZE); } } } }
I like the idea, but I would like to see an enum for the height. could that be done?
so the height property would no longer be a int, but an emum.
any Ideas how this could be done, I realize all this code is BS, but how could I achieve this?
so the height property would no longer be a int, but an emum.
C# Syntax (Toggle Plain Text)
pubic enum ControlHeight { short = 18, normal = 25, tall = 40 } public enum ControlHeight new height --? { get?? set { //I know this is wrong, but idk what to do. base.height = ControlHeight.Value; } }
any Ideas how this could be done, I realize all this code is BS, but how could I achieve this?
Last edited by Diamonddrake; Sep 17th, 2009 at 8:44 pm.
That depends on how your control is implemented, ie if you descended from a .NET implemented control (panel, progress bar) or did you build everything from the Control class and up?
If you want your own custom controls you are better off starting at "Control", making your own "BaseControl", and then create your custom controls from there. The controls provided for .NET don't have all members marked as virtual (such as my example) and so you can never fully customize them.
Do you mind posting code or uploading a project with one of your controls?
If you want your own custom controls you are better off starting at "Control", making your own "BaseControl", and then create your custom controls from there. The controls provided for .NET don't have all members marked as virtual (such as my example) and so you can never fully customize them.
Do you mind posting code or uploading a project with one of your controls?
Im hesitant to release the code... I kinda want it to be unique to my application for a while, before I release it upon the world, that and the code's current state is horrible, I use a lot of hacky looking code, and I probably have 800 lines commented out. not really ready to be shared.
I can post a sample exe with the control in it. so you can see that it does infact work. I'm headed out to the movies now, I will do it when I get back. I just don't want all my messy code out right now.
It inherits from UserControl. which seems to cause some problems, I can't acually use new Height. it gives a compiler error and doesn't show up in intellisense.
should I not inherit from UserControl? but instead Control? or completely from scratch???
I would love to hear more about your system of custom user controls sknake.
also, I currently have an extra property called ctrlheight that is bound to an enum. so when you set it it jumps to the predefined heights, but when you just set the height, or drag it in the designer, it stays whatever size you set it too. and I don't like it.
also, just a little tid bit of knowledge on the control, the hue spectrum is drawn in GDI+ as well, so the control is all code and do binary images or resources of anykind.
I can post a sample exe with the control in it. so you can see that it does infact work. I'm headed out to the movies now, I will do it when I get back. I just don't want all my messy code out right now.
It inherits from UserControl. which seems to cause some problems, I can't acually use new Height. it gives a compiler error and doesn't show up in intellisense.
should I not inherit from UserControl? but instead Control? or completely from scratch???
I would love to hear more about your system of custom user controls sknake.
also, I currently have an extra property called ctrlheight that is bound to an enum. so when you set it it jumps to the predefined heights, but when you just set the height, or drag it in the designer, it stays whatever size you set it too. and I don't like it.
also, just a little tid bit of knowledge on the control, the hue spectrum is drawn in GDI+ as well, so the control is all code and do binary images or resources of anykind.
Last edited by Diamonddrake; Sep 18th, 2009 at 7:58 pm.
You know if you release an .exe we can use the reflector and decompile it, right? 
You should inherit from control and do your control from scratch. Again you can use the reflector to decompile the .NET framework and rip the code off for standard controls and customize it from there.
Stay away from user controls for new controls like buttons and stuff. They're handy if you have a "custom search drop down box" that has complicated databinding etc etc then you could defined a usercontrol for the single project and drop it on forms. But you shouldn't use a user control to make new controls for a toolbox item.

You should inherit from control and do your control from scratch. Again you can use the reflector to decompile the .NET framework and rip the code off for standard controls and customize it from there.
Stay away from user controls for new controls like buttons and stuff. They're handy if you have a "custom search drop down box" that has complicated databinding etc etc then you could defined a usercontrol for the single project and drop it on forms. But you shouldn't use a user control to make new controls for a toolbox item.
Last edited by sknake; Sep 18th, 2009 at 8:40 pm.
![]() |
Similar Threads
- News Story: Nokia wants control of your home (Apple Hardware)
- Unable to access my computer, my documents, and control from start bar and run!! (Windows NT / 2000 / XP)
- News Story: Crystal Ball Sunday #9: Intelligent Control (Linux Servers and Apache)
- Using the Datalist Control as a Menu (ASP.NET)
- How to control a CD-Drive (C)
- Tabbed Control Dialog (Visual Basic 4 / 5 / 6)
- Problems with control panel _>Internet options (Windows 95 / 98 / Me)
Other Threads in the C# Forum
- Previous Thread: C# Form Text Box Input to SQL Database
- Next Thread: Vista ThumbnailProvider and IInitializeWithStream
| Thread Tools | Search this Thread |
.net access activedirectory advice app array asp.net avltree bitmap broadcast bulletin c# c++ check client combobox commerce control custom database datetime dba dbconnection developer development directrobot dll drawing dubai ecommerce enabled error event eventhandlers file foreach form formbox forms function gdi+ httpwebrequest index javascript linux lisp list listbox mailmerge math mdd mono msword mysql oracle packaging panel password patch photoshop picturebox plotting pointer post print programming redirect remote remoting reporting resourcefile richtextbox security site software softwaredevelopment sql sql-server statistics stream string study table tcpclientchannel textbox treeview uploadatextfile usercontrol usercontrols vb visual webbrowser webdevelopemnt webdevelopment wia windows winforms wordautomation wpf write







