Draw My Own Shapes On A Form?
Dec 4, 2009Can I draw my own shapes (such as a filled circle, square, etc.) on a form?Can it be done from code as well as from the designer?Can I use events such as onClick() on the shapes?
View 3 RepliesCan I draw my own shapes (such as a filled circle, square, etc.) on a form?Can it be done from code as well as from the designer?Can I use events such as onClick() on the shapes?
View 3 RepliesI have a control that looks similar to the following:
I need to add slightly round ends where all that extra end space is. I'm not sure how to add these. It should look similar to the round ends on this page.
The image editor toolbar is not active. I would like to draw lines and shapes on a form.
View 1 RepliesI want to use a loop to draw different types of shapes on a visual. I want to use the Random function sothat the number of each shape would be set randomly. For example, I want three triangles followed by two circles, followed by two triangles, etc. When you click the button again a different set of shapes would be rendered. I can draw shapes. What I need is how to use the loops and Random() to do this. I tried to use concatenation but it does not work with the Polygons.
View 15 RepliesI'm creating new buttons at runtime that I need to draw on. I have 4 different and I need to draw different shapes on them. I've started with the "rectangle button" and I've approached this
[Code]...
I'd like to draw variety of shapes to represent opreational space occupied of various rooms. I am interest to develop a web based application using visual studio and would like to use asp.net platform and the language I'll be using is VB.
View 3 RepliesI need to dynamically add ovalshapes to a form. The application user would enter a number of shapes (variable), and other parameters for the shapes as location, color,etc. After this I need to display these shapes in the screen. Every sample I found shows a fix number of shape hardcode by the programmer.
View 4 RepliesI'm trying to draw a 400x400 px image to a 400x400 form that I made. What I'm doing is:
Graphics.DrawImage Method (Image, 0, 0, 400, 400) 0, 0, 400, 400, ...
But when I run the form, the image seems to stretch slightly upon the y-axis, the x-axis seems to be working correctly.
This was what I was doing before (stretching the old smaller images to fit the size)
... (Image, 0, 0, 264, 231) 0, 0, 400, 400, ...
or something like that. Now that I'm trying to do it the correct way, I can't seem to get it to work properly.
Edit: I wonder if using a simpler verson of Graphics.DrawImage would work?
I have an "application" that consists of a form Form1, with the following code behind it:
Public Class Form1
Dim xDown As Integer, yDown As Integer
Dim g As Graphics = Me.CreateGraphics
Dim p As Pen = New Pen(Color.Black, 1)
Dim r As New Rectangle
[Code]...
How can I do the same thing with other shaped like rectangle?
I know that I need x,y,widht,height but it still don't do my rec.
in vb.net i would like to draw a regular line on a form. is there a control to do this?
View 2 RepliesCan i draw a image outside my form?
View 3 RepliesI want to move cursor with visual basic and it seems I found way how to do that. It is possible even click with Visual Basic whereever on screen. But I cannot check out where on the screen the click was done and so I want to draw two short crossing lines on that point as marker where Visual Basic clicked on screen. If it is possible to move cursor to that position and show it then it is as good as drawing marker.
View 4 RepliesDraw rectangle outside of form?[url]...
View 1 RepliesI would like to draw a rectangular outside the form using mouse position but so far, I only found out how to draw rectangular inside the form.
View 12 RepliesI want to draw a histogram when Form2 is loaded, I load Form2 using button of Form1 It didnt work, Form2 is loaded, but no image...i dont know why here's the code
Private Sub Form2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim img As Graphics = PictureBox1.CreateGraphics
[Code]....
On Form1 we have: TextBox1 TreeView1 - holds list of customers, is located near the bottom of the form, not visible from the start. Now, when I start typing text in TextBox1 (i need to filter customers), TreeView1 appears and suggest for example 30 customers matching the searched text. I want the program to show the treeview and draw it also outside of the Form1 boundaries.
View 7 RepliesI am basically teaching my students about OO programming and want them to be able to see the outcomes to methods visually. I want to draw shapes on a form but cant for the life of me get it to work - no errors but no actual shapes are being drawn. So I have created a method called drawFace which is run when a new instance of the object is created. This method has the following code in it
Form1.CreateGraphics.DrawEllipse(Pens.Black, 100, 100, 100, 50)
It doesn't cause any errors, but it doesn't seem to do anything. Also tried adding a picture box to the stage and ammending the code as such
Form1.PictureBox1.CreateGraphics.DrawEllipse(Pens.Black, 100, 100, 100, 50)
But still no joy.
i am trying to create a form that allows me to add teams and the scores and then be able to re-open and view them. i have created a form that will create the team names and save it to a file but i have no idea how to create one that will show the scores with the corresponding teams. i am using visual basic express 2008.
View 2 RepliesI need to draw a'wave form' in a panel inVB.net, the wave form will be updated once every one second. the problem is the screen blinking whenever it is updated. how can I solve this problem? the paint event code as below.
[code]...
This code is to draw a circle in the form with one button in vb.net. Dim g as system.drawing.graphics
g=me.creategraphics
dim p as new system.drawing.pent(system.drawing.color.Blueviolet)
g.drawellipse(p,150,100,30,60)
end sub
this is not working it is showing the error in the declaration of p any one can help me out to rectify this error
I need to draw free hand on a form i know how i can change the colors buts its just the drawing part. i also need it to save and load how would i do this ive been searching but nothing.
View 10 RepliesWell if I press Button1 my dot dashed line is correctly drawn over Label1, but what I need is that program automatically does it on form load.[code]
View 2 Repliesin a ordinary form I added a label (Label1) and a button (Button1) with the followiing handler. Well if I press Button1 my dot dashed line is correctly drawn over Label1, but what I need is that program automatically does it on form
load.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Graphic As System.Drawing.Graphics
[Code].....
I treid this code to draw the cells value of DataGridView on the form. but it display the three cells in the same place means: if the cells including A-B-C it didn't showed them like this : A B C
[code]For i As Integer = 0 To 2
Dim g As Graphics
g = Me.CreateGraphics()
[Code]....
i want to "draw" zebra lines in my form [code] ican import background image, but I prefer code :)
View 1 RepliesIt seems that my form refuses to draw quickly enough. I am using this
[code]...
This ends with the form freezing for a moment, and then it resizes, but it's not until the end of the resize does it display properly, during the resize, their is a big black bar where the new part of the form is supposed to be.And when it's done resizing, it draws itself correctly.
I need a code that when put in a timer will create a cursor were your cursor is and then leave it there. So its like a place marker to let you know were you were when you clicked.
View 2 RepliesI was able to make a program that can draw on a form but if I draw very fast, the lines are cut. Check image below :
Another is I want to make my form be able to load a power point presentation. Is it possible? Also, I was wondering if it is possible to save the form as image file like what we do in screenshot?
I have a form called frmMain and I created a second instance of the form to display on a second monitor using the code:
Public
frmMain2 as new frmMain
I am trying to prevent flickering when I switch between forms by overriding the OnPaintBackground event and drawing a background image in OnPaint. The OnPaint code works great for frmMain, but any time I use an e.Graphics... command it only applies to frmMain and not frmMain2. I'm thinking I either need to have a separate override for the OnPaint event for frmMain 2 or use e.Graphics.to draw on the second monitor, but I don't know how to do either. I have drawn on the second monitor outside of OnPaint by using:
Dim g as Graphics = CreateGraphics()
Dim g2 as Graphics = frmMain2.CreateGraphics
Then I use g.DrawImage for frmMain and g2.DrawImage for frmMain2. This does not work inside of OnPaint. I tried it and everything gets drawn on the first monitor.