|
Sorry, but i haven't got a clue what you are talking about, it doesn't make alot of sense.
Can you maybe reword it.....
|
|
|
|
|
I am Creating an Image by using Text. It is showing fine. But I am Trying to print this Image then the Text Quality is not Fine.
Code Is simple
g.DrawImage(this.Ibarcode , DrawRectangle)
If you can think then I Can.
|
|
|
|
|
It's hard to say without being able to see what the image looks like when it is printed. It could be some scaling problem or resolution problem.
You could perhaps try sending the image and the text to the printer separately instead of writing the text on the image?!?!
|
|
|
|
|
But my requirement is crating image by using text. then it's depend on user to print or Export in Image.
If you can think then I Can.
|
|
|
|
|
i am trying to convert c# to vb.net of this project!
.NET TWAIN image scanner[^]
i did it and it works on select source, and scan preview but not when i click scan then it throws me error "Arithmetic operation resulted in an overflow." in winmsga.x = CShort(pos)
much of code!
here is what i have done:
TwainLib[^]
Twain[^]
GDIPlusLib[^]
And my form[^]
only two things got errors when i converted code!
first one is:
<StructLayout(LayoutKind.Sequential, Pack:=4)> _
Friend Structure WINMSG
Public hwnd As IntPtr
Public message As Integer
Public wParam As IntPtr
Public lParam As IntPtr
Public time As Integer
Public x As Integer
Public y As Integer
End Structure
and
Private winmsg As WINMSG
so i just renamed it to winmsga maybe i did something wrong here?
and other error was:
Protected Function GetPixelInfo(ByVal bmpptr As IntPtr) As IntPtr
bmi = New BITMAPINFOHEADER()
Marshal.PtrToStructure(bmpptr, bmi)
bmprect.X = InlineAssignHelper(bmprect.Y, 0)
bmprect.Width = bmi.biWidth
bmprect.Height = bmi.biHeight
If bmi.biSizeImage = 0 Then
bmi.biSizeImage = ((((bmi.biWidth * bmi.biBitCount) + 31) And Not 31) >> 3) * bmi.biHeight
End If
Dim p As Integer = bmi.biClrUsed
If (p = 0) AndAlso (bmi.biBitCount <= 8) Then
p = 1 << bmi.biBitCount
End If
p = (p * 4) + bmi.biSize + CInt(bmpptr)
Return New (p,IntPtr) 'so i made like this (Return New System.IntPtr(p))
End Function
can annyone help?
thanks!
|
|
|
|
|
ahhhh i hate this! :P
i made it work!
thanks anyway
|
|
|
|
|
You should be chuffed you got it working. It also shows the guys on CP that you are willing to work at it yourself, and so will be much more willing to help in the future. Congrats
|
|
|
|
|
thanks! :P
btw i forgot to post a solution!
the only thing why it wasnt working was this part:
winmsga.hwnd = m.HWnd
winmsga.message = m.Msg
winmsga.wParam = m.WParam
winmsga.lParam = m.LParam
winmsga.time = GetMessageTime()
winmsga.x = pos 'just removed CShort()
winmsga.y = (pos >> 16) 'same here
|
|
|
|
|
Please tell me there is a better way to make a pacman like shape move across my form...
Public Class Form1
Dim formSurface As Graphics = Me.CreateGraphics
Dim intLoop As Integer = 0
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
tmrMove.Enabled = True
End Sub
Private Sub tmrMove_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrMove.Tick
formSurface.Clear(Color.Black)
Select Case intLoop
Case 0
formSurface.DrawImage(My.Resources.pacmanopen, 10, 75)
Case 1
formSurface.DrawImage(My.Resources.pacmanopen, 11, 75)
Case 2
formSurface.DrawImage(My.Resources.pacmanopen, 12, 75)
Case 3
formSurface.DrawImage(My.Resources.pacmanopen, 13, 75)
Case 4
formSurface.DrawImage(My.Resources.pacmanopen, 14, 75)
Case 5
formSurface.DrawImage(My.Resources.pacmanopen, 15, 75)
End Select
intLoop += 1
End Sub
End Class
Could I possibly do something like...
Case 0 to 100
formSurface.DrawImage(My.Resources.pacmanopen, intX, 75)
and then add 1 to intX each time? I'm open to any ideas...
|
|
|
|
|
yes, you should keep your shape's location in some variable(s). And paint only in the Paint handler.
This article[^] will give you the principles and an example; it is a C# example, but that only constitutes a different syntax, it does not affect the principles.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Alright thanks I'll go look at it right now. I knew there was an easier way..
|
|
|
|
|
The whole approach of using winforms is doomed to failure. You should use XNA, or perhaps WPF, something DirectX based.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Sadly it's for a school project and I have to do it my teachers way...but I'll defiantely look into that stuff for future programs that I do on my own time.
|
|
|
|
|
|
hello!
i wanna add a context menu as "Close CD Tray" in CD drive's context menu.
but i can't only CD drive's context menu.
my context menu is working on all drives as C:, D:, E: so on.
i wanna show it just only on CD drive's context menu.
could u help me pls?
i'll thz u very much....
|
|
|
|
|
|
You will have to check which drive is selected before you create the context menu.
Then when the user clicks the cd drive you show your menu, otherwise you just show the default one.
My advice is free, and you may get what you paid for.
|
|
|
|
|
If you work with a 32bit Windows take loo at this[^]
On a 64b windows it won't work.
|
|
|
|
|
I am having a major problem with a date. (One of the day, month, year kind!) The problem is conversion from a string to a date.
Either I am in perpetual brain fart mode or something odd is going on.
This is a data line being imported
nc,71401286,0,"Thursday, May 20, 2010 01:00:54 UTC",38.8335,-122.8778,1.0,1.80,12,"Northern California"
This is the code that gets the date part and changes it into "dd/MM/yyyy HH:mm:ss"
astrData = strLine.Split(",")
sbldValues = New StringBuilder(strCMD & astrData(QUAKE_ID) & QUOTE & COMMA)
strPartLine = astrData(QUAKE_ID) & COMMA
'Next is the networkID
sbldValues.Append(QUOTE & astrData(NET_SOURCE) & QUOTE & COMMA)
strPartLine &= astrData(NET_SOURCE) & COMMA
'Next is the version which is also a string
sbldValues.Append(QUOTE & astrData(VERSION_NO) & QUOTE & COMMA)
strPartLine &= astrData(VERSION_NO) & COMMA
strEventDate = CDate(Trim(astrData(DATE_PART_1) _
& astrData(DATE_PART_2).Substring(0, astrData(DATE_PART_2).Length - 4))).ToString("dd/MM/yyyy HH:mm:ss")
sbldValues.Append("CONVERT(datetime,'" & strEventDate & "',103)" & COMMA)
If bFileStartDone = False Then
m_strFileStartDate = strEventDate
m_strFileEndDate = strEventDate
bFileStartDone = True
Else
m_strFileEndDate = strEventDate
End If
strPartLine &= strEventDate & COMMA
(COMMA and QUOTE are just constants as I find these easier to read and debug.)
Later on in the code there is this section:
strDate1 = Format(drowData("Date_Time"), "dd/MM/yyyy HH:mm:ss")
strDate2 = astrValues(EVENT_DATE) 'This is already in the right format
If strDate1 <> strDate2 Then
bDifferences = True
intDateDiff = DateDiff(DateInterval.Minute, drowData("Date_Time"), CDate(strDate2))
If intDateDiff > intTimeVariance Then
The second it hits the CDate(strDate2) I get the exception below
System.InvalidCastException was unhandled
Message="Conversion from string "19/05/2010 02:12:54" to type 'Date' is not valid."
Source="Microsoft.VisualBasic"
StackTrace:
at Microsoft.VisualBasic.CompilerServices.Conversions.ToDate(String Value)
My problem is that this runs in a test bed version, and in a compiled exe as part of a windows forms project, but NOT when it is running in a service.
The code is identical - literally - as the class in which this resides is designed to work with the service or the windows program, thus the code file is just copied between the two.
The service is running under 'local system' and I am suspecting the this may have something to do with it, but what? Why should a date conversion behave differently? Have I missed something somewhere?
Edited for a speeling era
|
|
|
|
|
Hi,
my best guess is this: CDate(strDate2) is attempting to parse the string and turn it into a DateTime; as no format is specified, it relies on the regional setting in effect, which one normally sets through the Regional Settings control panel, although it can be overridden by setting the thread's CultureInfo. I assume you did the former; now running as a service, it is not your regional setting that is in effect, it probably is some system default, which may well be an American-style one.
The clean fix is by not using CDate; I'd use DateTime.TryParse or TryParseExact with an explicit format right there. When not communicating with the user, you should always enforce the format your app wants. That is defensive programming: simple and robust.
FWIW: I find your code rather unreadable. I don't like the identifier names much, and all those constants (without their value) obscure the matter even more. So I can not judge the correctness of what was shown.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
All those Caps are irritating.
And the names rather confusing.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Please see my response to Luc (eyesight), and they please tell me pray how you name and display constants so as to differentiate then from variables? I am always willing to learn.
A la Microsoft
FILE_NOTIFY_CHANGE_FILE_NAME
FILE_NOTIFY_CHANGE_DIR_NAME
FILE_NOTIFY_CHANGE_ATTRIBUTES
FILE_NOTIFY_CHANGE_SIZE
FILE_NOTIFY_CHANGE_LAST_WRITE
FILE_NOTIFY_CHANGE_SECURITY
If that is old fashioned and not used any longer than please enlighten me as to the modern style.
|
|
|
|
|
No Problem with the constants, and now I have read the other response I see the QUOTE and COMMA reasoning.
Fair Dos, but it does look untidy, but I can appreciate why you choose to do it. Those Old Eyes aren't what they used to be!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Thanks. No indeed they are not.
|
|
|
|
|
There are larger readability issues; I hope my reply to the OP will hit the nail on the head.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|