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
H

hannesHTG

@hannesHTG
About
Posts
16
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Filling A Heart Shape
    H hannesHTG

    Hey guys! I have drawn a Heart, now I want to know how do we fill it with a color once drawn ¿ The reason I'm asking this, is because adding a GraphicsPath and Filling that path, didn't seem to work. I even declared a new Points array, and tried FillPolygon, but that didn't work either. This is what I've done with the Graphicspath

    Private startPoint As System.Drawing.Point
    Private endPoint As System.Drawing.Point
    Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
    startPoint.X = e.X
    startPoint.Y = e.Y
    End Sub
    Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
    endPoint.X = e.X
    endPoint.Y = e.Y
    Panel1.Invalidate()
    End Sub
    Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
    Dim hPath As New System.Drawing.Drawing2D.GraphicsPath

        Dim width As Integer = Math.Max(endPoint.X, startPoint.X) - Math.Min(endPoint.X, startPoint.X)
        Dim height As Integer = Math.Max(endPoint.Y, startPoint.Y) - Math.Min(endPoint.Y, startPoint.Y)
        Dim avg As Integer = CInt((width + height) / 2)
        If avg > 0 Then
            Dim topLeftCorner As Point = startPoint
            If endPoint.X < startPoint.X Then
                topLeftCorner.X = endPoint.X
            End If
            If endPoint.Y < startPoint.Y Then
                topLeftCorner.Y = endPoint.Y
            End If
    
            Dim radius As Integer = CInt(avg / 2)
            Dim topLeftSquare As New Rectangle(topLeftCorner.X, topLeftCorner.Y, radius, radius)
            Dim topRightSquare As New Rectangle(topLeftCorner.X + radius, topLeftCorner.Y, radius, radius)
            e.Graphics.DrawArc(Pens.Black, topLeftSquare, 180.0F, 180.0F)
            hPath.AddArc(topLeftSquare, 180.0F, 180.0F)
            e.Graphics.DrawArc(Pens.Black, topRightSquare, 180.0F, 180.0F)
            hPath.AddArc(topRightSquare, 180.0F, 180.0F)
            e.Graphics.DrawLine(Pens.Black, topLeftCorner.X, (topLeftCorner.Y + radius) - CInt((radius / 2)), topLeftCorner.X + radius, topLeftCorner.Y + avg)
            hPath.AddLine(topLeftCorner.X, (topLeftCorner.Y + radius) - CInt((radius / 2)), topLeftCorner.X + radius, topLeftCorner.Y + avg) 
           e.Graphics.DrawLine(Pens.Black, topLeftCorner.X + avg, (topLeftCorner.Y + radius) - CInt((r
    
    Visual Basic graphics data-structures

  • How to make glass effect image in .NET/WinXP
    H hannesHTG

    Put two Buttons on your form named btnBlendShapes and btnDrawImages respectively. Add a picturebox, named pic. Type this : Import this

    Imports System.Drawing.Imaging

    Then,

    Private Sub btnBlendShapes\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBlendShapes.Click
    
        'alpha numbers has to be between values 0 and 255. 
        'alpha 0 is fully transparent while alpha 255 is fully opaque
    
        'of course, change any of the alpha values below depending on which color you want to be more or
        'less transparent or opaque
    
        'the first apha value to be fully visible
        Dim alphaValue As Integer = 255
    
        'the second alpha value will have some transparency
        Dim alphaValue2 As Integer = 155
    
        'create 2 brushes. 1 brush with the first alpha value and the second brush using the 2nd alpha 
        'value
        Dim aBrush As SolidBrush = New SolidBrush(Color.FromArgb(alphaValue, Color.Fuchsia))
        Dim aBrush2 As SolidBrush = New SolidBrush(Color.FromArgb(alphaValue2, Color.Goldenrod))
    
        'draw 2 rectangles, 1 with the first brush and the other rectangle using the 2nd brush
        pic.CreateGraphics.FillRectangle(aBrush, 0, 0, 100, 100)
        pic.CreateGraphics.FillRectangle(aBrush2, 50, 50, 100, 100)
    
    End Sub
    
    Private Sub btnDrawImages\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDrawImages.Click
    
        'the 2 images to use for the alpha blend. you may have to change the image paths to where the
        'images are on your computer. 
        Dim imagePath As String = "AW-9TriplePan2.gif"
        Dim imagePath2 As String = "AW-9TriplePan2.gif"
    
        'create 2 new images with the above filenames
        Dim img As Image = Image.FromFile(imagePath)
        Dim img2 As Image = Image.FromFile(imagePath2)
    
        'create 2 new ojects to use the ImageAttrubute class and the ColorMatrix Class
        Dim i As ImageAttributes = New ImageAttributes
        Dim c As ColorMatrix = New ColorMatrix
    
        'draw both images onto the picturebox control. the first image will not have any changes made to
        'any of its attributes.
        pic.CreateGraphics.DrawImage(img, 0, 0, 200, 150)
    
        'with matrix33 you can adjust the images alpha value
        'values I think are to be between 0 and 1. Ex: .3, .25, or .5 ect....
        c.Matrix33 = 0.45
        i.SetColorMatrix(c)
    
        'this 2nd image will have its maxtrix3
    
    Visual Basic csharp com tutorial question

  • Code Convert vb6 to vb.net
    H hannesHTG

    Do you expect someone to type everything for you ¿ I'll just give advice. If I were you, I would look into ADO.NET, there are plenty samples on google. Retyping this in .NET, won't help much in any case, because .NET uses DataSets, DataAdapters etc. Just my 2 cents.. HTG CodeGuru Article Reviewer

    Visual Basic csharp tutorial question

  • API: CopyMemory
    H hannesHTG

    Have a look here : http://www.codeproject.com/vb/net/netcopymemorysample.asp[^] HTG codeguru.com Article Reviewer - > http://www.codeguru.com/forum/member.php?u=56188

    Visual Basic tutorial visual-studio json performance help

  • Resize a positioning
    H hannesHTG

    Have a look here : http://www.codeproject.com/vb/net/pflvb7.asp[^] HTG codeguru.com Article Reviewer - > http://www.codeguru.com/forum/member.php?u=56188

    Visual Basic c++ com tutorial

  • How to show a hidden window with a shortcut key
    H hannesHTG

    I would actually advise you to use the mclHotKey component, found here : http://www.codeproject.com/useritems/mclhotkey.asp[^] HTG CodeGuru.com Article Reviewer - > http://www.codeguru.com/forum/member.php?u=56188

    Visual Basic help tutorial question

  • DAO Access 2003 Connectivity Problem
    H hannesHTG

    IMHO, ADO would be the much more preferred method when using databases, fullstop. HTG

    Visual Basic help database

  • How to save any file in registy
    H hannesHTG

    The Registry is always the first place people look in when trying to "break" your program. To protect your programs, You could have a look at my article here : http://www.codeguru.com/vb/gen/vb_general/ideincludingvisualstudionet/article.php/c11817/[^] In there (the second page) I create a Trial Application ,storing a counter variable in a "system" file. Then, when the counter reaches a certain number, the person cannot continue. Hope that helps! H T G

    Visual Basic tutorial question

  • how to break/continue a for loop? [modified]
    H hannesHTG

    mimimimilaw wrote:

    "end for" can break a for loop.

    Hmm, isn't that Exit For ¿¿

    Visual Basic tutorial question

  • Disable Alt+Tab and windows Keys?
    H hannesHTG

    Yes It is possible. You will definitely need a System Wide Hook. Which version of VB are you using ¿ In VB 6, you will need to use the SystemParametersInfo API. You can implement it like this : Private Declare Function SystemParametersInfo _ Lib "user32" Alias "SystemParametersInfoA" _ (ByVal uAction As Long, ByVal uParam As Long, _ ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long 'API Function to disable keys Private Sub DisableCtrlAltDel(bDisabled As Boolean) ' Disables Control Alt Delete Breaking 'as well as Ctrl-Escape Dim X As Long X = SystemParametersInfo(97, bDisabled, CStr(1), 0) End Sub Then the call to the Above function : Private Sub Form_Load() Call DisableCtrlAltDel(True) 'disable the system keys End Sub 'Remember to Enable the system keys again, when the program exits, otherwise it will remain blocked. To re enable them, Just supply False to the DisableCtrlAltDel function. With VB.NET it is a bit more difficult. Luckily there is a component called mclhotkey, which will give you the functionality of a System Wide Hook. You can find that component here : http://www.codeproject.com/useritems/mclhotkey.asp?print=true[^] Hope that helps! H T G

    Visual Basic tutorial question

  • Change color
    H hannesHTG

    Hello Sinchan Nikam! This : Private Sub Grid_Click() Dim i as Integer With Grid .Row = .MouseRow For i = 1 to .cols-1 .Col = i .CellBackColor = RGB(255,0,0 ) 'red Next End Grid End Sub Will highlight an entire Flexgrid Row in Red. Note here Grid is the name of the FlexGrid. To change only one cell's color, I think it's obvious by now, that you need to use the .CellBackColor property Hope it helps! Always remember to play araound with example supplied - you'll be amazed at what you'll learn! H T G

    Visual Basic help

  • controlling other applications from VB.NET
    H hannesHTG

    Hello mrmathesw99! Well there is a couple of things to note here: To start various applications, you could use Process.Start. I have noticed however, that you mention you want to able to do many things with MS Word for example. In that case you could use Automation to do whatever you want with Word, Excel etc. So, what you need to do is to add a Reference To the Microsoft Word Object Library (Just click References in the Solution Explorer, and say Add Reference, Select the COM tab, and scroll until you find it) You can add references to all MS Office programs like that. Once that is done, you can create Word Apllication variables and manipulate Word through that. Amazing huh ¿ Here's a small sample : Dim SSWord As New Word.Application 'word application Dim SSWordDoc As Word.Document 'document object SSWord = DirectCast(GetObject(, "Word.Application"), Word.Application) SSWordDoc = SSWord.Documents.Add(, , 1, False) 'add a document SSWord.WindowState = SSWord.WindowState.wdWindowStateMaximize 'maximise word window SSWord.Activate() 'activate it SSWord.ActiveWindow.ActivePane.View.ShowAll = True 'show / hide symbols = true After using the Word objects, you need to set the Word Objects to Nothing And Quit it as well Hope it helps! H T G

    Visual Basic tutorial question csharp help

  • Splash Scree
    H hannesHTG

    It's a pleasure. How do you mean get a different picture ¿ Like, do you want it on the form ¿ If that's the case, you must select the BackgroundImage Property of the SplashScreen and browse for your picture you want to use. Just a note: You may not see the image in the design window on your form, only once you run it, you'll see the picture.

    Visual Basic help tutorial

  • HowTo copy entire folders with contents to a different folder?
    H hannesHTG

    From MSDN (http://msdn.microsoft.com) The following example determines whether a specified directory exists, deletes it if it does, and creates it if it does not. This example then moves the directory, creates a file in the directory, and counts the files in the directory. [Visual Basic] Imports System Imports System.IO Public Class Test Public Shared Sub Main() 'Specify the directories you want to manipulate. Dim path As String = "c:\MyDir" Dim target As String = "c:\TestDir" Try ' Determine whethers the directory exists. If Directory.Exists(path) = False Then ' Create the directory. Directory.CreateDirectory(path) End If If Directory.Exists(target) Then ' Delete the target to ensure it is not there. Directory.Delete(target, True) End If ' Move the directory. Directory.Move(path, target) 'Create a file in the directory. File.CreateText(target + "\myfile.txt") 'Count the files in the target. Console.WriteLine("The number of files in {0} is {1}", _ target, Directory.GetFiles(target).Length) Catch e As Exception Console.WriteLine("The process failed: {0}", e.ToString()) End Try End Sub

    Visual Basic help question

  • How to create a RichTextFile?
    H hannesHTG

    OK, fistly I don't know how to attach files here, if at all possible. To Save RTF Files, you could try : RichTextBox1.SaveFile(sfMW.FileName, RichTextBoxStreamType.RichText) For Bold, Italic and Underline, here's a Nice Sub you could use : Private Sub ToggleStyle(ByVal style As FontStyle) 'style option1 Me.rtbMW.SelectionFont = New Font(rtbMW.SelectionFont, rtbMW.SelectionFont.Style Xor style) End Sub Then, you could just call it like : ToggleStyle(FontStyle.Underline) 'underline ToggleStyle(FontStyle.Bold) 'Bold ToggleStyle(FontStyle.Italic) "Italic The benefit here, is that the selected Font will remain the same when Formatting is applied. For alignment : RichTexBox1.SelectionAlignment = HorizontalAlignment.Left RichTexBox1.SelectionAlignment = HorizontalAlignment.Center RichTexBox1.SelectionAlignment = HorizontalAlignment.Right Hope it helps! H T G

    Visual Basic question graphics tutorial

  • Splash Scree
    H hannesHTG

    Well, to have a splash screen, best practise in my opinion is to have a Sub Main procedure in a seperate Module. (You add a module to your project, by clicking Project - > Add Module...). You will also need to add another form, to be used as a Splash Screen. Once in your Module Type something similar to : Public Sub Main() Dim fSplash As New frmSplash fSplash.ShowDialog() Application.Run(New Form1) End Sub And This is the coding for the Spalsh Screen Form (frmSplash) Private Sub frmSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Interval = 3000 ' Approx. 3 Seconds. Timer1.Enabled = True End Sub Private Sub frmSplash_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click Me.Close() ' Close when the Splash Screen is Clicked End Sub Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Timer1.Enabled = False Me.Close() ' Close the Splash Screen after the time has elapsed End Sub That should give you quite a good idea on what to do. Now, the rest is up to you!:-D HTG

    Visual Basic help 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