Recently unemployed at home, I have nothing to do, so I usually work, I have been accumulated when I study, I have made Demo, send it to everyone. First give everyone a rotating button control, just like CD Player ~~
Sample code: http://61.133.87.165/bbs/attachment.php? S = & postid = 216360
In addition, I have a lot of categories here, I have written, translated, and so on. Contact me with me in Ytweiwei@cnuninet.com. I hope everyone can learn together and progress!
The documentation of the class is as follows: (For everyone, you can find this document in Demo)
-------------------------------------------------- -------------------------------------------------- ----
CroundsliderCtrl
CSLIDERCTRL
|
---- CROUNDSLIDERCTRL
This class is a derived class of CSLIDERCTRL. Expand the function of the circular slider control, and you can customize the color, pictures, settings in the control, etc. in the control.
Precautions when using this class:
1. Need to join the MEMDC.H file to the project, considering the universality of this class, if there is already in the original project, please do not repeat it.
2, add mouse pointer resources IDC_CURSOR
3. Some functions used in this class are from the Internet, and the copyright is still owned by it.
4, this class is created under VC6, due to certain particularities, compiling abnormal phenomena under VC.NET.
Instructions:
1. Add slider controls in the dialog and change to the size you want.
2, associated with control variables with controls in ClassWizard (such as M_RSCMYSLIDER)
3. In OnInitDialog (), you can call set setRange (), setpos () and other functions as needed to set up the initialization control.
When the control pointer is sliding, it sends a WM_Scroll message, so you can get the current location of the slider in your dialog. such as:
Void Croundsliderctrldemodlg :: Onhscroll (uint nsbcode, uint npos, cscrollbar * pscrollbar)
{
IF (pscrollbar-> getdlgctrlid () == IDC_SLIDER)
{
Trace ("WM_HSCROLL BY CROUNDSLIDERCTRL RECEIVED. NPOS:% LD? NSBCODE:% LD / N", NPOS, NSBCODE
}
CDIALOG :: OnhScroll (NSBCode, NPOS, Pscrollbar);
}
You can also overload the ONFORMATTEXT function in the derived class from the define the text displayed in the control, such as:
CString cfrequerncectrl :: ONFORMATTEXT (Const Cstring & StRTEXT)
{
CString strformattedtext;
StrformattedText.Format ("%. 1FMHz", 87.5 getpos () / 360.0 * 20.6);
Return strformattedText;
}
operating
-------------------------------------------------- -----------------------------------------
SetRange setting control adjustable range
GetRege gets the adjustable range of the control setknobradius set the size of the pointer
Getknobradius gets the size of the pointer
SetDragbyknobonly indicates whether the pointer should be rooted by the mouse.
GetDragbyknobonly determines whether it should only make the pointer root a mouse
Setzero Specifies the default angle of the pointer when starting
Getzero gets the start of the pointer default angle
SetBitmap set bitmap background for control
Setknobcolor Setting Pointer The left mouse button does not press the color
SetActiveknobcolor Setting Pointer The color of the left mouse button is activated or dragged.
SetDialColor Sets the background color of the slider control
Character operation
-------------------------------------------------- -------------------------------------------------- --------
SetText sets characters in a circular control
GetText gets a string within the current control
SetTextColor Specifies the string color displayed in the control
SetFontBold indicates whether the font in the control is a black body
SetFontunderline indicates whether the font in the control has a underscore
SetFontital Indicates whether the font in the control is a bevel
SetFontSIZE Settings the size of the font in the control
SetFontName Set the name of the font in the control
SetShowText Indicates whether the control should be displayed inside
Member function
-------------------------------------------------- -------------------------------------------------- ------------
CroundsliderCtrl :: setRange
Void SetRange (int Nmin, int Nmax, Bool Bredraw)
Parameter:
Minimum value of Nmin slider range
The maximum value of the NMAX slider range
BredRaw indicates whether to immediately redraw control immediately
Speaking:
Calling this function Setting up the adjustable range of the entire control, more detailed information, please refer to the description of CSLIDERCTRL :: SetRange in MSDN
-------------------------------------------------- -------------------------------------------------- ------------
CroundsliderCtrl :: getRange
Void GetRange (int & nmin, int & nmax)
Parameter:
Nmin obtained control range minimum
NMAX's maximum control range
Speaking:
Call the function to get the adjustable maximum / minimum of the current slider control
-------------------------------------------------- -------------------------------------------------- -----------
CroundsliderCtrl :: setText
Void SetText (const cstring & strnewtext)
Parameter:
StrnewText CString Object Type String
Speaking:
Call this function to set characters in the circular control. When allowing the control to display the character, if this function is not called, the system will default to display the current position value of the slider inside the control.
-------------------------------------------------- -------------------------------------------------- ----------- CROUNDSLIDERCTRL :: GetText
CString getText () const
return value:
Returns the content displaying the font within the current control
Speaking:
Call this function to get a string within the current control, the character is set by the previous call setText, otherwise the result returned no meaning.
-------------------------------------------------- -------------------------------------------------- ------------
CroundsliderCtrl :: setknobradius
Void Setknobradius (Const Int Nnewknobradius)
Parameter:
NNEWKNOBRADIUS involves integer variables of the pointer size, the value cannot be less than 5
Speaking:
Set the size of the pointer
-------------------------------------------------- -------------------------------------------------- ------------
CroundsliderCtrl :: getknobradius
INT getknobradius () const
return value:
Returns the current pointer size
Speaking:
Get the size of the pointer
-------------------------------------------------- -------------------------------------------------- ------------
CroundsliderCtrl :: setdragbyknobonly
Void setdragbyknoBonly (const bool bdragbyknobonly)
Parameter:
BDRAGBYKNOBONLY If this value is true, then the control pointer is dragging only when the mouse pointer is dragging over this control pointer.
Speaking:
Indicates whether the pointer should be rooted by the mouse
-------------------------------------------------- -------------------------------------------------- ---------
CroundsliderCtrl :: getDragbyknobonly
Bool getDragbyknobonly () const
return value:
If it is true, then only the control pointer is dragging only when the mouse pointer is dragging over this control pointer.
Speaking:
Determine if the pointer should be rooted by the mouse
-------------------------------------------------- -------------------------------------------------- ----------------
CroundsliderCtrl :: setzero
Void Setzero (Const Int Nzero)
Parameter:
The angle value initialized by the NZERO control, this value should be not less than 0 and more than 360
Speaking:
Specify the beginning of the pointer default angle
-------------------------------------------------- -------------------------------------------------- -----------
CroundsliderCtrl :: getzero
INT getzero () const
return value:
0 - 360 control initial angle value
Speaking:
Get the start of the pointer default angle
-------------------------------------------------- -------------------------------------------------- -----------
CroundSliderCtrl :: setDialcolor
Void setDialcolor (const colorref crbkgnd)
Parameter:
CRBKGND slider control background color value, can be any of RGB three colors
Speaking:
Call this function to set the background color of the slider control; Note: This function can only work when not calling setBitmap.
-------------------------------------------------- -------------------------------------------------- ----------------
CroundsliderCtrl :: setknobcolor
Void setknobcolor (const colorref crbkgnd)
Parameter:
CRBKGND pointer is not pressed at the left mouse button
Speaking:
Calling this function can set the pointer to the color when the left mouse button is not pressed, the system is set to the system color_3dface color by default
-------------------------------------------------- -------------------------------------------------- -----------
CroundsliderCtrl :: setActiveknobcolor
Void SetActiveknobcolor (const colorRef crbkgnd)
Parameter:
CRBKGND Pointer Press the color when the left mouse button is activated
Speaking:
Calling this function can set the pointer to press the color or drag the color when the left mouse button is activated or dragged, and the system is set to the system Color_3dface color by default.
-------------------------------------------------- -------------------------------------------------- ---
CroundsliderCtrl :: setTextColor
Void SetTextColor (const colorref crText)
Parameter:
Crtext RGB color value
Speaking:
Specify the string color displayed in the control
-------------------------------------------------- -------------------------------------------------- ---
CroundsliderCtrl :: setFontbold
Void SetFontBold (const bool bset)
Parameter:
Bset Boolean value, indicating whether the font is black body
Speaking:
Indicates whether the font in the control is a black body
-------------------------------------------------- -------------------------------------------------- ----
CroundsliderCtrl :: setFontunderline
Void setFontunderline (Const Bool Bset)
Parameter:
Bset Boolean value indicating whether the font has underscore
Speaking: Whether the font in the control is underline
-------------------------------------------------- -------------------------------------------------- ----
CroundsliderCtrl :: setFontitalic
Void setFontital (Const Bool Bset)
Parameter:
Bset Boolean value indicates whether the font is italic
Speaking:
Indicates if the font in the control is a bevel
-------------------------------------------------- -------------------------------------------------- -----
CroundsliderCtrl :: setFontsize
Void setFontsize (const int nsize)
Parameter:
NSIZE font size integer variable
Speaking:
Set the size of the font in the control
-------------------------------------------------- -------------------------------------------------- -
CroundsliderCtrl :: setFontname
Void SetFontName (Const Cstring & Strfont)
Parameter:
Strfont string variable for csting types of font information
Speaking:
Set the name of the font in the control
-------------------------------------------------- -------------------------------------------------- -
CroundsliderCtrl :: setShowText
Void setShowText (const bool bshow / * = true * /)
Parameter:
BSHOW indicates whether the control is to display the text of the current sliding content.
Speaking:
Indicates whether the inside of the control is to display the text of the current sliding content, by default, there is no display inside the control
-------------------------------------------------- -------------------------------------------------- ------------
CroundsliderCtrl :: setBitmap
Void setBitmap (uint unnbitid)
Parameter:
UNEWBITID bitmap resource ID
Speaking:
Calling this function can set a bitmap background for the control, and the picture size is best consistent with the control size.