![]() The items are placed into these areas based on their layout options. The image area is based on the image size. The text area is reduced from the button area by the text margin values and the image area. The button area is reduced from the control area by the control padding values. The control area, button area, text area, and image area. The control is just a process of layering the parts together in the right positions. Then RaiseEvent ClickButtonArea( Me, New EventArgs) If MouseDrawState = eMouseDrawState.Down _ Private Sub CButton_MouseUp( ByVal sender As Object, _īyVal e As ) Handles Me.MouseUp ![]() Public Event SideImageClicked( ByVal Sender As Object, _ ' Add a new Click event for only when the ButtonArea or SideImage is Clicked Public Event ClickButtonArea( ByVal Sender As Object, _īyVal e As ) Just use it like a normal button.īecause the Click event fires if you click anywhere on the control, I added two new Events the ClickButtonArea event in Version 1.1 to fire only when the mouse clicks inside the button part of the control, and the SideImageClicked event in Version 2.0. Once you get the CButton designed the way you want, there isn't really any complicated code. Offset the edges of the ButtonArea from the edge of the Control Set the TextRenderingHint of the Graphics Object for better looking textĪdd an extra image that can be placed outside the button surface Push the text away from the inside edge of the button Show or not show the shadow of the text and in what color Number to adjust the buttons color during mouse rollover and click What color gradient type to use (Solid, Linear, or Path)ĬenterPoint and FocusScales for Path Gradient Type Fills What shape the button is (Rectangle, Ellipse, Triangle) Here is a list of the primary properties: Basically, I created the properties I was looking for, and then took over the OnPaint to draw it the way I wanted. There are a lot of great button controls already, but not with all the features I was looking for. Here is another example of needing (well, let's be honest, a plain button would work, so I wanted) a better looking and visually versatile button. CornerRadius became an expandable property Corners allowing each corner to be adjusted separately.ButtonColorCenterPoint, and ButtonColorCenterPtOffset were combined into FocalPoints.ButtonColorA, ButtonColorB, and ButtonColorC were combined into ColorFillBlend allowing unlimited Color blend instead of being limited to only three colors.This enabled me to combine some properties into one single property, or improve on others. See UITypeEditorsDemo for a detailed explanation. I improved design time editing in Version 1.2 by adding UITypeEditors and ControlDesigners. Normal button image and/or additional sideimage.Adjustable rollover and click color change with simulated click movement.Adjust the corners of a round rectangle.With Version 3.5 the DesignerRectTracker Class is no longer needed and will require some designer clean up of existing projects that use the old control and will be using the new one. Important Note For Existing Users of versions earlier than 3.4. This is a great alternative to the plain Microsoft button. Sorry I didn't realize the "C" prefix was a language specific thing when I started. The CButton is a simple custom button control written in VB.NET.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |