943,660 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 2527
  • C# RSS
You are currently viewing page 1 of this multi-page discussion thread
Sep 16th, 2009
1

What does this control need?

Expand Post »
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:
Attached Thumbnails
Click image for larger version

Name:	myHueSlider.jpg
Views:	59
Size:	16.2 KB
ID:	11652  
Similar Threads
Reputation Points: 442
Solved Threads: 89
Master Poster
Diamonddrake is offline Offline
721 posts
since Mar 2008
Sep 17th, 2009
0

Re: What does this control need?

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
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Sep 17th, 2009
0

Re: What does this control need?

Thanks Ramy I have put a lot of work into it so far. I added a little gloss to the top of the color spectrum. I think maybe now its complete... In the final product I think I will put a property to disable the gloss effects.

Still open to suggestions.
Attached Thumbnails
Click image for larger version

Name:	myHueSlider2.jpg
Views:	79
Size:	15.1 KB
ID:	11665  
Reputation Points: 442
Solved Threads: 89
Master Poster
Diamonddrake is offline Offline
721 posts
since Mar 2008
Sep 17th, 2009
0

Re: What does this control need?

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.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Sep 17th, 2009
0

Re: What does this control need?

Click to Expand / Collapse  Quote originally posted by sknake ...
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.
I'm not 100% sure what you are referring to.
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.
Reputation Points: 442
Solved Threads: 89
Master Poster
Diamonddrake is offline Offline
721 posts
since Mar 2008
Sep 17th, 2009
0

Re: What does this control need?

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)
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace daniweb
  11. {
  12. public partial class frmButton : Form
  13. {
  14. public frmButton()
  15. {
  16. InitializeComponent();
  17. }
  18.  
  19. private void button1_Click(object sender, EventArgs e)
  20. {
  21. button1.Height = 800;
  22. }
  23. }
  24. public class ButtonEx2 : Button
  25. {
  26. public const int MAX_SIZE = 50;
  27.  
  28. public ButtonEx2()
  29. : base()
  30. {
  31.  
  32. }
  33. public new Size Size
  34. {
  35. get { return base.Size; }
  36. set
  37. {
  38. base.Size = new Size(value.Width, Math.Min(value.Height, MAX_SIZE));
  39. }
  40. }
  41. public new int Height
  42. {
  43. get { return base.Height; }
  44. set
  45. {
  46. base.Height = Math.Min(value, MAX_SIZE);
  47. }
  48. }
  49. }
  50. }
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Sep 17th, 2009
0

Re: What does this control need?

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.

C# Syntax (Toggle Plain Text)
  1. pubic enum ControlHeight
  2. {
  3. short = 18,
  4. normal = 25,
  5. tall = 40
  6. }
  7.  
  8. public enum ControlHeight new height --?
  9. {
  10. get??
  11.  
  12. set
  13. {
  14. //I know this is wrong, but idk what to do.
  15. base.height = ControlHeight.Value;
  16. }
  17.  
  18. }

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.
Reputation Points: 442
Solved Threads: 89
Master Poster
Diamonddrake is offline Offline
721 posts
since Mar 2008
Sep 18th, 2009
0

Re: What does this control need?

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?
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Sep 18th, 2009
0

Re: What does this control need?

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.
Last edited by Diamonddrake; Sep 18th, 2009 at 7:58 pm.
Reputation Points: 442
Solved Threads: 89
Master Poster
Diamonddrake is offline Offline
721 posts
since Mar 2008
Sep 18th, 2009
1

Re: What does this control need?

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.
Last edited by sknake; Sep 18th, 2009 at 8:40 pm.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: C# Form Text Box Input to SQL Database
Next Thread in C# Forum Timeline: Vista ThumbnailProvider and IInitializeWithStream





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC