VS 2010 VB6 Drawing On A Picture Box
Dec 22, 2010
In the project I am translating from vb6 to vb.net, one of the key features is in drawing various graphics like lines, circles, arcs, rectangles, etc in a Picture Box control. From what I have run into, there seems to be at least two different approaches, using WPF and GDI.
View 2 Replies
ADVERTISEMENT
Feb 7, 2012
I'm drawing some text into a picture box and it just looks so poor - so pixelated.
Here is some code I'm using
Private Sub RedrawFileList()
Dim img = New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim gr As Graphics = Graphics.FromImage(img)
[Code].....
View 13 Replies
Dec 27, 2010
studying GDI+ for drawing, there are many suggestions to expose the graphic surface for the paintbox control or a form using e.graphics in the paint event. Can graphics be exposed outside the paint for the picture box control?
In my old vb6 project that I am converting to vb.net 2010, I have several large routines located in a code module that draw lines, circles, etc on a picture box and it is desirable to keep these outside the paint event of the picture box so the same routines can be used to draw on more than one picture box.
In experimenting, I found I can create e.graphics from the picture box paint event and pass it by reference to a drawing routine and the drawing routine seems to work ok on initial experiments but it requires visiting the picture box paint event to get the drawing surface in the external sub.Is this apprach good programming practice or is there a better way to create the graphics surface of a picture box or form in subroutines outside the paint event?
View 1 Replies
Nov 8, 2011
I drew some shapes on a picture box , then when i move the form outside the bounds of the screen or move another form on it , all the shapes go away.I am using "CreateGraphics" to create the shapes.How can i keep the shapes on the picture box?
View 6 Replies
Feb 12, 2010
I've got an array with several 'x,y values'what I want to do is to go through this array and to draw those values in a picture box so that I can see a kind of profile.
View 9 Replies
Feb 2, 2011
I have my application to where you can load up an image and draw on it with the mouse left down and drag.Only problem is, if the form becomes the inactive one or is minimized/maximized the drawings go away until I scroll the image in the form (I put the redraw functionality in the picturebox.Paint event).How can I make the lines I draw stay permanently? I've put picturebox1.refresh in the minimizedchanged/maximizechanged and form.activated events and still nothing..Even tried the picturebox's resize event and nothing?
View 18 Replies
Mar 14, 2011
I have a form populated with controls. Short of looping through every control and hiding them, is there a way I can draw something like a message over them using the form's paint event? Or would I be better off putting an actual control in the middle of the form over all the controls?
View 3 Replies
Jun 30, 2010
Finally took the plunge for wpf, all was going well until i needed to do a simple drawing on a canvas control (presume this is the right surface to use). First thing i noticed is that there is no paint event in wpf so i looked at a few others (Initialized, layout updated) at this point i looked under google and found very little on this. would anyone here have or know of a tutorial to allow this functionality? My application (a testbed) will draw an archery target within the canvas along with score numbers in the correct place as follows to do this it will need to draw several filled circles with black (or white) borders and text objects in the correct position. the locations and widths of the circles will be determined using a simple algorithm so my question is on the structure of paint events within wpf, are the commands the same as in gdi+?
View 3 Replies
Sep 28, 2010
I currently have a application that takes a image of the selected area that is set by the user.
I now would like to draw a black box in the section of a image
Top left
7, 458
Bottom right
512, 472
I would like that area filled up with a black box.
View 4 Replies
Jun 8, 2010
i have used this code in Vb6 to color the background and parallely added a colo selection fuctionality on right click.Now i want the functionality to be working in VB.net 2010.
Me.BackColor = System.Drawing.ColorTranslator.FromOle(CInt(colorCode))
View 1 Replies
Mar 13, 2012
I've problem with clearing the drawing in PictureBox. The parts of a drawing are created with PictureBox1_ Paint Event like this: Name is one of the Subs (just part of a drawing). I've created a second event Timer1_Tick in which I want to clear the drawing created before but I can't reach it just with g.Clear(Color.White).
View 8 Replies
May 13, 2012
I'm trying to draw some kind of circle diagram. Input data are only two integers: "a" (even or odd) and "b" (even). Here is the
HTML Imports System.Drawing.Drawing2D
Public Class Form1
Dim P As New Pen(Brushes.Red, 1)
Dim a As Integer = 24
Dim b As Integer = 2
Dim Angle As Single = b / a * Math.PI
[Code]...
View 2 Replies
Jan 18, 2012
I have been working on an angle calculating program. I have incorprated a feature so you can type the angle and the program draw it. I have since added a few new features and updated everything as such. For the life of me I can't figure out why the draw angle has stoped working. let me just paste some code.
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
[Code]....
Right, the program isn't so complicated. The important bit is that you type an angle in textbox1 and hit enter. Then what happens is the angle is calculated against a base line (one of the new features is that this base line can be moved from left to right and center.) the problem occurs when you hit enter, the program doesnt actually draw the line for you.
View 2 Replies
Aug 13, 2010
I am refining my VS2010 control renderers and I'm working on the TabControl at the moment. If you take a screenshot of the VS2010 IDE and zoom in on the background of the TabControl (where there are no tabs), then you might see that it consists of a pattern of dots with a slightly different color than the surrounding background. I am trying to draw these dots (yes, I'm going for perfection), but I cannot find a brush that allows me to do this.I am pretty sure I'd have to use a HatchBrush with the right HatchStyle, but I cannot find a matching style.Here is a screenshot showing:
1. The VS2010 background I'm trying to draw (higher contrast and brightness otherwise it's hardly visible),
2. The HatchStyle that is closest to this (DottedDiamond)
3. Why this HatchStyle is not correct (it's missing dots where the green dots are, which I photoshopped in).
Now of course I'm going to have to draw the pattern twice (there are two patterns, offset by 1 pixel, with a slightly different color), but the more pressing problem is the green dots seen in the third image. They aren't there with the DottedDiamond style, and no other style (I think I've tried them all, but hey I might have missed some..) produces a better output.
View 4 Replies
Jul 20, 2011
I have 4 control 3 button and 1 picturebox
vb.net
Private sub Button1 Dim bm As Bitmap = New Bitmap("D:Trening4 - Copy.bmp"
[code].....
View 4 Replies
Jan 23, 2011
I am trying to make a drawing program that you can draw floor plans and the like with vb .net 2010.I know how to use gdi but I need to know how to draw lines that are scaled in inches and feet.Can anyone out there help me out with this problem?I have tried the dpi x and y but it only gives me the resolution which is 96 dpi.
View 3 Replies
Feb 17, 2011
Is it possible to draw text on a Graphics object that inverts what it's drawn on?
View 2 Replies
Oct 18, 2010
My goal is actually very simple: I simply want a (shared) function that accepts a List(Of String) which creates an image and writes those strings (line by line) onto the image. There's a bit more to it than that, but for the sake of example this is all you need to know.Usually when drawing on an image I would create a Bitmap object and get the graphics object from Graphics.FromImage:
Dim bmp As New Bitmap(100, 100)
Using g As Graphics = Graphics.FromImage(bmp)
g.FillRectangle(...)
[code]....
Seems easy enough, but the problem is that I don't know how many strings there will be in the list, nor how long they will be. The image should 'scale itself' according to the strings in the list. If the list contains 5 strings it should be 5 strings high (plus a little extra for borders). If the list contains only 1 string it should be only one string high. Same goes for the width, if the longest string is 150 pixels, the image needs to be at least 150 pixels (160, 170 or something).
This is all good, I can get the dimensions of the strings by using Graphics.MeasureString. The problem now is that I need the dimensions of the image to create the bitmap. I need the Graphics object to get the dimensions. But, I need the bitmap to get the Graphics object I'm stuck in a loop here, if I don't have the Graphics object (I can't create it from nothing..) then I cannot measure the strings, but if I cannot measure the strings then I cannot determine how large my image will be, so I cannot create a bitmap and associated Graphics object...
View 5 Replies
Jun 4, 2011
I'm trying to save the lines I drew in a PictureBox as a bitmap, but it just returns blank images...This is the code I have now:
vb
'Draw a grid on PictureBox named draw
For x As Integer = 0 To bWidth
[code]....
View 3 Replies
Feb 15, 2011
Okay, I'm making a fresh start and re-exploring my options. I'm trying to put a layer of transparency over a program that will act as a drawing layer. The cursor should be able to sniff to see whether it's sitting on transparency, or a drawn object. Transparency it will click through, while clicking on a drawn object will enable the user to edit said drawn object.
I've been trying to do this using a user control I made from scratch, but this is starting to look more and more like a dead end the deeper I get into it. Currently the layer of transparency works, along with the cursor sniffing, but the user control refuses to be brought to the front.
Any ideas on other ways to go about this / ways to make the user control work?
View 6 Replies
Jan 15, 2011
i'm an old VB6 programmer that has just starting dabbling in VB.NET 2010 and my first project is a Usercontrol Button project and i'm running into some trouble with refreshing the usercontrol on events.
For example when you mousedown on the usercontrol i want it to act as if the button is being pressed in, to do this i make the caption move 2 pixels down and to the left. And then reverse this when the usercontrol mouseup is triggered.I think my code is correct but i'm not 100% sure what i'm doing with me.refresh and the usercontrol_paint events.
[Code]...
View 6 Replies
Jul 18, 2012
I am unable to find line , oval ,rectangle etc Drawing tools in Visual Studio 2010 I am also unable to find VisualBasic.PowerPack
View 1 Replies
Mar 15, 2011
Im getting an error right now for this code, and I'm wondering if it's me, or VB2010 has changed?
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Left Then
[code].....
View 4 Replies
Nov 21, 2009
My problem is centering the 0,0 points of my graph to the center of my picturebox
Dim picBoxWidth As Integer = picGraf.Size.Width
Dim picBoxHeight As Integer = picGraf.Size.Height
Dim halfWidth As Integer = picGraf.Size.Width / 2
[code]....
So how to I tell it to start at the center of my picturebox names (picgraf) btw.
View 1 Replies
Jan 25, 2012
Basically I want to Position a line from The middle of my screen to the bottom right of my screen. But I need to draw over the game to do this. I dont mind if it flickers as long as its there is all i want. Like this VV
View 4 Replies
Jan 13, 2011
Im drawing a chart based on values from a database as an image in a picturebox. I can then add lines and circles etc in the picturebox, so as to highlight areas in the chart.
The next step I would like to do is to have temporary lines and circles, so when I move the mouse, the circle grows or shrinks and only when I release the mousebutton the circle is assigned to the chart picturebox.
View 1 Replies
Jun 3, 2012
draw individual pixels, without resorting to drawing a line and setting it's length to 1. Is there an actual ability to draw a pixel that is just 1 pixel big?
View 2 Replies
Apr 20, 2012
I would like to draw a rectangle on a form, for example to mimic a steel beam that is 6 metres long.Within this rectangle, there may be 4 "openings" or circles that mimic a diameter of 600mm, so i need to draw 4 circles within the rectangle, to indicate a beam that has 4 openings. Other issues I need to cater for is that one of the circles may not be in the centre, it may be slightly raised.The user can change the length of the beam and the size of the openings so i'd like to refresh my drawing to keep in line with this.
View 3 Replies
May 11, 2011
how to Draw text directly to the screen - effectively overlapping anything underneath it - but have it out side a form area! I would really like to have no user interface at all if possible I know what I wanted after recently using FRAPs.
View 8 Replies
Apr 28, 2010
So basically I created Dim gr As System.Drawing.Graphics on my picturebox and I am drawing on it.
Each time I cover my window with anything or move it away from the screen whatever was covered/invisible becomes missing.
As I understand I can do:
CODE:
But I just can't figure out when should I call restore().
Tried on:
CODE:
When should I restore?
View 2 Replies