|
Hi,
1st of all, GREAT control. I love it.
A couple of questions:
1. I placed four of those on my form. all behave well except for one. On this one I can drag the button out of the controller "slide" area.
At the end of my post is the button setup. (min & max are changed programatically when the form loads. min is set to -8 and max is set to 2. )
** UPDATE: For now I solved it by recreating the control once again. but I wonder what I missed **
2. You mentioned "PrecisionValue" in your post. however I cannot find it. Wrong version? it appears only in some setups?
Thanks,
Gil
------------------------------------------
'MS_Exposure
'
Me.MS_Exposure.Animated = False
Me.MS_Exposure.AnimationSize = 0.2!
Me.MS_Exposure.AnimationSpeed = MediaSlider.MediaSlider.AnimateSpeed.Normal
Me.MS_Exposure.AutoScrollMargin = New System.Drawing.Size(0, 0)
Me.MS_Exposure.AutoScrollMinSize = New System.Drawing.Size(0, 0)
Me.MS_Exposure.BackColor = System.Drawing.Color.Transparent
Me.MS_Exposure.BackgroundImage = Nothing
Me.MS_Exposure.ButtonAccentColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer))
Me.MS_Exposure.ButtonBorderColor = System.Drawing.Color.MidnightBlue
Me.MS_Exposure.ButtonColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
Me.MS_Exposure.ButtonCornerRadius = CType(4UI, UInteger)
Me.MS_Exposure.ButtonSize = New System.Drawing.Size(12, 16)
Me.MS_Exposure.ButtonStyle = MediaSlider.MediaSlider.ButtonType.RoundedRectOverlap
Me.MS_Exposure.ContextMenuStrip = Nothing
Me.MS_Exposure.LargeChange = 2
Me.MS_Exposure.Location = New System.Drawing.Point(77, 232)
Me.MS_Exposure.Margin = New System.Windows.Forms.Padding(0)
Me.MS_Exposure.Maximum = 10
Me.MS_Exposure.Minimum = 0
Me.MS_Exposure.Name = "MS_Exposure"
Me.MS_Exposure.Orientation = System.Windows.Forms.Orientation.Horizontal
Me.MS_Exposure.ShowButtonOnHover = False
Me.MS_Exposure.Size = New System.Drawing.Size(194, 39)
Me.MS_Exposure.SliderFlyOut = MediaSlider.MediaSlider.FlyOutStyle.None
Me.MS_Exposure.SmallChange = 1
Me.MS_Exposure.SmoothScrolling = True
Me.MS_Exposure.TabIndex = 5
Me.MS_Exposure.TickColor = System.Drawing.Color.DarkGray
Me.MS_Exposure.TickStyle = System.Windows.Forms.TickStyle.BottomRight
Me.MS_Exposure.TickType = MediaSlider.MediaSlider.TickMode.Composite
Me.MS_Exposure.TrackBorderColor = System.Drawing.Color.FromArgb(CType(CType(160, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
Me.MS_Exposure.TrackDepth = 4
Me.MS_Exposure.TrackFillColor = System.Drawing.Color.DarkBlue
Me.MS_Exposure.TrackProgressColor = System.Drawing.Color.FromArgb(CType(CType(5, Byte), Integer), CType(CType(101, Byte), Integer), CType(CType(188, Byte), Integer))
Me.MS_Exposure.TrackShadow = True
Me.MS_Exposure.TrackShadowColor = System.Drawing.Color.DarkGray
Me.MS_Exposure.TrackStyle = MediaSlider.MediaSlider.TrackType.Value
Me.MS_Exposure.Value = 0
modified 28-Aug-16 14:48pm.
|
|
|
|
|
i ever use your item in my project, so is right to say very 'BRAVO' and thanks
|
|
|
|
|
No big deal, but would be cool to see it fixed:
1) When ShowButtonOnHover = true , TrackStyle = Progress and Value = Maximum , the track progress doesn't fille the entire bar, probably because it is calculated as if the button should have been there to cover the last bit...
2) When TrackStyle = Progress , Minimum = -20 (for instance) and Maximum = 20 (for instance), in my opinion, the progress ought to go from 0 to current Value , not from Minimum to current Value ?!?!
3) The SideFlyOut is limited by the control boundaries. It would have been cool if it had been made as a "real" window/popup so that it could cross the boundaries...
4) The control doesn't seem to support the normal Anchor and Dock control properties?!??!
Just small ideas. The control is really great!
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
modified 21-May-15 14:50pm.
|
|
|
|
|
It looks great, thanks
|
|
|
|
|
Hi John,
Great control thank you!
A couple of questions:
1. How can I make the slider go in steps (large move) when using the mouse to move the slider? I have a range of 128 to 255 which I need to increase in steps of 8.
2. I'd like be able to use an image for the slider button. Something a little closer to an audio mixer would be nice.
Thanks,
Michael
|
|
|
|
|
Hello,
First of all thanks for this nice control, it's really great. But I am having some issues with the Anchor property.
I am using VS 2010 and as in the designer, in the properties of your control, there's no option for anchor. So in my code I fixed the anchor with the following code:
seekSlider.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left);
volSlider.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
But after this code, when I am minimizing the form, I am getting the unhanded exception. If I remove those two lines of code then the form runs well. How can I set anchor properly?
Here's the exception log:
************** Exception Text **************
System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at MediaSlider.MediaSlider.CreateSprite()
at MediaSlider.MediaSlider.PropertyChange()
at MediaSlider.MediaSlider.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Regards,
Tejashwi Kalp Taru
Windows Developer, Ethical Hacker
http://www.tejashwi.com
|
|
|
|
|
Ok, seems that I currently resolved the issue, any good solution is most welcomed.
Put all the statements inside the function CreateSprite() in try block and finally catch it. It's working, the exception is gone, it's still there but now no harm and no exception messages.
Here's the updated function, change this function and recompile the solution to get the DLL.
private void CreateSprite()
{
Rectangle trackRect = GetTrackRectangle();
int width = (int)(Orientation == Orientation.Horizontal ? trackRect.Width * .1f : trackRect.Height * .1f);
int height = this.TrackDepth;
try
{
DestroySprite();
_bmpSprite = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(_bmpSprite))
{
using (GraphicsMode mode = new GraphicsMode(g, SmoothingMode.HighQuality))
{
g.CompositingMode = CompositingMode.SourceOver;
Rectangle imageRect = new Rectangle(0, 0, width, height);
using (LinearGradientBrush fillBrush = new LinearGradientBrush(
imageRect,
Color.White,
Color.Transparent,
LinearGradientMode.Horizontal))
{
Blend blnd = new Blend();
blnd.Positions = new float[] { 0f, .2f, .5f, .8f, 1f };
blnd.Factors = new float[] { 1f, .6f, 0f, .4f, 1f };
fillBrush.Blend = blnd;
using (GraphicsPath gp = CreateRoundRectanglePath(g, imageRect, 2))
g.FillPath(fillBrush, gp);
}
}
}
_bmpSprite.MakeTransparent();
if (Orientation == Orientation.Vertical)
_bmpSprite.RotateFlip(RotateFlipType.Rotate90FlipX);
}
catch { }
}
Regards,
Tejashwi Kalp Taru
Windows Developer, Ethical Hacker
http://www.tejashwi.com
|
|
|
|
|
Hello,
how is it possible to set the BackColor to transparent? If I do so, the BackColor changes to black.
Thanks in advanced!
regards
|
|
|
|
|
in response to my previous question, i decided to modify the code to set Color and font for Flyout
Set the Color,Font for flyout and then set FlyoutCustomStyle as true
download at http://www.mediafire.com/?ks103t28th30o6u
thankx to Steppenwolfe, for making such an effort. The maths involved is quite daunting and there is care put into even for simple changes.
PS: it also includes mousewheel support, as listed down here
-- modified 7-Oct-12 1:44am.
|
|
|
|
|
Nicely done arvindps! Would you please share the source for your changes?
|
|
|
|
|
I think your user control is great. It not only is presentable, but also works for large ranges.
My query is, i often use the flyout option. But it is limited to show only two figures , is there a way to increase the width.
Is there a way to add text to Flyout, for Ex. when a value of 20 is selected, i wish to show "Very low - 20" in flyout.
I am using a separate textbox as of now, and i want to show values as user scrolls through a very large range of values
thanks for the effort.
|
|
|
|
|
If SmoothScrolling is set to true, and the range between minimum and maximum value is > 1000 , then the slider doesn't move to the maximum value.
For eg.
If Minimum value is set to 2000 and the maximum value is set to 6500, then if we move the slider to extreme right, the value of the slider will be around 6400 , not 6500. This gets 'fixed' if SmoothScrolling is set to false.
|
|
|
|
|
Nice control, love the "GlassInLine" buttonstyle. But, here are the problems I experienced with your control. (I'm using VS2010 IDE.)
ISSUE 1: Setting your control's background property to "transparent" actually sets the background property to "black". Although in the designer's property window, it will say "transparent", the actual visible color (design time and run time) is black. All other colors work fine. (example: place your control (with transparent value set) inside a panel control that has a "red" background, your control's background stays black (design time and run time) when it should be displaying "red" (the panels background color).
ISSUE 2: The control's slider line (horz or vert) disappears but the slider ball (buttonstyle) remains visible. When? (example: Placed your control inside a panel who's visibility is set to "false" in the designer. When i run my app, a button.click, changes the panel to visible = True, (here's the problem)-> your control's slider ball is visible but the horz line is no longer visible (disappeared). Nothing fixes it (not refreshes, sendToTheFront, sendToTheBack, nothing). It's just gone. Same goes for the "TrackFillColor". Gone. I can't use it for my music app for "seeking" like that.
Request: Could you add the "Dock" property to the property window. I know i can access it through code, but it's just more convenient if it's in the property window while i'm designing my gui. Thanks
Keep up the good work. It's a really nice control.
Later,
b.ware
|
|
|
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
...
case Keys.PageUp:
ScrollChange(ChangeType.Large, false);
DrawSlider();
return true;
case Keys.PageDown:
ScrollChange(ChangeType.Large, true);
DrawSlider();
return true;
...
}
return base.ProcessCmdKey(ref msg, keyData);
}
|
|
|
|
|
To make the clicks more responsive like TrackBar
private HitTest SliderHitTest()
{
...
if (PtInRect(ref _buttonRect, pt))
result = HitTest.Button;
else if (PtInRect(ref _trackRect, pt))
result = HitTest.Track;
else if (PtInRect(ref tr, pt))
result = HitTest.Tick;
else
result = HitTest.Nowhere;
...
}
private enum HitTest : uint
{
Nowhere = 0,
Button,
Track,
Tick
}
protected override void OnMouseDoubleClick(MouseEventArgs e)
{
OnMouseClick(e);
base.OnMouseDoubleClick(e);
}
protected override void OnMouseClick(MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
var hittest = SliderHitTest();
if (hittest == HitTest.Track || hittest == HitTest.Tick)
{
Point pt;
int pos;
int incVal;
if (Orientation == Orientation.Horizontal)
{
pos = e.X;
pt = new Point(pos, _buttonRect.Top + ((_buttonRect.Bottom - _buttonRect.Top) / 2));
incVal = _buttonRect.Left + ((_buttonRect.Right - _buttonRect.Left) / 2);
}
else
{
pos = e.Y;
pt = new Point(_buttonRect.Left + ((_buttonRect.Right - _buttonRect.Left) / 2), pos);
incVal = _buttonRect.Top + ((_buttonRect.Bottom - _buttonRect.Top) / 2);
}
if (this.SmoothScrolling)
{
ScrollThis(pos);
}
else
{
var rect = Rectangle.FromLTRB(_buttonRect.Left, _buttonRect.Top, _buttonRect.Right, _buttonRect.Bottom);
if (!rect.Contains(pt))
if (pos < incVal)
{
ScrollChange(ChangeType.Large, (Orientation == Orientation.Horizontal));
}
else
{
ScrollChange(ChangeType.Large, (Orientation != Orientation.Horizontal));
}
}
}
}
base.OnMouseClick(e);
}
|
|
|
|
|
public const int WHEEL_DELTA = 120;
private int _cumulativeWheelData;
private int _wheelScrollLines = 3;
public int WheelScrollTicks
{
get { return _wheelScrollLines; }
set { _wheelScrollLines = value; }
}
protected override void OnMouseWheel(MouseEventArgs e)
{
base.OnMouseWheel(e);
var hme = e as HandledMouseEventArgs;
if (hme != null)
{
if (hme.Handled)
{
return;
}
hme.Handled = true;
}
if ((ModifierKeys & (Keys.Shift | Keys.Alt)) != 0 || MouseButtons != MouseButtons.None)
{
return;
}
if (_wheelScrollLines == 0)
{
_wheelScrollLines = SystemInformation.MouseWheelScrollLines;
}
if (_wheelScrollLines == 0)
{
return;
}
_cumulativeWheelData += e.Delta;
float partialNotches = (float)this._cumulativeWheelData / (float)WHEEL_DELTA;
int scrollBands = (int)((float)_wheelScrollLines * partialNotches);
if (scrollBands != 0)
{
int absScrollBands;
if (scrollBands > 0)
{
absScrollBands = scrollBands;
Value = Math.Min(absScrollBands + Value, Maximum);
this._cumulativeWheelData -= (int)((float)scrollBands * ((float)WHEEL_DELTA / (float)_wheelScrollLines));
}
else
{
absScrollBands = -scrollBands;
Value = Math.Max(Value - absScrollBands, Minimum);
this._cumulativeWheelData -= (int)((float)scrollBands * ((float)WHEEL_DELTA / (float)_wheelScrollLines));
}
}
if (e.Delta != Value)
{
OnScroll(EventArgs.Empty as ScrollEventArgs);
OnValueChanged(EventArgs.Empty);
}
}
protected virtual void OnValueChanged(EventArgs e)
{
var handler = ValueChanged;
if (handler != null) handler(this, e);
}
|
|
|
|
|
It's great, best I've seen but is missing one important feature, TickFrequency so when the maximum is larger than 100 the ticks don't look "squashed"
|
|
|
|
|
May I know if you have code to do that? If so, please contribute your code
|
|
|
|
|
I have a couple of mediasliders in a usercontrol.
When the usercontrol resizes (the sliders are untouched), the sliders flicker heavily.
I tried setting the sliders DoubleBuffered property to true, but that didn't work at all, it caused the slider to not being painted at all before the mouse pointer was moved over the control.
So I wondered if you have had time to look at the repainting issue mentioned below?
Cheers,
Johnny J.
Why can't I be applicable like John? - Me, April 2011 ----- Beidh ceol, caint agus craic againn - Seán Bán Breathnach ----- Da mihi sis crustum Etruscum cum omnibus in eo! ----- Just because a thing is new don’t mean that it’s better - Will Rogers, September 4, 1932
|
|
|
|
|
Hi,
First of all I like the control! I wanted to have it to resize along my application. I noticed that you have disabled the anchor and docking capabilities. I worked around that After doing so the resize went wrong and I found the cause in the PropertyChanged method were in the else statement of the if(Designmode) you also check the IsInited property, this is set to !Designmode, so it's double checking and always false. By removing this check the control resizes normally. I suspect that the property is obsolete, because it is not used somewhere else.
While debugging this issue I noticed that the control i redrawn a lot especially during initialization. This can be reduced by sending invalidation message to the control, and only redraw in the paint requests.
I hope these suggestions helps to improve the control.
|
|
|
|
|
I would like to use this awesome control in my shareware application (educational software).
The code was licensed under CPOL. Yet in in the source files there is a comment "You can not: -Sell or redistribute this code or the binary for profit."
COPL 3.D says "You may distribute the standard version of the Executable Files and Source Code or Derivative Work in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution."
Which one applies?
|
|
|
|
|
This notice mirrors the CPOL, software can not be sold as a user control, either alone or in a bundle of user controls.. But it can be used freely as part of an application commercial or otherwise.
hth,
john
|
|
|
|
|
It's Great!!!
But how can I use the slider in a vb 2010 application
modified on Monday, January 17, 2011 9:54 AM
|
|
|
|
|
Easy. Just drag the "MediaSlider.dll" to the "Toolbox" in VS2010. After that, you can just drag the control to your form or whatever usercontrol that you are using.
later,
b.ware
|
|
|
|
|
Fantastic, but I have a little problem...Is it possible to change the caption of SliderFlyOut with the time of a song ?...Now SliderFlyOut change value in milliseconds and I don't know how can I change in hour,min and seconds !
Alex
|
|
|
|
|