Click here to Skip to main content
12,456,454 members (56,355 online)

.NET Framework

 
Questionncorrect work of Dataset deserialized from XML Pin
senglory13-Jan-13 2:50
membersenglory13-Jan-13 2:50 
QuestionIs there any way to generate a DB from an EDMX model without all the table names being pluralised? Pin
Brady Kelly12-Jan-13 17:19
memberBrady Kelly12-Jan-13 17:19 
Question\UIAutomationProvider damaged and can't read Pin
AlterAkarin10-Jan-13 15:07
memberAlterAkarin10-Jan-13 15:07 
AnswerRe: \UIAutomationProvider damaged and can't read Pin
Sandeep Mewara10-Jan-13 17:31
mvpSandeep Mewara10-Jan-13 17:31 
QuestionHow to Bind table data to chart? Pin
Deenuji9-Jan-13 21:46
groupDeenuji9-Jan-13 21:46 
Questionpop up after certain time limit Pin
fox079-Jan-13 15:15
memberfox079-Jan-13 15:15 
AnswerRe: pop up after certain time limit Pin
Sandeep Mewara9-Jan-13 17:47
mvpSandeep Mewara9-Jan-13 17:47 
JokeRe: pop up after certain time limit Pin
jibesh10-Jan-13 17:11
memberjibesh10-Jan-13 17:11 
QuestionDeleting data from Master and Detail tables using Entity Framework Pin
indian1439-Jan-13 8:48
memberindian1439-Jan-13 8:48 
AnswerRe: Deleting data from Master and Detail tables using Entity Framework Pin
Dave Kreskowiak10-Jan-13 2:03
mvpDave Kreskowiak10-Jan-13 2:03 
AnswerRe: Deleting data from Master and Detail tables using Entity Framework Pin
jschell10-Jan-13 13:57
memberjschell10-Jan-13 13:57 
Question[VB.NET 2008] How to put an image in a button Pin
steve_94966138-Jan-13 22:54
membersteve_94966138-Jan-13 22:54 
AnswerRe: [VB.NET 2008] How to put an image in a button Pin
Eddy Vluggen9-Jan-13 1:22
mvpEddy Vluggen9-Jan-13 1:22 
GeneralRe: [VB.NET 2008] How to put an image in a button Pin
steve_94966139-Jan-13 21:40
membersteve_94966139-Jan-13 21:40 
Well... I can't say that I have understood everything in the MSDN example but I managed to convert it to Visual Studio .NET 2008 and to make it work!!!!
Yes, it would be easier something like Button.BkImage("image.bmp") but ... it seems that the Compact Framework is missing many things that I need!!!

Once again, Thank you Eddy!!

I publish the code of MyImageButton class if it can help someone or anyone has any corrections to suggest.

Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Drawing.Imaging
 
Public Class MyImageButton
  Inherits Control
 
  'Private members
  Private image As Image
  Private FirstTime As Boolean = True
  'flag to indicate the pressed state
  Private bPushed As Boolean
  Private m_bmpOffscreen As Bitmap
 
  Sub New()
    bPushed = False
    'default minimal size
    Me.Size = New Size(21, 21)
  End Sub
 
  Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    Dim gxOff As Graphics       'Offscreen graphics
    Dim imgRect As Rectangle    'image rectangle
    Dim backBrush As Brush      'brush for filling a backcolor

    'If (m_bmpOffscreen.Equals(Nothing)) Then   'Bitmap for doublebuffering
    If (FirstTime) Then
      m_bmpOffscreen = New Bitmap(ClientSize.Width, ClientSize.Height)
    End If
 
    gxOff = Graphics.FromImage(m_bmpOffscreen)
 
    gxOff.Clear(Me.BackColor)
 
    If (Not bPushed) Then
      backBrush = New SolidBrush(Parent.BackColor)
    Else 'change the background when it's pressed
      backBrush = New SolidBrush(Color.LightGray)
    End If
 
    gxOff.FillRectangle(backBrush, Me.ClientRectangle)
 
    If (Not image.Equals(DBNull.Value)) Then
      'Center the image relativelly to the control
      Dim imageLeft As Int32 = (Me.Width - image.Width) / 2
      Dim imageTop As Int32 = (Me.Height - image.Height) / 2
 
      If (Not bPushed) Then
        imgRect = New Rectangle(imageLeft, imageTop, image.Width, image.Height)
      Else  'The button was pressed
        'Shift the image by one pixel
        imgRect = New Rectangle(imageLeft + 1, imageTop + 1, image.Width, image.Height)
      End If
 
      'Set transparent key
      Dim imageAttr As ImageAttributes = New ImageAttributes()
      imageAttr.SetColorKey(BackgroundImageColor(image), BackgroundImageColor(image))
 
      'Draw image
      gxOff.DrawImage(image, imgRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttr)
    End If
 
    If (bPushed) Then   'The button was pressed
      'Prepare rectangle
      Dim rc As Rectangle = Me.ClientRectangle
      rc.Width -= 1
      rc.Height -= 1
      'Draw rectangle
      gxOff.DrawRectangle(New Pen(Color.Black), rc)
    End If
 
    '/Draw from the memory bitmap
    e.Graphics.DrawImage(m_bmpOffscreen, 0, 0)
 
    MyBase.OnPaint(e)
  End Sub
 
  Private Function BackgroundImageColor(ByVal image As Image) As Color
    Dim bmp As Bitmap = New Bitmap(image)
    Return bmp.GetPixel(0, 0)
  End Function
 
  Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
    MyBase.OnPaintBackground(e)
  End Sub
 
  Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
    bPushed = True
    Me.Invalidate()
    MyBase.OnMouseDown(e)
  End Sub
 
  Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
    bPushed = False
    Me.Invalidate()
    MyBase.OnMouseUp(e)
  End Sub
 
  Public Property MImage() As Image
    Get
      Return image
    End Get
    Set(ByVal value As Image)
      image = value
    End Set
  End Property
 
End Class

GeneralRe: [VB.NET 2008] How to put an image in a button Pin
Eddy Vluggen9-Jan-13 22:57
mvpEddy Vluggen9-Jan-13 22:57 
GeneralRe: [VB.NET 2008] How to put an image in a button Pin
halabella13-Jan-13 4:17
memberhalabella13-Jan-13 4:17 
GeneralRe: [VB.NET 2008] How to put an image in a button Pin
steve_949661313-Jan-13 22:46
membersteve_949661313-Jan-13 22:46 
AnswerRe: [VB.NET 2008] How to put an image in a button Pin
s32750499-Jan-13 7:41
members32750499-Jan-13 7:41 
GeneralRe: [VB.NET 2008] How to put an image in a button Pin
steve_94966139-Jan-13 20:57
membersteve_94966139-Jan-13 20:57 
Question[VB.NET 2008] How to get single bytes from a multibyte value Pin
steve_94966138-Jan-13 22:12
membersteve_94966138-Jan-13 22:12 
AnswerRe: [VB.NET 2008] How to get single bytes from a multibyte value Pin
Eddy Vluggen9-Jan-13 1:29
mvpEddy Vluggen9-Jan-13 1:29 
GeneralRe: [VB.NET 2008] How to get single bytes from a multibyte value Pin
steve_94966139-Jan-13 3:15
membersteve_94966139-Jan-13 3:15 
GeneralRe: [VB.NET 2008] How to get single bytes from a multibyte value Pin
Eddy Vluggen9-Jan-13 4:31
mvpEddy Vluggen9-Jan-13 4:31 
AnswerRe: [VB.NET 2008] How to get single bytes from a multibyte value Pin
Alan N9-Jan-13 6:17
memberAlan N9-Jan-13 6:17 
GeneralRe: [VB.NET 2008] How to get single bytes from a multibyte value Pin
steve_94966139-Jan-13 20:35
membersteve_94966139-Jan-13 20:35 
QuestionDistributing Changes to a DLL that Other Assemblies Depend Upon Pin
Richard Andrew x648-Jan-13 2:24
memberRichard Andrew x648-Jan-13 2:24 
AnswerRe: Distributing Changes to a DLL that Other Assemblies Depend Upon Pin
Pete O'Hanlon8-Jan-13 2:31
protectorPete O'Hanlon8-Jan-13 2:31 
QuestionMethod Level security based on User logged in Pin
pankajbaunthiyal7-Jan-13 22:31
memberpankajbaunthiyal7-Jan-13 22:31 
AnswerRe: Method Level security based on User logged in Pin
Pete O'Hanlon7-Jan-13 23:44
protectorPete O'Hanlon7-Jan-13 23:44 
QuestionIOException was Unhandled Pin
jankevint7-Jan-13 15:39
memberjankevint7-Jan-13 15:39 
AnswerRe: IOException was Unhandled Pin
Richard MacCutchan7-Jan-13 22:24
mvpRichard MacCutchan7-Jan-13 22:24 
QuestionUser password encryption in .Net Framework 4.5 Pin
samijf6-Jan-13 21:11
membersamijf6-Jan-13 21:11 
AnswerRe: User password encryption in .Net Framework 4.5 Pin
Eddy Vluggen6-Jan-13 21:15
mvpEddy Vluggen6-Jan-13 21:15 
QuestionBuild Output Question Pin
Kevin Marois4-Jan-13 5:32
memberKevin Marois4-Jan-13 5:32 
AnswerRe: Build Output Question Pin
Richard MacCutchan4-Jan-13 6:13
mvpRichard MacCutchan4-Jan-13 6:13 
GeneralRe: Build Output Question Pin
Kevin Marois4-Jan-13 6:20
memberKevin Marois4-Jan-13 6:20 
GeneralRe: Build Output Question Pin
Richard MacCutchan4-Jan-13 6:58
mvpRichard MacCutchan4-Jan-13 6:58 
AnswerRe: Build Output Question Pin
Abhinav S4-Jan-13 6:20
mvpAbhinav S4-Jan-13 6:20 
AnswerRe: Build Output Question Pin
Sandeep Mewara4-Jan-13 6:28
mvpSandeep Mewara4-Jan-13 6:28 
QuestionNullable(Of Decimal) type variable is throwing exception "Nullable object must have a value." Pin
indian14327-Dec-12 18:14
memberindian14327-Dec-12 18:14 
AnswerRe: Nullable(Of Decimal) type variable is throwing exception "Nullable object must have a value." Pin
Eddy Vluggen28-Dec-12 8:41
memberEddy Vluggen28-Dec-12 8:41 
QuestionC# statement var indirect val Pin
codejuggler927-Dec-12 6:33
membercodejuggler927-Dec-12 6:33 
AnswerRe: C# statement var indirect val Pin
Dave Kreskowiak27-Dec-12 7:23
mvpDave Kreskowiak27-Dec-12 7:23 
GeneralRe: C# statement var indirect val Pin
codejuggler927-Dec-12 7:58
membercodejuggler927-Dec-12 7:58 
GeneralRe: C# statement var indirect val Pin
Dave Kreskowiak27-Dec-12 8:47
mvpDave Kreskowiak27-Dec-12 8:47 
QuestionNeeded: PGP source code Pin
Gregory.Gadow26-Dec-12 5:30
memberGregory.Gadow26-Dec-12 5:30 
AnswerRe: Needed: PGP source code Pin
Gregory.Gadow26-Dec-12 5:35
memberGregory.Gadow26-Dec-12 5:35 
QuestionPrivate byte is being increased continuously without any request Pin
nishantenet23-Dec-12 20:14
membernishantenet23-Dec-12 20:14 
AnswerRe: Private byte is being increased continuously without any request Pin
Dave Kreskowiak24-Dec-12 5:10
mvpDave Kreskowiak24-Dec-12 5:10 
AnswerRe: Private byte is being increased continuously without any request Pin
jschell24-Dec-12 7:57
memberjschell24-Dec-12 7:57 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 29 Aug 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid