VS 2010 Exposing Picture Box Drawing Surface?

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


ADVERTISEMENT

Transparent Drawing Surface To Place Over A Group Of Controls?

Aug 17, 2009

Is there a transparent drawing surface I can place over a group of controls?

View 5 Replies

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

VS 2010 Drawing TEXT Into A Picture Box Looks Pixelated?

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

VS 2010 : Exposing An Instance Property As Shared?

May 24, 2010

Suppose I have a class of objects called Porky with a property called IsHuge:

Public Class Porky
Public Property IsHuge As Boolean
End Class

Now I want to make a special kind of Porky -- let's call it UberPorky -- for which I want to change ALL instances to either IsHuge or not IsHuge. What I'd like to do is this:

Public Class UberPorky
Inherits Porky
Public Overrides Shared Property IsHuge As Boolean

[code]....

The trouble is, I can't do that. I'm not allowed to reference MyBase or Me in a Shared property.

View 17 Replies

Drawing On A Picture Box

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

Drawing An Array In A Picture Box?

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

VS 2008 Drawing On A Picture Box?

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

Surface And Volume Area - Output Box?

Dec 13, 2011

Why I get a 0 in my output box when I check Surface and nothing in the output box when I check Volume. I'm not receiving any errors.

Here's the code in VB.Net:
[Imports System.Math
Public Class Form1
Public Sub Calculations()
Dim txtInput As Double
[Code] .....

View 3 Replies

Transparent Graphics Surface In Program?

Jun 3, 2010

I am making an application in VB.NET that allows a user to highlight some text in images of documents so that the highlights could be saved for future reference, but the original images would not be modified. I figured I can achieve it by creating a graphics out of an image file and allowing the user to draw on that graphics. The problem is - the graphics can not be created from indexed image files, which many of mine are. I am wondering: is it possible to create a transparent graphics surface above an image in a PictureBox control, so that the user could draw on that surface, but it would appear as if he is drawing directly on an image?

View 3 Replies

Visible Surface Of Picturebox Is Too Small?

Jun 27, 2009

I'm drawing lines directly on a PictureBox. My problem is that the visible surface of the PictureBox is smaller than expected, considering the Height and a Width properties.For example, there is a PictureBox with Height = 200 and Width = 400 points.When I draw a point with coordinates of (0,0) it is clearly visible in the topleft corner. But when I draw a point with coordinates of (399,199), it's not visible. Actually, the bottommost and rightmost point in the Picturebox seems to have the coordinates of (397,197).

What's the reason behind this? Is the PictureBox always two points smaller, or is it size-dependent? Or a wrong setting?

View 2 Replies

RE Exposing COM Interface To .NET?

Jun 29, 2010

Is it possible to create a VB6 interface that can be implemented in a .NET class? I have the need to call a method in an existing VB6 class that behind the scenes will call either a VB6 or .NET class that utilize the same interface.

MyObject.Type = "clsVB6"
MyObject.DoSomething(intID)
would behind the scenes be utilizing a VB6 class that implemented a 'DoSomething' VB6

[code]....

View 2 Replies

Game Programming :: DirectX Draw To Surface And Then Copy From It

Jul 8, 2010

I programmed with Bitblt in VB6 for about 5-6 years and now I switched to DirectX and VB.net. When I would make games in VB6, I would draw out the entire level into layers that were saved into memory on DC's.In DirectX however, I'm looking for the equivalent of that but cant find any examples around.I use a viewport system to follow the player along in the map, I copy only what is in the viewport over to the users screen.Image attached to better visualize what i mean.

View 3 Replies

Arkanoid Type Game - Bouncing A Ball Off A Surface That Disapears?

Jul 7, 2010

I have a timer that bounces the ball around. It has 2 separate parts, one for bouncing off the wall and paddle, and one for hitting a block.It touches the block and the block is suppose to disappear, it then bounces away and should not bounce where the block is again because it is gone ,So basically the problem I'm having is, every time I add a line that tells it not to bounce off the block if it is not visible, it hits the top of the block (which is the side I'm testing) and seems to get stuck on a horizontal line and just bounces left and right.Here's my timer code.

vb

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

'This top line below reads the last 'thespeedx/y' value and applies it to the new location information of the ball (which will be called shpcircle) This determines the direction, based on a constant speed[code].....

View 2 Replies

.net - Error Exposing Event Through Interface?

May 19, 2010

I have this interface

Interface IProDataSource
Delegate Sub DstartingHandler(ByVal sender As Object, ByVal e As EventArgs)
Event starting_Sinc As DstartingHandler

[Code].....

View 2 Replies

C# - Exposing Property As Variant In .NET For Interop?

Feb 28, 2012

I am creating a wrapper class in .NET (VB.NET as it happens but is equally related to C#) that is exposed to COM and one of the properties I am trying to wrap is a Variant. I thought I would just be able to use an Object, but I get an error: Public Property FieldValue([vFieldID As Object = -1]) As Object cannot be exposed to COM as a property 'Let'. You will not be able to assign non-object values (such as numbers or strings) to this property from Visual Basic 6.0 using a 'Let' statement.*

My property declaration looks like this:
Public Property FieldValue(Optional ByVal vFieldID As Object = -1) As Object
Get

[code].....

View 2 Replies

Exposing A Supporting Class From A Usercontrol

Apr 8, 2010

I have a supporting GridColumn Class that resides in the same class library project as my GridBox usercontrol.It is used in a list of GridColumns as a property.[code]In the Load event of my form I would like to use the .Add method of the List(Of GridColumn) to add columns to the usercontrol.[code]It will not work though because it cannot find the GridColumn class.If I use: "Imports <My Class Library Name>" it works, but I would like it to work without having to do so.Standard controls do this all the time.Am I putting the supporting class in the wrong place?Is there a modifier I that will expose the class when the usercontrol is dropped on a form?As a work around I created a method that adds a column but I would like to know in any case.

View 9 Replies

Exposing An Enumeration Through COM That's Declared In A Different Module?

Mar 15, 2011

I have a .NET library that needed a COM wrapper around it so it could be called from VB6ish programs, in this case specifically Microsoft Access XP I have a type that's declared in one of the classes that went into the .NET library. I thought since its public, it would be seen, but it didn't show up in Access. And yes, we made the TLB file and registered the COM interface. I had to move the type declaration into the COM module, which I really didnt want to do. Is there a way to export a type/enum through COM without actually declaring it in the COM interface Scott Berger McCormick Systems

View 3 Replies

Compiling And Running Code Dynamically / Exposing Objects From App

Jul 19, 2011

I am trying to add some scripting to my VB.NET 2010 Windows Forms Application.I have figured out how to compile and execute VB.NET code stored in an external script file from within my app using Microsoft.VisualBasic.VBCodeProvider.CompileAssemblyFromSource and InvokeMember. I can also pass and return parameters to the code in the script file.In VB6 using the VBScript Host control, I could expose instances of objects in my app to the code in the VBScript.How do I do this in VB.NET?I'd like to expose a form object (the main form for my Windows Forms Application) to my VB.NET script.I don't want to pass the form as a parameter via InvokeMember.[code]

View 3 Replies

WCF Service Generated Proxy Class Exposing Function As ByRef Sub

May 23, 2011

I have a WCF Service exposing a single contract and operation:

<ServiceContract(Namespace:="ImageSystem")> _
Public Interface IUploadService
<OperationContract()> _

[Code].....

This subsequently leads to stream casting issues, because the generated function allows me to pass a memory stream as an input (which works correctly when passed through to the service), but instead of passing me back a new stream for the response, it attempts to cast the MessageBodyStream received from the service into my memory stream.

This is, in some ways similar to other posts but as you can see, there are no enums involved in my contracts - presence of Enums caused strange proxy class generation is marked as the answer in the similar post.

Is there anywhere I configure the proxy behaviour to use the contracts I've specified? Clearly I'm within a dev/test environment currently, but when this eventually goes to production it will be memory and file streams passed to the service, and the returned stream can be in any format to be honest, I intend to treat it as the abstract stream class. The only way round this I can see right now is to change my in stream to be the same as the anticipated out stream, but surely there is a better way?

View 1 Replies

VS 2010 : Drawing Over The Controls?

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

VS 2010 Drawing On A Canvas With Wpf?

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

VS 2010 Drawing On A Image?

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

Use System.Drawing.ColorTranslator In 2010?

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

VS 2010 - Clearing The Drawing In PictureBox

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

VS 2010 Circle Diagram Drawing?

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

VS 2010 Drawing A Line From A Number?

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

VS 2010 Drawing Complicated Pattern

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

VS 2010 Drawing Image To Picturebox?

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

VS 2010 Drawing In Inches And Feet

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







Copyrights 2005-15 www.BigResource.com, All rights reserved