Click here to Skip to main content
16,016,249 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: call center Pin
Dave Kreskowiak4-Jul-05 3:31
mveDave Kreskowiak4-Jul-05 3:31 
Generalrecttracker Pin
boy2123-Jul-05 16:35
boy2123-Jul-05 16:35 
GeneralRe: recttracker Pin
Christian Graus3-Jul-05 17:55
protectorChristian Graus3-Jul-05 17:55 
GeneralRe: recttracker Pin
Dave Kreskowiak4-Jul-05 3:28
mveDave Kreskowiak4-Jul-05 3:28 
QuestionHow to give a user control a opacity percent property??? Pin
Off1193-Jul-05 12:53
Off1193-Jul-05 12:53 
AnswerRe: How to give a user control a opacity percent property??? Pin
Off1194-Jul-05 6:29
Off1194-Jul-05 6:29 
GeneralRe: How to give a user control a opacity percent property??? Pin
Dave Kreskowiak4-Jul-05 13:42
mveDave Kreskowiak4-Jul-05 13:42 
GeneralRe: How to give a user control a opacity percent property??? Pin
[Marc]4-Jul-05 17:22
[Marc]4-Jul-05 17:22 
I don't think it's that difficult...
Lets say your old painting code looks like this:
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    MyBase.OnPaint(e)

    'Painting starts here...
    e.Graphics.FillEllipse(Brushes.CadetBlue, Me.ClientRectangle)
    'Painting done

End Sub

Then your new paint code can look like this:
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    MyBase.OnPaint(e)

    'Graphics of a bitmap to paint on instead of e.Graphics
    Dim bmp As New Bitmap(Me.Width, Me.Height, Imaging.PixelFormat.Format32bppPArgb)
    Dim g As Graphics = Graphics.FromImage(bmp)

    'Painting starts here...
    'Use g instead of e.GRaphics
    g.FillEllipse(Brushes.CadetBlue, Me.ClientRectangle)
    ''Painting done

    'Get rid of bmp graphics
    g.Dispose()

    'Assuming that Opacity is a Single from 0 to 1
    If Me.Opacity = 1 Then
         'Opacity = 100%, so just draw bmp
         e.Graphics.DrawImageUnscaled(bmp, 0, 0)
    Else 'Opacity less than 100%
        'Attributes for the bmp
        Dim attrib As New Imaging.ImageAttributes
        'ColorMatrix for the transparency of the bmp
        Dim colorm As New Imaging.ColorMatrix
        'Set the Opacity of the colormatrix
        colorm.Matrix33 = Opacity
        'Set the colormatrix of the attributes
        attrib.SetColorMatrix(colorm)

        'Draw the bmp on e.Graphics with the right opacity
        e.Graphics.DrawImage(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, attrib)

        'Get rid of the attributes
        attrib.Dispose()
    End If

    'Get rid of the bitmap
    bmp.Dispose
End Sub

Hope this helps Cool | :cool:
GeneralRe: How to give a user control a opacity percent property??? Pin
Dave Kreskowiak5-Jul-05 1:06
mveDave Kreskowiak5-Jul-05 1:06 
AnswerRe: How to give a user control a opacity percent property??? Pin
Off1195-Jul-05 6:23
Off1195-Jul-05 6:23 
GeneralRe: How to give a user control a opacity percent property??? Pin
[Marc]5-Jul-05 9:02
[Marc]5-Jul-05 9:02 
Generallock dextop using vb.net app Pin
paragraut3-Jul-05 9:49
paragraut3-Jul-05 9:49 
GeneralRe: lock dextop using vb.net app Pin
Christian Graus3-Jul-05 11:25
protectorChristian Graus3-Jul-05 11:25 
GeneralRe: lock dextop using vb.net app Pin
paragraut3-Jul-05 20:53
paragraut3-Jul-05 20:53 
GeneralRe: lock dextop using vb.net app Pin
Dave Kreskowiak4-Jul-05 3:22
mveDave Kreskowiak4-Jul-05 3:22 
GeneralRe: lock dextop using vb.net app Pin
paragraut4-Jul-05 8:23
paragraut4-Jul-05 8:23 
GeneralRe: lock dextop using vb.net app Pin
Christian Graus4-Jul-05 13:12
protectorChristian Graus4-Jul-05 13:12 
GeneralGIVING ANIMATION TO A FORM Pin
LAYEEQ AHMED KHAN3-Jul-05 9:32
LAYEEQ AHMED KHAN3-Jul-05 9:32 
GeneralRe: GIVING ANIMATION TO A FORM Pin
Christian Graus3-Jul-05 11:58
protectorChristian Graus3-Jul-05 11:58 
GeneralRe: GIVING ANIMATION TO A FORM Pin
Yulianto.3-Jul-05 16:51
Yulianto.3-Jul-05 16:51 
QuestionHow to print tiff file.... Pin
KRathor3-Jul-05 5:28
KRathor3-Jul-05 5:28 
GeneralSystemParametersInfo Pin
rlx5003-Jul-05 2:33
rlx5003-Jul-05 2:33 
GeneralRe: SystemParametersInfo Pin
Anonymous3-Jul-05 15:07
Anonymous3-Jul-05 15:07 
GeneralRe: SystemParametersInfo Pin
rlx5004-Jul-05 9:32
rlx5004-Jul-05 9:32 
GeneralRe: SystemParametersInfo Pin
Anonymous6-Jul-05 18:33
Anonymous6-Jul-05 18:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.