Control Chat topic: How to customize a personalized interface control with C # Moderator and expert Introduction Moderator: Guest_jswang_ms Microsoft Expert: Han Dingyi (Guest_danny_ms), Zhaoyan (Guest_francs_ms) Host Guest_jswang_ms says: Welcome to participate in Microsoft online technology chat. Host Guest_jswang_ms says: The topic of this chat is how to customize the personalized interface control host Guest_jswang_ms says with C #: First, let's welcome engineers from Microsoft Global Technology Center Zhaoyan, Han Dingyi host Guest_ Francs_ms says: Hello everyone, I am Microsoft Global Technology Center Technology specialist Zhaoyan, I am very happy to be here with you today to discuss. Host Guest_danny_ms says: Hello! I am Microsoft Global Technology Center (Shanghai) technical specialist Han Dingyi. Welcome to join us in discussing the problem. Guest questions Q and expert answers A[q] Sarillafan:hi, I want to ask one question, are there any, the whole style in A simple way? [A] You can set the control's flat property to system and write a manifest file [a] to make the controls in your program show XP under Windows XP, refer to http://msdn.microsoft.com/library/ Default.asp?url=/library/en-us/dv_vstechart/html/vbtchusingwindowsxpvisualstyleswithcontrolsonwindowsforms.asp. [Q] xiaohei:manifest files mainly include those content [A] I have just given the link in some:
<?xml version= "1.0" encoding= "UTF-8" standalone= "yes"? ><assembly xmlns= "Urn:schemas-microsoft-com:asm.v1" Manifestversion= "1.0" ><assemblyidentity version= "1.0.0.0" Processorarchitecture= "X86" name= "microsoft.winweb.<executable Name>" Type= "Win32"/><description>.net control deployment tool</description><dependency> <dependentAssembly> <assemblyIdentity type= "Win32" name= " Microsoft.windows.common-controls " version=" 6.0.0.0 " processorarchitecture= "X86" Publickeytoken= "6595B64144CCF1DF" language= "*" /> </dependentassembly></depenDency></dependency> .....
[Q]i when the control is repaint, how can I achieve an irregular gradient effect? [A]. NET class library has System.Drawing.Drawing2D.LinearGradientBrush can draw the effect of the gradient, http://www.codeproject.com/cs/miscctrl/ cutebutton.asp [A] If you draw (DrawLine) can customize a richer effect, but implement a more complex [Q] can customize the gradient formula? [A] everything starts at the bottom and, of course, you can define the gradient formula [Q] Sarillafan: Can you give me some code to demonstrate how to draw a flat control (Flat controls) [A] Repaint menu examples are: http://www.codeproject.com /cs/miscctrl/vsnetmenu.asp, this example paints visual Studio. NET-style example. [A] The example of a redraw toolbar is: http://www.codeproject.com/cs/miscctrl/vsnettoolbar.asp. [A] You need a flat drop-down box control, you can refer to the example on http://www.codeproject.com/cs/miscctrl/vsnetcombobox.asp. [Q] Seventh: Can you change the background color of the MainMenu bar in the process of re painting? [A] can, you can overload Menuitem.ondrawitem () [Q] Liuliu: Can all controls be repaint? It seems that some of the controls are complex. [A] Yes. Indeed, some classes are more complex. For example: ComboBox, ToolBar. [Q] Liuliu: So how do you redraw those things that are more complex than buttons and forms? Like toolbar? [A] you need to overload many of the event-response functions, as exemplified in http://www.codeproject.com/cs/miscctrl/vsnettoolbar.asp. [Q] Xiaohei: Can you introduce an example and method of drawing irregular forms? [A] You can make the form transparent and use the map to implement [Q] Seventh: If you redraw a lot of textures in the process, it seems to make the program very slow, how can you solve the problem? [A] You can open a cached graphics object, draw it in there, and then show it to the screen [Q]what is MSIL? [A] that's Microsoft IntermediThe abbreviation of ate language [a]. NET compiles all of its languages first into IL, executing it so that different languages can be in. NET platform has almost the same performance, provided they are compliant and can be compiled into IL [q]shall we study il just as we should study ASM? [A] is not required, IL is transparent to the creator of the upper language, if you understand the IL specification, you can develop a new language of. NET support. [Q] In the process of mapping, I found that the color of the picture RGB value will sometimes be very inexplicable changes, affecting the interface effect, excuse me, why would this happen? Can it be avoided? [A] may be because you set a picture of the number of colors is too low [Q] Seventh: If I need to paste some irregular shape of the picture, it is necessary to set the picture into a background transparent GIF picture, sometimes this is very troublesome AH ~!! [A] bitmap.maketransparent () need to draw a shortcut bar like Outlook to see the example on http://www.codeproject.com/cs/miscctrl/OutlookBar.asp. For information about the System.Windows.Forms.Control class, see Msdn:ms-help://ms. Vscc/ms. msdnvs/cpref/html/frlrfsystemwindowsformsbuttonmemberstopic.htm [Q] maorachow:Question:if I created a C # Program,can I Run it on window98? [A] If your Windows98 installed the. NET framework, that's OK [Q] What kind of controls do you want to vs.net the Properties window inside? [A] You can look at the example on MSDN: Property grid http://samples.gotdotnet.com/quickstart/winforms/doc/ControlRef/ Propertygridctl.aspx http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/ Usingpropgrid.asp Http://msdn.microsoft.com/library/default [A] You can use the SysTem. Windows.Froms.PropertyGrid class http://www.codeproject.com/cs/miscctrl/globalizedpropertygrid.asp [Q] Mmud: I mean, what kind of automatic docking function? Do you have a PropertyGrid class? [A] control has dockable properties, you can set the [Q] Xiaohei: You can make the form transparent, and use the map to achieve, how to implement the texture, for example, OK? [A] Add a PictureBox on the form [how does q]c# implement XML? A XML is just a specification,. NET is built on the basis of XML, C # can take advantage of this standard, and it has nothing to do with the implementation of this standard [Q] Seventh: The menu bar in an executable state is usually gray, can you please, how to repaint? [A] Overload the OnPaint event response function of the MenuItem class [Q] Mmud: Where else can I see the chat record, like the old ones? [A] The last chat record can be http://www.microsoft.com/china/community/article.asp?oBODY=Chat/ChatRecord/chat0724&oXSLT= Chat/chat found Summary host Guest_danny_ms says: Let me do some summary [Q] What is a control repaint: [A] Control repaint is the implementation of an interface control that meets a particular requirement by overloading an existing control class or overloading the System.Windows.Forms.Controls class. These controls can have special style, special event response, and so on. For information about the System.Windows.Forms.Control class, see
MSDN (Ms-help://ms. Vscc/ms. msdnvs/cpref/html/frlrfsystemwindowsformsbuttonmemberstopic.htm)
For an example of localized System.Windows.Forms.PropertyGrid, see
Http://www.codeproject.com/cs/miscctrl/globalizedpropertygrid.asp
For an example of a repaint button control, see
http://www.microsoft.com/china/community/article.asp?obody=techzone/techarticle/techdoc/redrawcomponent& Oxslt=techzone/techarticle/techcontent and Http://www.codeproject.com/cs/miscctrl/cutebutton.asp
Special effects, such as gradients, are required, and you can use the System.Drawing.Drawing2D.LinearGradientBrush class
Ms-help://ms. Vscc/ms. Msdnvs/cpref/html/frlrfsystemdrawingdrawing2dlineargradientbrushmemberstopic.htm
You need to draw a shortcut bar like Outlook, see examples
Http://www.codeproject.com/cs/miscctrl/OutlookBar.asp
You need a flat drop-down box control, you can refer to the example
Http://www.codeproject.com/cs/miscctrl/vsnetcombobox.asp
To make the controls in your program appear XP-style under Windows XP, refer to the
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/ Vbtchusingwindowsxpvisualstyleswithcontrolsonwindowsforms.asp
You need a folder browser to refer to examples
Http://www.codeproject.com/cs/miscctrl/folderbrowser.asp
For examples of restrictions on the entry of a textbox, see:
Http://www.codeproject.com/cs/miscctrl/maskedcsedit.asp
For examples of controlling trayicon in the taskbar, see
Http://www.codeproject.com/cs/miscctrl/notifyiconex.asp
Examples of repaint menus are:
Http://www.codeproject.com/cs/miscctrl/vsnetmenu.asp
This example paints visual Studio. NET-style example. Examples of repaint toolbars are:
Http://www.codeproject.com/cs/miscctrl/vsnettoolbar.asp
Examples of the adoption of the skin mechanism are:
Http://www.codeproject.com/cs/miscctrl/SkinnedSlider.asp
Conclusion host Guest_jswang_ms says: Well, thank you all for participating in this Microsoft expert technology chat. Host Guest_jswang_ms says: Also thanks to Zhaoyan and Han Dingyi engineers can take time to participate in the chat. Host Guest_jswang_ms says:
Our chat time is in the afternoon 4:00~5:00. I hope we can see you again next time. Host Guest_jswang_ms says:
the next topic is. NET PassportHost Guest_jswang_ms says: If you have any questions, please join our News Group
microsoft.public.cn.dotnet.framework
Microsoft.public.cn.dotnet.csharpHost Guest_jswang_ms says: Microsoft's mail server is:
msnews.microsoft.comThis is the end of this chat, thank you!