|
I have windows form application of employee salary management system. It has methods of login, AddnewRecord, Edit, ViewAll, Search and few more. can any one tell me how to apply equivalence partitioning method "category partitioning" ?
|
|
|
|
|
Due to my current work, I need to display a plain image in a WinForms control (based on a map, but not from Bing / Google / other APIs) such as a JPEG or PNG in which I need to define/show points of interest. It will also be good to allow showing/hiding these layers of information (e.g. basic plain JPEG map in one layer, points of interest in another layer and dangerous points in a third layer) based on the user's criteria independently as well as allow clicking on these points.
In the past, I have performed such a similar work on a web environment by using OpenLayers, which provides a functionality (I think via a plugin/trunk) to work with plain images instead of retrieving the data from a devoted server.
But now, I'm a bit lost. I have been taking a look at SharpMap + GdalRasterLayer, but I have not been able to find any good tutorial to perform something similar to what I pretend. Maybe too much complicated for what I pretend, and of course not the target of these gis-based libraries.
I hope someone can help me;
Thanks in advance.
|
|
|
|
|
I don't know of any 3rd. party library for this specific purpose, but, I think a lot of what you may do will depend on the nature of the whatever-objects you need to overlay on top of the map to define your "points of interest." Can you describe those objects further: are they icons ? graphic files ? Do they function as Controls, meaning: if you hover over them, click on them, etc., some action is performed ?
And, the solution will also depend on what facilities you provide for viewing the underlying map: will the user be able to pan, zoom ? I would guess you'd implement that which requires re-calculation of which overlay objects will appear, and where they will appear.
You can certainly create transparent Forms in WinForms and carefully position them over some base Form (or Panel, or other ContainerControl, in a base Form) that contains you map as a BackGroundImage. Those transparent Forms can, of course, have objects in them that are not transparent.
If you want to look further into doing this yourself in C#, then please post a more complete specification here.
good luck, Bill
"What Turing gave us for the first time (and without Turing you just couldn't do any of this) is he gave us a way of thinking about and taking seriously and thinking in a disciplined way about phenomena that have, as I like to say, trillions of moving parts.
Until the late 20th century, nobody knew how to take seriously a machine with a trillion moving parts. It's just mind-boggling." Daniel C. Dennett
|
|
|
|
|

Long time ago, I made an application near to your requirements. The main design was:
- An abstract base Shape class having some methods like a void Render(Graphics) and a method for hit testing,bool HitTest(Point).
- Shape classes for custom shapes that are needed on each layer; shapes like point, line, icon, path, etc that inherit from abstract Shape class.
- Each derived shape has its own properties and overrides Render method and renders itself on the graphics object; also overrides HitTest method to check if it contains a point.
- A Layer class that contains a List of Shapes and a void Render(Graphics) and calls render method of each shape. (You can restrict each layer to specific types of shapes, you can implement z-order management for shapes, etc)
- A Map class having and Image and a List<Shapes> and Save and Load to/from file. (You can handle Active layer and active shape easily.)
- A custom control that has a Map property. This control is responsible for rendering layers and handling user mouse interaction and update layers. This control overrides OnPaint and mouse events and enables double buffering.
Hope this idea helps you.
|
|
|
|
|
I recently came across a link to Nokia’s new developers program which goes by the name of DVLUP.. Have anybody else heard of it?
It is pretty exciting reward program as one has to complete challenges and earn cool badges nd reward points… Much more like an interesting game nd we can share it on our fb profiles too… Check it out: http://www.sercononline.com/track.asp?token=330
|
|
|
|
|
This reads and feels like Spam.
Anshu Kapoor wrote: It is pretty exciting reward program Woooah! Is it exciting?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yes i think so.. Why sir?? what u think abt this?
|
|
|
|
|
Anshu Kapoor wrote: what u think abt this? Textspeak, buzzwords, and posted in a forum where one expects questions.
I think it's 'orrible.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
This is not the right forum for posting anything else other than a question on Window Forms.
(definitely not for advertising)
|
|
|
|
|
Hi,
I am using WeifenLuo.WinformsUI.Docking suite in m in my Winforms App for Docking Multiple forms in a MDI Form.
Now the isssue is when i am making a Forms as Auto Hide.
When i am trying to click View --> Window , then the window on the toggling.
I tried:
private void ShowForm_Click(object sender, EventArgs e)
{
Explorer.Show(dockPanel);
Explorer.Select();
}
I am using WeifenLuo.WinformsUI.Docking.dll Version 2.7.0.0
Any suggestion plz Help.
|
|
|
|
|
|
I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.
|
|
|
|
|
Please show the actual code that is not working and explain in detail. No one can guess what your code does.
Veni, vidi, abiit domum
|
|
|
|
|
ANKIT KUMAR SINHA wrote: if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item Instead of disabling the menu-item, I'd recommend not creating it in the first place.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Try creating a variable in the login form, when any of them logs in assign a value to that variable. Note: the value assigned should be different depending on who logged in. E.g (variable_name = 1..when admin logs in, variable_name = 2..when user logs in ). On the load event of the main form use an if statement to check the value of that variable. Depending on the value of the variable disable the menustrip item using the its name. Example when a normal user logs in
If(variable_name=1)
{
Menustripitem_name.enable=false;
}
Remember to declare the variables for validation as static variables in the login form so as to access it in the mainform.
Hope that works
|
|
|
|
|
Thanks.
I also solve this problem but my procedure is different first i MDI Parent form menustrip itme property change the modifier it declared public and then i access this menu strip in other form like login form.
step:1
menustripitem property = public
step:2
creating an object the login form
step:3
object.menustripitem.Enabled = false;
it working properly
|
|
|
|
|
you also realise that you can merge menu's from the child forms into the parent container?
Google : MDI Parent form merge menustrip[^]
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
check it userwise
if(user =="admin"){
menu.IsEnable=true;
}
else {menu.IsEnable=false;}
something like this
Sankarsan Parida
|
|
|
|
|
Try making a Boolean variable.
On login, the app must determine if the logged in user is admin or not.
Then, set the appropriate values.
On login:
If user is admin: adminbool = true
else
adminbool = false
On form_load
If(adminbool=false)
{
Menustripitem_name.enable=false;
}
else
{
Menustripitem_name.enable=true;
}
You get the idea, right?
|
|
|
|
|
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.IO.Ports
Imports System.Threading
Imports System.Text.RegularExpressions
Public Class clsSMS
#Region "Open and Close Ports"
'Open Port
Public Function OpenPort(p_strPortName As String, p_uBaudRate As Integer, p_uDataBits As Integer, p_uReadTimeout As Integer, p_uWriteTimeout As Integer) As SerialPort
receiveNow = New AutoResetEvent(False)
Dim port As New SerialPort()
Try
port.PortName = p_strPortName
'COM1
port.BaudRate = p_uBaudRate
'9600
port.DataBits = p_uDataBits
'8
port.StopBits = StopBits.One
'1
port.Parity = Parity.None
'None
port.ReadTimeout = p_uReadTimeout
'300
port.WriteTimeout = p_uWriteTimeout
'300
port.Encoding = Encoding.GetEncoding("iso-8859-1")
AddHandler port.DataReceived, New SerialDataReceivedEventHandler(AddressOf port_DataReceived)
port.Open()
port.DtrEnable = True
port.RtsEnable = True
Catch ex As Exception
Throw ex
End Try
Return port
End Function
'Close Port
Public Sub ClosePort(port As SerialPort)
Try
port.Close()
RemoveHandler port.DataReceived, New SerialDataReceivedEventHandler(AddressOf port_DataReceived)
port = Nothing
Catch ex As Exception
Throw ex
End Try
End Sub
#End Region
'Execute AT Command
Public Function ExecCommand(port As SerialPort, command As String, responseTimeout As Integer, errorMessage As String) As String
Try
port.DiscardOutBuffer()
port.DiscardInBuffer()
receiveNow.Reset()
port.Write(command & vbCr)
Dim input As String = ReadResponse(port, responseTimeout)
If (input.Length = 0) OrElse ((Not input.EndsWith(vbCr & vbLf & "> ")) AndAlso (Not input.EndsWith(vbCr & vbLf & "OK" & vbCr & vbLf))) Then
Throw New ApplicationException("No success message was received.")
End If
Return input
Catch ex As Exception
Throw ex
End Try
End Function
'Receive data from port
Public Sub port_DataReceived(sender As Object, e As SerialDataReceivedEventArgs)
Try
If e.EventType = SerialData.Chars Then
receiveNow.[Set]()
End If
Catch ex As Exception
Throw ex
End Try
End Sub
Public Function ReadResponse(port As SerialPort, timeout As Integer) As String
Dim buffer As String = String.Empty
Try
Do
If receiveNow.WaitOne(timeout, False) Then
Dim t As String = port.ReadExisting()
buffer += t
Else
If buffer.Length > 0 Then
Throw New ApplicationException("Response received is incomplete.")
Else
Throw New ApplicationException("No data received from phone.")
End If
End If
Loop While Not buffer.EndsWith(vbCr & vbLf & "OK" & vbCr & vbLf) AndAlso Not buffer.EndsWith(vbCr & vbLf & "> ") AndAlso Not buffer.EndsWith(vbCr & vbLf & "ERROR" & vbCr & vbLf)
Catch ex As Exception
Throw ex
End Try
Return buffer
End Function
#Region "Count SMS"
Public Function CountSMSmessages(port As SerialPort) As Integer
Dim CountTotalMessages As Integer = 0
Try
'#Region "Execute Command"
Dim recievedData As String = ExecCommand(port, "AT", 300, "No phone connected at ")
recievedData = ExecCommand(port, "AT+CMGF=1", 300, "Failed to set message format.")
Dim command As [String] = "AT+CPMS?"
recievedData = ExecCommand(port, command, 1000, "Failed to count SMS message")
Dim uReceivedDataLength As Integer = recievedData.Length
'#End Region
'#Region "If command is executed successfully"
If (recievedData.Length >= 45) AndAlso (recievedData.StartsWith("AT+CPMS?")) Then
'#Region "Parsing SMS"
Dim strSplit As String() = recievedData.Split(","c)
Dim strMessageStorageArea1 As String = strSplit(0)
'SM
Dim strMessageExist1 As String = strSplit(1)
'Msgs exist in SM
'#End Region
'#Region "Count Total Number of SMS In SIM"
'#End Region
CountTotalMessages = Convert.ToInt32(strMessageExist1)
'#End Region
'#Region "If command is not executed successfully"
ElseIf recievedData.Contains("ERROR") Then
'#Region "Error in Counting total number of SMS"
Dim recievedError As String = recievedData
recievedError = recievedError.Trim()
'#End Region
recievedData = "Following error occured while counting the message" & recievedError
End If
'#End Region
Return CountTotalMessages
Catch ex As Exception
Throw ex
End Try
End Function
#End Region
#Region "Read SMS"
Public receiveNow As AutoResetEvent
Public Function ReadSMS(port As SerialPort, p_strCommand As String) As ShortMessageCollection
' Set up the phone and read the messages
Dim messages As ShortMessageCollection = Nothing
Try
'#Region "Execute Command"
' Check connection
ExecCommand(port, "AT", 300, "No phone connected")
' Use message format "Text mode"
ExecCommand(port, "AT+CMGF=1", 300, "Failed to set message format.")
' Use character set "PCCP437"
ExecCommand(port, "AT+CSCS=""PCCP437""", 300, "Failed to set character set.")
' Select SIM storage
ExecCommand(port, "AT+CPMS=""SM""", 300, "Failed to select message storage.")
' Read the messages
Dim input As String = ExecCommand(port, p_strCommand, 5000, "Failed to read the messages.")
'#End Region
'#Region "Parse messages"
'#End Region
messages = ParseMessages(input)
Catch ex As Exception
Throw ex
End Try
If messages IsNot Nothing Then
Return messages
Else
Return Nothing
End If
End Function
Public Function ParseMessages(input As String) As ShortMessageCollection
Dim messages As New ShortMessageCollection()
Try
Dim r As New Regex("\+CMGL: (\d+),""(.+)"",""(.+)"",(.*),""(.+)""\r\n(.+)\r\n")
Dim m As Match = r.Match(input)
While m.Success
Dim msg As New ShortMessage()
'msg.Index = int.Parse(m.Groups[1].Value);
msg.Index = m.Groups(1).Value
msg.Status = m.Groups(2).Value
msg.Sender = m.Groups(3).Value
msg.Alphabet = m.Groups(4).Value
msg.Sent = m.Groups(5).Value
msg.Message = m.Groups(6).Value
messages.Add(msg)
m = m.NextMatch()
End While
Catch ex As Exception
Throw ex
End Try
Return messages
End Function
#End Region
#Region "Send SMS"
Shared readNow As New AutoResetEvent(False)
Public Function sendMsg(port As SerialPort, PhoneNo As String, Message As String) As Boolean
Dim isSend As Boolean = False
Try
Dim recievedData As String = ExecCommand(port, "AT", 300, "No phone connected")
recievedData = ExecCommand(port, "AT+CMGF=1", 300, "Failed to set message format.")
Dim command As [String] = "AT+CMGS=""" & PhoneNo & """"
recievedData = ExecCommand(port, command, 300, "Failed to accept phoneNo")
command = Message & Char.ConvertFromUtf32(26) & vbCr
recievedData = ExecCommand(port, command, 3000, "Failed to send message")
'3 seconds
If recievedData.EndsWith(vbCr & vbLf & "OK" & vbCr & vbLf) Then
isSend = True
ElseIf recievedData.Contains("ERROR") Then
isSend = False
End If
Return isSend
Catch ex As Exception
Throw ex
End Try
End Function
Private Shared Sub DataReceived(sender As Object, e As SerialDataReceivedEventArgs)
Try
If e.EventType = SerialData.Chars Then
readNow.[Set]()
End If
Catch ex As Exception
Throw ex
End Try
End Sub
#End Region
#Region "Delete SMS"
Public Function DeleteMsg(port As SerialPort, p_strCommand As String) As Boolean
Dim isDeleted As Boolean = False
Try
'#Region "Execute Command"
Dim recievedData As String = ExecCommand(port, "AT", 300, "No phone connected")
recievedData = ExecCommand(port, "AT+CMGF=1", 300, "Failed to set message format.")
Dim command As [String] = p_strCommand
recievedData = ExecCommand(port, command, 300, "Failed to delete message")
'#End Region
If recievedData.EndsWith(vbCr & vbLf & "OK" & vbCr & vbLf) Then
isDeleted = True
End If
If recievedData.Contains("ERROR") Then
isDeleted = False
End If
Return isDeleted
Catch ex As Exception
Throw ex
End Try
End Function
#End Region
End Class
' MORE
' Request by Email....
CAO
|
|
|
|
|
? A big code dump. So what? What's the problem?
|
|
|
|
|
Hi,
We have a Windows Forms project with quite a few flatstyle buttons.
When we disable the buttons, the colors of the buttons are changed automatically
Is it possible to override this somehow, so we can control the colors ourselves?
Thanks,
Karl
|
|
|
|
|
You could create your own buttons, the simplest way is to inherit from Button and override some functions:
public class BernieButton : Button
{
protected override void OnEnabledChanged(EventArgs e)
{
base.OnEnabledChanged(e);
....
}
}
|
|
|
|
|
Yeah, that's the expected behavior. It's the standard notification to the user that the button will no longer work in the current situation.
Why would you want to change this?? If you don't change the color, the user will wonder what's wrong with your app because they think they're clicking on an active button and nothing is happening!
|
|
|
|
|