|
There is no need for a database, a DataTable, or anything pre-existing. You want some class, with at least two public properties, and a collection of instances of said class. The collection (e.g. a List) becomes your DataSource; the one string property your DisplayMember, and the other property your ValueMember; so you need to provide the names of those properties in the "DisplayMember" and "ValueMember" properties of your Control (e.g. ComboBox).
|
|
|
|
|
This work for me thanks
Public Class WatermarColors
Private mWatermarkColor As iTextSharp.text.BaseColor
Private mWatermarkBGName As String
Public Sub New(ByVal name As String, ByVal code As iTextSharp.text.BaseColor)
mWatermarkBGName = name
mWatermarkColor = code
End Sub
Public Property WatermarkBGNames() As String
Get
Return mWatermarkBGName
End Get
Set(ByVal value As String)
mWatermarkBGName = value
End Set
End Property
Public Property WatermarkColors() As iTextSharp.text.BaseColor
Get
Return mWatermarkColor
End Get
Set(ByVal value As iTextSharp.text.BaseColor)
mWatermarkColor = value
End Set
End Property
Public Overrides Function ToString() As String
Return mWatermarkBGName
End Function
End Class
color1 = New BaseColor() {iTextSharp.text.BaseColor.BLACK, iTextSharp.text.BaseColor.BLUE, iTextSharp.text.BaseColor.CYAN, iTextSharp.text.BaseColor.DARK_GRAY, iTextSharp.text.BaseColor.GRAY, iTextSharp.text.BaseColor.GREEN, iTextSharp.text.BaseColor.LIGHT_GRAY, iTextSharp.text.BaseColor.MAGENTA, iTextSharp.text.BaseColor.ORANGE, iTextSharp.text.BaseColor.PINK, iTextSharp.text.BaseColor.RED, iTextSharp.text.BaseColor.WHITE, iTextSharp.text.BaseColor.YELLOW}
color2 = New String() {"Черен", "Син", "Циан", "Тъмно сиво", "Сиво", "Зелено", "Светло сиво", "Магента", "Оранжево", "Розово", "Червено", "Бяло", "Жълто"}
For i = 0 To color1.Length - 1
CboWatermarkColor.Items.Add(New WatermarColors(color2(i), color1(i)))
Next
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If File.Exists(TextBox1.Text) Then
File.Delete(TextBox1.Text)
Dim bf As BaseFont = BaseFont.CreateFont(k & "\\arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)
Dim bc As BaseColor
Dim WatermarkSelectColor As WatermarColors
WatermarkSelectColor = CType(CboWatermarkColor.SelectedItem, WatermarColors)
bc = WatermarkSelectColor.WatermarkColors
AddWatermarkText(TextBox3.Text, TextBox1.Text, TextBox2.Text, bf, NumericUpDown1.Value, bc, 50.0F, NumericUpDown2.Value)
Else
Dim bf As BaseFont = BaseFont.CreateFont(k & "\\arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)
Dim bc As BaseColor
bc = color1(CboWatermarkColor.SelectedIndex)
AddWatermarkText(TextBox3.Text, TextBox1.Text, TextBox2.Text, bf, NumericUpDown1.Value, bc, 50.0F, NumericUpDown2.Value)
End If
|
|
|
|
|
Dim lst as New List(Of WatermarkColor)
lst.Add(New WatermarkColor(watermarkBGName,watermarkColor)
cboWatermarkColors.DataSource = lst
cboWatermarkColors.DisplayMember = "WatermarkBGName"
cboWatermarkColors.ValueMember = "WatermarkColor"
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
I need some help here. First I have never replease a VB app before, so I'm new to this.
Second details. The app is developed in Visual Studio VB 2010 under XP Pro SP3. It's to be run in Win PE for Windows 7.
Now I know I'll have to have the .NET Framework installed on the Win PE disk, but can I just install the latest version or do I have to have all the versions available on the development machine?
How do I release the application into the appropiate Win PE build area?
The application uses the system.management namespace, do I have to manually copy the appropiate dll to build area or will be automatically there as part of .NET Framework install.
Thank you in advance
|
|
|
|
|
Since the app is built using VS 2010, you'll need (atleast) .NET Framework 4.0 installed on the target computer.
Starting .NET 4.0, Applications that are built to target '.NET 4.0 Client Profile' automatically install a trimmed version of .NET Framework 4.0 if it does not find .NET Framework 4.0 already installed.
|
|
|
|
|
.NET is AFAIK[^] not officially supported in the PE-environment.
Bastard Programmer from Hell
|
|
|
|
|
Right answer unfortunately
It looks like I'll have to have a rethink
|
|
|
|
|
C will be good, Delphi would be supported, VB6 would also be supported. You could also take a look at the CrossNet Compiler[^] if you "must" work in the .NET environment. Another alternative might be incorporating the Mono-runtime from a C application.
The Preinstall Environment isn't meant to be used as a lightweight OS, and it'll be lacking all kind of stuff that you're grown used to in Windows. If you're looking for a small OS with .NET support, consider Knoppix with Mono.
Hope this helps a bit more than the previous answer
Bastard Programmer from Hell
|
|
|
|
|
|
This is not good form. Post your question here, as I fear you will be down voted.
For what it is worth, you can use ADODBConnection to JET engine and write queries against your Worksheets.
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
OK I looked, now what?
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
This event fires twice when the right or left arrow is clicked, but only some times with no rhyme or reason.
Protected Overrides Function ProcessKeyPreview(ByRef m As System.Windows.Forms.Message) As Boolean
Select Case m.WParam.ToInt32()
Case 37
Me.DtRecordInfoBindingSource.MovePrevious()
Return True
Case 39
Me.DtRecordInfoBindingSource.MoveNext()
Return True
End Select
Return False
End Function
I read elsewhere that some times this particular thing occurs when an event is double-subscribed, but I don't believe that is the case here. Anyone have a thought on why this might be double firing?
Cheers, --EA
|
|
|
|
|
I've never overriden ProcessKeyPreview and don't really know the specifics of its working but the first thing I think of would be if its called on each key make and break (key down and up).
|
|
|
|
|
That helped me to isolate the issue, it seems to be firing on down and up. I was able to fix it with this:
Protected Overrides Function ProcessKeyPreview(ByRef m As System.Windows.Forms.Message) As Boolean
Const WM_KEYDOWN As Integer = 256
If m.Msg = WM_KEYDOWN Then
Select Case m.WParam.ToInt32()
Case 37
Me.DtRecordInfoBindingSource.MovePrevious()
Return True
Case 39
Me.DtRecordInfoBindingSource.MoveNext()
Return True
End Select
End If
Return False
End Function
|
|
|
|
|
Receiving a message on both key up and key down is desired behaviour
With key-repeat, when holding down a key, you'll get lots of WM_KEYDOWN messages before receiving a WM_KEYUP.
|
|
|
|
|
I am Kartheeswaran
I am working under the field of Medical Image reconstruction
SUB : The projection optimization using genetic algorithm and produce the high psnr value reconstruction image
The genetic algorithm used for Minimize the projection and maximize the psnr value of reconstructed quality of image
please give Matlab code for the above genetic algorithm problem in image reconstruction
The test image may be a 2-D phantom or 3-D phantom
please any one experts help me immediately .............
I belive so much of the matlab experts are in world wide
I expect the response from this world anyone
plz reply me .......... plz reply me .......... plz reply me ..........
|
|
|
|
|
If you want help with Matlab, you should probably start here[^].
The best things in life are not things.
|
|
|
|
|
What does this have to do with VB/VB.NET??
|
|
|
|
|
I have this RTB on my form which display/have text (some 50 words and some 400 words), when I resize the form, it cuts the RTB and some text disappear, I need a way to make my RTB resize automatically as the form resize, is there anyway i can do this ?
|
|
|
|
|
Did you notice teh Anchor property of the RTB?? It anchors the edges of the control to the edges of the parent container it's in, probably your form.
|
|
|
|
|
Well thanks, but thats not exactly my problem. I have this RTB to display text, when running the program the display is fine with the default form size and RTB size, but when I resize the form the text inside the RTB cannot change proportionally instead it cuts the RTB and the text inside. I want automatic word wrapping feature for the text in RTB as the form get resize (like maximize and minimizing the form).
|
|
|
|
|
You're not explaining your problem very well.
Are you saying that you want the font the text in the RTB is displayed in to resize itself so that it looks the same and fills the same area of the RTB the form is resized??
|
|
|
|
|
Yes something like that, i want the text inside the RTB to adjust automatically as the form get resize not the font size. (this form resize means manual resizing by mouse), i.e. i want the word inside the RTB to wrap automatically (like word wraping features)
|
|
|
|
|
The RTB won't do that. You'd have to write your own version of the control and it won't be easy.
The problem is that as your custom drawing your RTB, you have to measure a string in a font size and see how big the resulting bitmap image would be. If it's not big enough, or small enough, you have to create a new Font object to test and call MeasureString again, until you achieve the fit you want.
This is complicated by the fact that you still want WordWrap to work...
Oh, and the RTB doesn't consider one line of text on screen a single line. A single line of text wraps and keeps wrapping until a line break is hit. So, how many lines of text on screen are in that string?? See the problem??
|
|
|
|
|
I am writing a simple mouse/keyboard global logger. This part is the Mouse event class that uses a LowLevelMouseHook to drive events. I am getting a CallbackOnCollectedDelegate was detected run-time error that I cannot figure out. I am having trouble even trying to determine where the error is happening.
Any suggestions or clues would be welcomed.
Namespace nsMouseHook
Public Delegate Function LowLevelMouseHookProc(ByVal nCode As Integer, ByVal wParam As UInteger, ByRef lParam As MSLLHOOKSTRUCT) As Integer
Public Structure MSLLHOOKSTRUCT
Public pt As API_POINT
Public mouseData As UInteger
Public flags As UInteger
Public time As UInteger
Public dwExtraInfo As IntPtr
End Structure
Public Structure API_POINT
Public x As Integer
Public y As Integer
End Structure
End Namespace
Public Class GlobalMouseHook
Implements IDisposable
Private hhook As IntPtr = IntPtr.Zero
Private disposedValue As Boolean = False ' To detect redundant calls
Public Event MouseDown As MouseEventHandler
Public Event MouseUp As MouseEventHandler
Public Event MouseMove As MouseEventHandler
Private Const WM_MOUSEMOVE As UInteger = &H200
Private Const WM_LBUTTONDOWN As UInteger = &H201
Private Const WM_LBUTTONUP As UInteger = &H202
Private Const WM_MBUTTONDOWN As UInteger = &H207
Private Const WM_MBUTTONUP As UInteger = &H208
Private Const WM_RBUTTONDOWN As UInteger = &H204
Private Const WM_RBUTTONUP As UInteger = &H205
Private Const WH_MOUSE_LL As Integer = 14
Private Declare Auto Function LoadLibrary Lib "kernel32" (ByVal lpFileName As String) As IntPtr
Private Declare Auto Function SetWindowsHookEx Lib "user32.dll" (ByVal idHook As Integer, ByVal lpfn As nsMouseHook.LowLevelMouseHookProc, ByVal hInstance As IntPtr, ByVal dwThreadId As UInteger) As IntPtr
Private Declare Function CallNextHookEx Lib "user32" (ByVal hhk As IntPtr, ByVal nCode As Integer, ByVal wParam As UInteger, ByRef lParam As nsMouseHook.MSLLHOOKSTRUCT) As Integer
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hhk As IntPtr) As Boolean
Public Sub New()
MouseHook()
GC.KeepAlive(Me)
End Sub
Private Sub MouseHook()
Dim hInstance As IntPtr = LoadLibrary("User32")
hhook = SetWindowsHookEx(WH_MOUSE_LL, AddressOf Me.MouseHookProc, hInstance, 0) ' AddressOf Me.HookProc,
End Sub
Private Sub MouseUnhook()
UnhookWindowsHookEx(hhook)
End Sub
Private Function MouseHookProc(ByVal nCode As Integer, ByVal wParam As UInteger, ByRef lParam As nsMouseHook.MSLLHOOKSTRUCT) As Integer
If nCode >= 0 Then
Select Case wParam
Case WM_LBUTTONDOWN
RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Left, 0, lParam.pt.x, lParam.pt.y, 0))
Case WM_RBUTTONDOWN
RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Right, 0, lParam.pt.x, lParam.pt.y, 0))
Case WM_MBUTTONDOWN
RaiseEvent MouseDown(Me, New MouseEventArgs(MouseButtons.Middle, 0, lParam.pt.x, lParam.pt.y, 0))
Case WM_LBUTTONUP
RaiseEvent MouseUp(Me, New MouseEventArgs(MouseButtons.Left, 0, lParam.pt.x, lParam.pt.y, 0))
Case WM_RBUTTONUP
RaiseEvent MouseUp(Me, New MouseEventArgs(MouseButtons.Right, 0, lParam.pt.x, lParam.pt.y, 0))
Case WM_MBUTTONUP
RaiseEvent MouseUp(Me, New MouseEventArgs(MouseButtons.Middle, 0, lParam.pt.x, lParam.pt.y, 0))
Case WM_MOUSEMOVE
RaiseEvent MouseMove(Me, New MouseEventArgs(WM_MOUSEMOVE, 0, lParam.pt.x, lParam.pt.y, 0))
Case Else
Console.WriteLine(wParam)
End Select
End If
Return CallNextHookEx(hhook, nCode, wParam, lParam)
End Function
' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: free other state (managed objects).
End If
MouseUnhook()
End If
Me.disposedValue = True
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
GC.SuppressFinalize(Me)
Dispose(True)
End Sub
End Class
Option Strict On
Option Explicit On
Option Infer Off
Imports System.Runtime.InteropServices
Imports System.IO
Public Class MainForm
Private intTimeOfLastEvent As Double = 0 ' Time of the last recorded event
Private intTimeRecording As Double = 0 ' Recording time elaspesd
Private intTimePlaying As Double = 0 ' Timer value for playback
Private WithEvents gmh As GlobalMouseHook
Public Sub New()
InitializeComponent()
End Sub
' Form overrides dispose to clean up the component list.
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Catch ex As Exception
Finally
MyBase.Dispose(disposing)
End Try
End Sub
Private Sub MainForm_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
If gmh IsNot Nothing Then gmh.Dispose()
End Sub
''' <summary>Called when recording is started</summary>
''' <remarks></remarks>
Private Sub startRecording()
butPlay.Enabled = False
tRecordTime.Start()
bolRecording = True
gmh = New GlobalMouseHook
End Sub
''' <summary>Called when recording is stopped</summary>
''' <remarks></remarks>
Private Sub stopRecording()
tRecordTime.Stop()
bolRecording = False
gmh.Dispose()
End Sub
Private Sub gmh_MouseClickDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gmh.MouseDown
lbLog.Items.Add(String.Format("Time:{0}", (intTimeRecording - intTimeOfLastEvent) / 1000))
lbLog.Items.Add(String.Format("Mouse Click Down:{0}" & vbTab & "X:{1}" & vbTab & "Y:{2}", e.Button, e.X, e.Y))
lbLog.SelectedIndex = lbLog.Items.Count - 1
intTimeOfLastEvent = intTimeRecording
End Sub
Private Sub gmh_MouseClickUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gmh.MouseUp
lbLog.Items.Add(String.Format("Time:{0}", (intTimeRecording - intTimeOfLastEvent) / 1000))
lbLog.Items.Add(String.Format("Mouse Click Up:{0}" & vbTab & "X:{1}" & vbTab & "Y:{2}", e.Button, e.X, e.Y))
intTimeOfLastEvent = intTimeRecording
lbLog.SelectedIndex = lbLog.Items.Count - 1
End Sub
Private Sub gmh_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gmh.MouseMove
lblMousePosition.Text = e.X & ", " & e.Y
lbLog.Items.Add("Move")
lbLog.SelectedIndex = lbLog.Items.Count - 1
End Sub
Private Sub butRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butRecord.Click
If butRecord.Text = "Record" Then
butRecord.Text = "Stop Recording"
startRecording()
ElseIf butRecord.Text = "Stop Recording" Then
butRecord.Text = "Record"
stopRecording()
End If
End Sub
Private Sub tRunTime_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tRecordTime.Tick
intTimeRecording += tRecordTime.Interval
lblRecordTime.Text = (intTimeRecording / 1000).ToString("###.##")
lblRecordTime.Text = String.Format("Record Time:{0:###.##}", (intTimeRecording / 1000))
End Sub
Private Sub butExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butExit.Click, ExitToolStripMenuItem.Click
Me.Close()
End Sub
End Class
|
|
|
|
|