Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
F

flamingo2

@flamingo2
About
Posts
5
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • rectangle in picture box
    F flamingo2

    am trying to draw rectangle but it is drawn just with a single click (with different lengths and widths) also it is going out of pictureBox area But i want it to start from where mouse key is pressed and end where mouse key is released. i think there is something wrong with my quardinate. Waiting for reply. Thanks [code] Dim x1, y1, x2, y2 As Integer Dim MD, MU As Point Dim mywidth As Integer Dim drawtool As String Dim drawpen As Pen Dim g As Graphics Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown MD = e.Location x1 = MD.X y1 = MD.Y End Sub Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp If e.Button = Windows.Forms.MouseButtons.Left Then MU = e.Location x2 = MD.X y2 = MD.Y DrawRectangle() End Sub Public Sub DrawRectangle() gr = PictureBox1.CreateGraphics Dim solidColorBrush As SolidBrush = New SolidBrush(Color.Red) Dim coloredPen As Pen = New Pen(solidColorBrush) coloredPen.Width = 3 coloredPen.Color = Color.Blue Dim drawArea2 As Rectangle = New Rectangle(x1, y1, x2, y2) gr.DrawRectangle(coloredPen, drawArea2) gr.Dispose() End Sub [End code]

    Visual Basic graphics

  • how to draw a line on a picture box
    F flamingo2

    I am trying to draw rectangle but it is drawn just with a single click (with different lengths and widths) also it is going out of pictureBox area But i want it to start from where mouse key is pressed and end where mouse key is released. i think there is something wrong with my quardinate. Waiting for reply. Thanks [code] Dim x1, y1, x2, y2 As Integer Dim MD, MU As Point Dim mywidth As Integer Dim drawtool As String Dim drawpen As Pen Dim g As Graphics Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown MD = e.Location x1 = MD.X y1 = MD.Y End Sub Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp If e.Button = Windows.Forms.MouseButtons.Left Then MU = e.Location x2 = MD.X y2 = MD.Y DrawRectangle() End Sub Public Sub DrawRectangle() gr = PictureBox1.CreateGraphics Dim solidColorBrush As SolidBrush = New SolidBrush(Color.Red) Dim coloredPen As Pen = New Pen(solidColorBrush) coloredPen.Width = 3 coloredPen.Color = Color.Blue Dim drawArea2 As Rectangle = New Rectangle(x1, y1, x2, y2) gr.DrawRectangle(coloredPen, drawArea2) gr.Dispose() End Sub [End code]

    Visual Basic graphics help tutorial

  • how to draw a line on a picture box
    F flamingo2

    hy thnx Allen, your code works fine . but i also want to draw a rectangle on picture box and for this i need to know the quardinate of mouse down and up position. I also want to use freehand drawer, i dont have any idea abt it. Thanks for the solution again. Fareed

    Visual Basic graphics help tutorial

  • how to draw a line on a picture box
    F flamingo2

    I want to draw a line on a picture box, when mouse key is pressed it will save the current position and when mouse key is released it will draw a line up till that point. but my code is not working, can any body help me out of this. [code] Public Class Form1 Dim x1, y1, x2, y2 As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown x1 = MousePosition.X y1 = MousePosition.Y End Sub Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp x2 = MousePosition.X y2 = MousePosition.Y End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint e.Graphics.DrawLine(Pens.Black, x1, y1, x2, y2) End Sub End Class [end code] thanks in advance Fareed

    Visual Basic graphics help tutorial

  • Drawing in VB2005
    F flamingo2

    Create a drawing program with the following features: a. The user has a bounded drawing area (i.e., the user is not drawing directly on the form). b. The user has three "tools" with which to draw: a line drawing tool, a box drawing tool, and a freehand drawer. When the line tool is selected, the user clicks on the drawing area and, holding the button down, moves the mouse. When the button is released, a line is drawn between the point where the button was pressed and the point where it was released. (For all of the drawing tools, you will want to write code for the MouseDown and MouseUp events of your drawing area.) The box drawing tool works in the same manner as the line drawer, except the two points are considered the corners of a box to be drawn. When the freehand tool is selected, clicking in the drawing area places a point where the mouse pointer is. As long as the mouse button is held down, the user can move the mouse and lines will be drawn from point to point. The effect will be that the user is drawing directly with the mouse pointer (like the “Pencil” in the Windows Paint program). I dont know really how to start, how to include line, rentangle and freedraw control on the form. Thanks in advance ZAfar

    Mobile graphics tools tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups