如何保存和检索运行时创建的按钮的适用性 [英] How Do I Save And Retrieve Proprities Of Buttons Created During Runtime

查看:52
本文介绍了如何保存和检索运行时创建的按钮的适用性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以在运行时移动和调整大小的按钮,并且可以在运行时使用这些相同的特性和事件创建新按钮。现在我需要能够保存将在运行时创建的这些按钮的大小和位置(顶部,左侧)。



换句话说,你如何保存表格上任何按钮的大小和位置。



这是我用来生成新按钮的代码。

I have a button that can move and resize during runtime, and new buttons can be created during runtime with these same proprities and events. Now i need to be able to save the size and location(Top, Left) of these buttons that will be created during runtime.

In other words how do u save the size and location of any button on the form.

This is the code i use to generate new buttons.

Dim i As Integer = 0
    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Dim btn1 As New Button
        btn1.Name = "Ad" + i.ToString
        btn1.Text = "ad" + i.ToString
        AddHandler btn1.MouseMove, AddressOf Button1_MouseMove
        AddHandler btn1.MouseDown, AddressOf Button1_MouseDown
        AddHandler btn1.MouseUp, AddressOf Button1_MouseUp
        Me.Controls.Add(btn1)
        btn1.BringToFront()
        i += 1
    End Sub

推荐答案

您的问题不明确。



in我的理解你附加了mousedown和mousemove等事件,因此在这些事件中你可以跟踪按钮属性并将其保存在您需要的任何地方。
Your question is not clear.

in my understanding you have attached events like mousedown and mousemove so in these events you can track the buttons properties and save it wherever you need.


这篇关于如何保存和检索运行时创建的按钮的适用性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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