首页 > 学院 > 开发设计 > 正文

c# asp.net 鼠标改变控件坐标位置,更改控件坐标,注册表保存读取,打印,查找局域网内打印机等等收集

2019-11-17 01:37:30
字体:
来源:转载
供稿:网友

c# asp.net 鼠标改变控件坐标位置,更改控件坐标,注册表保存读取,打印,查找局域网内打印机等等收集

界面虽然被我弄的很难看,但功能还可以里边注册表的路径自己设置一下,或者加一个创建注册表的语句,不然会报错前台:

Html代码收藏代码
  1. <%@PageLanguage="C#"AutoEventWireup="true"CodeFile="FPSZ.aspx.cs"Inherits="_Default"%>
  2. <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <scriptlanguage="javaScript"type="text/Javascript"src="js/Move.js"></script>
  4. <scriptlanguage="JavaScript"type="text/javascript"src="js/PReview.js"></script>
  5. <htmlxmlns="http://www.w3.org/1999/xhtml">
  6. <headrunat="server">
  7. <title>无标题页</title>
  8. </head>
  9. <body>
  10. <formid="form1"runat="server">
  11. <!--startprint-->
  12. <div>
  13. <div>
  14. <tablewidth="100%">
  15. <tr>
  16. <td>
  17. <tablewidth="100%">
  18. <tr>
  19. <td>
  20. <asp:PanelID="pnlFPSZ"BorderWidth="1"Width="100%"runat="server">
  21. <tablewidth="100%">
  22. <tr>
  23. <td>
  24. <tablewidth="100%">
  25. <tr>
  26. <tdstyle="height:96px">
  27. <tablewidth="100%">
  28. <tr>
  29. <td>
  30. <asp:LabelID="lblTKRQ"Text="黑色头发:"runat="server"Font-Underline="true"></asp:Label>
  31. </td>
  32. <td>
  33. <asp:LabelID="lblTKRQText"Text="黑色头发"runat="server"name="label"BackColor="silver"Style="left:335px;position:absolute;top:179px"onclick="getID('lblTKRQText')"Width="50"></asp:Label>
  34. <asp:HiddenFieldID="lblTKRQText_hdl_Top"runat="server"Value=""/>
  35. <asp:HiddenFieldID="lblTKRQText_hdl_Left"runat="server"Value=""/>
  36. </td>
  37. </tr>
  38. </table>
  39. </td>
  40. <tdstyle="height:96px">
  41. <tablewidth="100%">
  42. <tr>
  43. <td>
  44. <asp:LabelID="lblMC"Text="紫色头发"runat="server"name="label"BackColor="silver"Style="left:500px;position:absolute;top:179px"onclick="getID('lblMC')"Width="50"></asp:Label>
  45. <asp:HiddenFieldID="lblMC_hdl_Top"runat="server"Value=""/>
  46. <asp:HiddenFieldID="lblMC_hdl_Left"runat="server"Value=""/>
  47. </td>
  48. </tr>
  49. </table>
  50. </td>
  51. </tr>
  52. <tr>
  53. <tdcolspan="1"style="height:340px">
  54. <tablewidth="100%"border="3">
  55. <tr>
  56. <tdstyle="width:155px">
  57. <asp:LabelID="lblJKDW_XM"Text="黑色头发紫色头发"runat="server"Font-Underline="true"></asp:Label>
  58. </td>
  59. <tdstyle="height:41px">
  60. <asp:LabelID="lblJKDW_XMText"Text="黑紫色头发"runat="server"name="label"BackColor="silver"Style="left:450px;position:absolute;top:272px"onclick="getID('lblJKDW_XMText')"Width="37"></asp:Label>
  61. <asp:HiddenFieldID="lblJKDW_XMText_hdl_Top"runat="server"Value=""/>
  62. <asp:HiddenFieldID="lblJKDW_XMText_hdl_Left"runat="server"Value=""/>
  63. </td>
  64. <tdstyle="height:41px">
  65. <tablewidth="100%"border="3">
  66. <tr>
  67. <td>
  68. <asp:LabelID="lblJKFS"Text="北京市"runat="server"Font-Underline="true"></asp:Label>
  69. </td>
  70. <td>
  71. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  72. &nbsp;&nbsp;
  73. <asp:LabelID="lblJKFSText"Text="北京市"runat="server"Font-Underline="True"name="label"BackColor="silver"Style="left:850px;position:absolute;top:274px"onclick="getID('lblJKFSText')"Width="27"></asp:Label>
  74. <asp:HiddenFieldID="lblJKFSText_hdl_Top"runat="server"Value=""/>
  75. <asp:HiddenFieldID="lblJKFSText_hdl_Left"runat="server"Value=""/>
  76. </td>
  77. </tr>
  78. </table>
  79. </td>
  80. </tr>
  81. </table>
  82. </td>
  83. </tr>
  84. </table>
  85. </td>
  86. </tr>
  87. </table>
  88. </asp:Panel>
  89. </td>
  90. </tr>
  91. </table>
  92. </td>
  93. </tr>
  94. </table>
  95. </div>
  96. <br/>
  97. <div>
  98. <tablewidth="100%">
  99. <tr>
  100. <tdstyle="width:104px">
  101. <asp:LabelID="lblDQDYJ"Text="当前打印机"runat="server"></asp:Label></td>
  102. <tdstyle="width:175px">
  103. <asp:DropDownListID="ddlDYJ"runat="server"Width="169px"></asp:DropDownList>
  104. </td>
  105. <td>
  106. <inputid="ibnSY"runat="server"type="button"value="上移"onclick="moveTop()"/>
  107. </td>
  108. <td>
  109. <inputid="ibnXY"runat="server"type="button"value="下移"onclick="moveUnder()"/>
  110. </td>
  111. <td>
  112. <inputid="ibnZY"runat="server"type="button"value="左移"onclick="moveLeft()"/>
  113. </td>
  114. <td>
  115. <inputid="ibnYY"runat="server"type="button"value="右移"onclick="moveRight()"/>
  116. </td>
  117. </tr>
  118. <tr>
  119. <tdcolspan="2">
  120. </td>
  121. <td>
  122. <asp:ButtonID="ibnBC"Text="保存"runat="server"Visible=trueOnClick="ibnBC_Click"/>
  123. </td>
  124. <td>
  125. <asp:ButtonID="ibnDY"Text="普通打印"runat="server"OnClick="ibnDY_Click"/>
  126. </td>
  127. <tdcolspan="2">
  128. &nbsp;</td>
  129. </tr>
  130. &nbsp;</table>
  131. </div>
  132. </div>
  133. <!--endprint-->
  134. <inputtype="button"name="print"value="预览并打印"onclick="preview()">
  135. </form>
  136. </body>
  137. </html>

后台:

C#代码收藏代码
  1. usingSystem;
  2. usingSystem.Data;
  3. usingSystem.Configuration;
  4. usingSystem.Web;
  5. usingSystem.Web.Security;
  6. usingSystem.Web.UI;
  7. usingSystem.Web.UI.WebControls;
  8. usingSystem.Web.UI.WebControls.WebParts;
  9. usingSystem.Web.UI.HtmlControls;
  10. usingSystem.Collections;
  11. publicpartialclass_Default:System.Web.UI.Page
  12. {
  13. Helperapp_Helper=newHelper();
  14. ArrayListal_DZ=newArrayList();
  15. stringstr_BL="";
  16. Hashtablehtbl=newHashtable();
  17. Hashtablehtbl_Read=newHashtable();
  18. QuickTestqt=newQuickTest();
  19. protectedvoidPage_Load(objectsender,EventArgse)
  20. {
  21. if(!IsPostBack)
  22. {
  23. GetControls(this);
  24. string[]print=qt.EnumeratePrintersWin();
  25. ddlDYJ.Items.Insert(0,"--请选择打印机--");//这个是设置插入静态的数据
  26. for(inti=0;i<print.Length;i++)
  27. {
  28. ddlDYJ.Items.Insert(i+1,print[i]);//这个是设置插入静态的数据
  29. }
  30. }
  31. }
  32. #region提取注册表中节点为BS_EMSYJKDSZ下所有值,赋给Label控件样式
  33. privatevoidGetControls(Controlc)
  34. {
  35. if(cisLabel)
  36. {
  37. htbl_Read=app_Helper.get_regist_value("BS_FPSZ");//查找BS_FPSZ节点下的所有值
  38. foreach(DictionaryEntrydieinhtbl_Read)
  39. {
  40. stringwriteKey=die.Key.ToString();
  41. HashtablewriteStr=(Hashtable)die.Value;
  42. stringtop_In="";
  43. stringleft_In="";
  44. foreach(DictionaryEntrydie_IninwriteStr)
  45. {
  46. stringwriteKey_In=die_In.Key.ToString();
  47. stringwriteStr_In=die_In.Value.ToString();
  48. if(writeKey_In.Equals("Top"))
  49. {
  50. top_In=writeStr_In;
  51. }
  52. if(writeKey
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表