C# - How does the ToolTip work? - winforms

I was wondering how I am able to add one ToolTip control to the Form, and all the buttons get different texts? How does one object extends all the others, adding diferent things on each one? I don't know if I am being clear, If I don't, please let me know!
Thanks in advance!

I think you are looking for Extender Providers, where you can define new properties for other components.
This is a feature of Visual Studio designer. The ToolTip control does not actually add a property to other controls, but Visual Studio knows that when you have a ToolTip (or any other component that is an Extender Provider), it should add some other properties to property grid of the other controls. All this information is queried from the component that provides those properties (ToolTip). When you set the tooltip for button for example, Visual Studio calls the SetToolTip method of the ToolTip control, to inform it of the new value for the control.
Please refer to provided links for more information.

It's actually very simple.
Lets say you have a windows form with two controls a button and a label.
Now add a tool tip from toolbox to your form named tooltip1.
Now right click on button and go to properties, scroll down until you find tooltip on tooltip1. set the text to whatever you want. Now do the same for label.
Run the program and move the cursor over both the controls. you'll see respective tool tips.

Related

About custom control usage

I want to understand its logic and to modify. This library is refactored based on the open source library. I'm not very familiar with customization. Of course, I'll study hard.
How is it created automatically?
How is it grouped with controls, and where are properties controlled?
The Library: https://github.com/kelicto/KeLi.TreeListViewKit
How to Test: create a new form and add a TreeListView control.
Not sure i fully understand the question but:
WindowsForms comes with a UI design via Visual Studio. Users drag controls from the designer onto the target form. Each component on the form is clickable, and there is an associated Properties window; this is where values for the properties can be altered. The code in InitializeComponent, whether it be a form, or a custom control is automatically generated by the forms designer. e.g.: when you first start up there is a blank small form with no components.
Drag a textbox control from the left hand side and place it on the form. The form now contains a textbox. Click on the textbox and you can alter the properties of the textbox (name, value, width, even event handlers). Each change will alter how InitializeComponent works.
So if you wanted this custom component on your form you will need to compile the assembly it belongs and add the assembly so it can be referenced by the forms designer. Once this is done your TreeView component will be available to be dragged & dropped onto the form. Do this and you will also be able to set its properties.
Even custom components come with a designer piece; so if you were designing a component from scratch you could still drag / drop components onto that custom control and same as a form the implementation of InitializeComponent will change according to the components dropped, and the properties you set (and their location, anchoring etc which can be done on the main forms designer). I wouldn't recommend building a WindowsForms app without the designer, not that it cannot be done; ultimately it's code at the end of the day. But it's a lot more awkward to do without the visual designer component.

Winform TabControl style

I'm once again turning to you since I can't find an answer anywhere else. I have a TabControl, but I want to get rid of the ugly orange bar on top of the selected tabs. I would also like to make the tab text BOLD when selected and NORMAL when not.
Is there any easy way to achieve that goal ? I don't want to use the Appearance Buttons or Flat Buttons.
Thanks for your help !
This appearance is controlled by the Visual Styles theme selected in your operating system. In general, users do not appreciate any program that ignores their theme settings, especially when they paid money for a custom one. But you can get what you want, you'll have to set the DrawMode property to OwnerDrawFixed and implement a handler for the DrawItem event. There's a good example to get you started in the MSDN Library article for this event. Just change the font assignment in that sample code.

VS2010 Remove grid lines in WPF Design View

Is there a way to remove the annoying grid lines in the design view of Visual Studio 2010? Or at least style them to fade them off?
I'm not referring to the Grid component, but to the design view in WPF which draws visual lines over and around every components, making screens look like a soup in design view.
In Blend, if you disable Show Handles (in View > Show Handles, or F9), you can turn off those stupid blue lines.
Pretty sure you can derive from Grid and build design-time meta-data assembly with it as described on this msdn blog:
http://blogs.msdn.com/b/wpfsldesigner/archive/2010/01/13/wpf-silverlight-design-time-code-sharing-part-i.aspx#required
The reason I suggest deriving from Grid is because you want the designer to load new meta data for the type. Hopefully this implementation will override default behaviour although I have not tried myself.
Can I ask why you want to make this change? I am interested.
You say not the Grid component but those blue lines are part of the Grid control and you can simple drag them off the screen to remove them. I do not see any other light blue lines in that first link. If the problem is when you are running the app then uncheck the 'show gridlines' property for the Grid in VS2010.

WPF UI Related question

realy i don't know what i should title this problem, i hope to "WPF UI Related question" is accept able.
consider something like that form who you explore a class diagram in Visual Studio.
you select any class object in window and than right click on it then you select "Properties" menu Item and then a window will pups up that allow you to change selected class object.
or something like Auto Cad. when you draw a line you can right click on it and then select Properties menu item and then with appeared window you can change line's properties (like color of line or any thing like that).
now i want to create an application with an User Interface like these who mentioned on upper lines.
i want to create an UI that i cad draw circle and squares on it (with mouse clicks) and then when i want a "Properties" window will appeared to change objects's properties.
also with this capability that wheeling mouse wheel up-down will results in zoom in/out the screen (like Auto CAD).
finally my question is that is there any kind of frameworks or pre created controls that i can use them for achiving these goals or i have to implement all these my self?
thanks all and sorry for my bad english..
You can use this for your property grid:
WPF Property Grid
for giving zoom capability i use this and for property windows i use this.
thanks to Yogesh...

I want to create a combobox in wpf

I want to create a combobox with some style. I dont want old dropdown what we are getting. I want some new dropdown which looks very nice. Is there any way to create a dropdown like that.
Plz give me suggestions
Check this link out on msdn. This is the actual control template for the combo box. You can copy and paste this into your application (within your app's Resources).
Create a form and slap a combo box on it with some data in it. Then start changing the control template and view the results. Start off simply by changing colors and adding borders around elements to see what controls which part. Then you can start switching out larger parts of the template to match what you're looking for.
one can start with the standard combobox, and then use various controls and styles to change the look and feel of the control, and it's corresponding drop down.

Resources