VML paint brushes

Source: Internet
Author: User
  1. <HtmlXmlns: V>
  2. <Head>
  3. <Meta HTTP-equiv='Content-type' Content='Text/html; charset = gb2312'>
  4. <Meta Name='Gemeratpr' Content='NetworkProgramMember partner (lshdic) 2005'>
  5. <Title>VML simplifies pencil drawing</Title>
  6. <Style>
  7. V/: * {behavior: URL (# default # VML);}/* declare V as the VML variable */
  8. </Style>
  9. </Head>
  10. <Body Bgcolor=Black>
  11. < Div   ID = Div1   Style = "Background-color: White; width: 400; Height: 400" > </ Div > < BR > < Input   Type = Button   Value = "Clear"   Onclick = "Div1.innerhtml = ''" >
  12. <Script>// Author: fengyunwu
  13. VaRXx=0,YY=0,Oldvalue="", Poly1,Zz=1
  14. Function div1.onmousedown () {// press the mouse
  15. If (Event. Button= 1 ){
  16. Div1.setcapture () // start with the paint brush and lock the mouse
  17. Color1="Red"// Define the basic color of the paint brush
  18. Size1= 1 // define the basic width of the paint brush
  19. Xx=Event. X;YY=Event. Y; ZZ + = 1 // define the basic starting coordinate. ZZ is the third dimension and increments by default.
  20. Poly1 = Div1 . Appendchild (document. createelement (" < V: Shape   Filled = False   Path = 'M0, 0 l0, 0'   Style = 'Position: absolute; Z-index: "+ ZZ +"; left: "+ xx +"; top: "+ YY +"; width: 100; Height: 100'   Strokecolor = '"+ Color1 + "'   Strokeweight = '"+ Size1 + "'   Coordsize = '123' /> "))
  21. Oldvalue=Poly1. Path. value. Replace ("e ","")
  22. }}
  23. Function div1.onmousemove () {// move the mouse
  24. If (Event. Button= 1 ){
  25. If (Event. srcelement. tagname= "Body") {div1.releasecapture (); Return false}
  26. Oldvalue + = "," + (event. X-xx) + "," + (event. Y-yy );Poly1.path. Value=Oldvalue
  27. Poly1Poly1.path. Value= Poly1.path. value. Replace (", 0,"). Replace (", 0 e", "E ")
  28. }}
  29. Function div1.onmouseup () {// jump with the mouse
  30. Div1.releasecapture ();
  31. }
  32. </Script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.