如何从Sql表保存和检索控件的位置? [英] How Do I Save And Retrieve The Location Of A Control From Sql Table?

查看:80
本文介绍了如何从Sql表保存和检索控件的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我用来移动我的控件的代码,如何从sql数据库表中保存和检索此控件的当前位置?

This is the code that i use to move my control, how do i save and retrieve the current location of this control from a sql database table?

If _mouseDown = True And RadioButton1.Checked = True Then
            Button1.Width = e.X
        Else
            If e.X >= Button1.Width - 3 And RadioButton1.Checked = True Then
                Button1.Cursor = Cursors.VSplit
            Else
                Button1.Cursor = Me.Cursor
            End If
        End If
        If _mouseDown = True And RadioButton1.Checked = True Then
            Button1.Height = e.Y
        Else

            If e.Y >= Button1.Height - 3 And RadioButton1.Checked = True Then
                Button1.Cursor = Cursors.HSplit
            Else
                Button1.Cursor = Me.Cursor
            End If
        End If

推荐答案

创建一个SQL表,其中包含每个控件的X和Y坐标的一组Integer列。然后,编写一个以坐标为参数的存储过程,并在需要保存时执行它。



检索它们更容易;编写一个Select查询,将它们返回到记录集中。每当您需要检索它们时,执行查询,并从返回的行中读取值。
Create a SQL table containing a set of Integer columns for the X and Y coordinates of each control. Then, write a stored procedure that takes the coordinates as arguments, and execute it whenever you want to save them.

Retrieving them is even easier; write a Select query that returns them into a recordset. Whenever you need to retrieve them, execute the query, and read the values from the returned row.


这篇关于如何从Sql表保存和检索控件的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆