Drawing Objects Cut Off Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BooleanNoob
    New Member
    • Feb 2015
    • 3

    #1

    Drawing Objects Cut Off Help

    I am in my Visual Basic Class and when I draw a circle or any other objects with their dimensions, it cuts off. I know it is supposed to work, but it still cuts off.

    Its frustrating has my instructor wants us to make a shape the size of the monitor, or at the minimum of 800 x 600.

    Here is the code I currently have:

    Code:
    Public Class Form1
        Dim myGraphics As Graphics = Me.CreateGraphics
        Dim myPen As Pen
        Dim myBrush As Brush
        Dim myRectangle As New Rectangle
        
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub btnDraw_Click(sender As Object, e As EventArgs) Handles btnDraw.Click
            myPen = New Pen(Drawing.Color.Blue, 5)
            myBrush = New SolidBrush(Color.Coral)
            myRectangle.X = 100
            myRectangle.Y = 100
            myRectangle.Width = 200
            myRectangle.Height = 200
            myGraphics.DrawEllipse(myPen, myRectangle)
    
    
    
        End Sub
    End Class
    Attached Files
    Last edited by Rabbit; Feb 25 '15, 07:45 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3665

    #2
    Have you tried different starting values for Lines 15-18, just to see if you can get any object that is not cut off?

    Comment

    • BooleanNoob
      New Member
      • Feb 2015
      • 3

      #3
      Yes. It ends up the same way.

      Comment

      • BooleanNoob
        New Member
        • Feb 2015
        • 3

        #4
        I figured it out. Essentially the dimensions have to be in the Button itself, not the form's universal placement.

        Thank you.

        Comment

        • twinnyfo
          Recognized Expert Moderator Specialist
          • Nov 2011
          • 3665

          #5
          I'm glad you found a solution and shared with the forum. Hopefully this can help others who have similar problems.

          Comment

          Working...