NUMERIC UPDOWN CONTROL TO ACCESS WITH GRAPHICS PROPERTIES

Madhu Mitha

Total Post:31

Points:217
Posted by  Madhu Mitha
VB.Net 
 987  View(s)
Ratings:
Rate this:
Hi,

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
        buildmap()
    End Sub
#End Region
#Region "build grid"
    Public Sub buildmap()
        For row = 0 To x
            For column = 0 To y
                drawbox(row, column)
            Next
        Next
    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

Output:


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. Pawan Shukla

    Post:38

    Points:274
    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()
                InitializeComponent()
            End Sub
     
            Private   Sub New_Load(ByVal sender As Object, ByVal e As EventArgs)
                Me.studentTableAdapter.Fill(Me.myDBDataSet.Student)
            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())
     
                Next
                Dim item As DataGridViewRow
                For Each item In dataGridView1.Rows
                    item.Height = Integer.Parse(numericUpDown1.Value.ToString())
     
                Next
            End Sub
        End Class
    End Namespace

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!