numeric updown control to access with graphics properties

Total Post:31

 1356  View(s)
Rate this:

I am developing an application on LCD font makers. I just completed an work on drawing boxes where i have to place my fonts. now I need to add numeric updown control which should help me in increasing and decreasing the rows and columns in the grid.. can anyone help me resolving my problem.

my code is

Public Class Form1
    Dim x As Integer = 16
    Dim y As Integer = 144
    Dim box(x, y) As PictureBox
#Region "Run time Load"
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
#End Region
#Region "build grid"
    Public Sub buildmap()
        For row = 0 To x
            For column = 0 To y
                drawbox(row, column)
    End Sub
#End Region
#Region "Draw"
    Public Sub drawbox(ByVal row As Integer, ByVal column As Integer)
        box(row, column) = New PictureBox
        box(row, column).Size = New Point(8, 8)
        box(row, column).BorderStyle = BorderStyle.FixedSingle
        box(row, column).BackColor = Color.White
        box(row, column).Location = New Point((box(row, column).Width * column), (box(row, column).Height * row))
        Me.Controls.Add(box(row, column))
    End Sub
#End Region


numeric updown control to access with graphics properties

This will be my output screen where the numeric controls are used to increase and decrease the rows and column in the current form.

Thanks in advance
  1. Post:36

    Re: numeric updown control to access with graphics properties

    Try this code

    Imports System
    Imports System.Collections.Generic
    Imports System.ComponentModel
    Imports System.Data
    Imports System.Drawing
    Imports System.Linq
    Imports System.Text
    Imports System.Threading.Tasks
    Imports System.Windows.Forms
    Namespace Updown
        Public partial Class Form1
         Inherits Form
            Public  Sub New()
            End Sub
            Private   Sub New_Load(ByVal sender As Object, ByVal e As EventArgs)
            End Sub
            Private  Sub numericUpDown1_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
                Dim item As DataGridViewColumn
                For Each item In dataGridView1.Columns
                    item.Width = Integer.Parse(numericUpDown1.Value.ToString())
                Dim item As DataGridViewRow
                For Each item In dataGridView1.Rows
                    item.Height = Integer.Parse(numericUpDown1.Value.ToString())
            End Sub
        End Class
    End Namespace

      Modified On Apr-09-2018 01:59:51 AM