in your OnMouseUp
event of your control, add the following code: MessageBox.Show("X: " + Cursor.Position.X + ", Y: " + Cursor.Position.Y);
You can use the Cursor.Position
property to find the current location of your mouse cursor on the screen. Jon G www.Gizmocoder.com
Jon G
Posts
-
captuting mouse position. -
Checking If Form Is LoadedA delay can be achieved with a Timer. Set your timer interval to a specified amount of time (1000 = 1 second) when your application starts, start the timer as well In your timer TICK event, stop and dispose the timer, and execute your update function. Jon G www.Gizmocoder.com
-
Panel control in a DLLYou may want to check the Z-Order of your controls If your panel is in front of all the other controls, you will not see them. Jon G www.Gizmocoder.com
-
ComboBoxes & DataTablesset the ValueMember property of the control: ComboBox1.ValueMember = "ID"; ComboBox1.DisplayMember = "Name"; ComboBox1.DataSource = XmlIn.Tables["Names"]; Then, you can get the selected Value by using the SelectedValue property: ComboBox1.SelectedValue; Jon G www.Gizmocoder.com
-
pdf text manipulationiTextSharp does not provide an option to EDIT an existing pdf file. Here is a quote from their tutorial:
You can't 'parse' an existing PDF file using iText, you can only 'read' it page per page.
What does this mean?
The pdf format is just a canvas where text and graphics are placed without any structure information. As such there aren't any 'iText-objects' in a PDF file. In each page there will probably be a number of 'Strings', but you can't reconstruct a phrase or a paragraph using these strings. There are probably a number of lines drawn, but you can't retrieve a Table-object based on these lines. In short: parsing the content of a PDF-file is NOT POSSIBLE with iText. Post your question on the newsgroup news://comp.text.pdf and maybe you will get some answers from people that have built tools that can parse PDF and extract some of its contents, but don't expect tools that will perform a bullet-proof conversion to structured text.Also,
What iText DOES provide is the possibility to READ a PDF document and copy an entire page of this file into the PDF file you are constructing from scratch. This can be useful if you want to create a new document based on (an) existing document(s). You can add a Watermark, pagenumbers,...
You may want to check out http://itextsharp.sourceforge.net/tutorial/ch01.html[^] Jon G www.Gizmocoder.com
-
sliding toolbar??i've implemented this by using Timers Basically, the idea is something like this: - Event is fired (Button click lets say) - Start Timer - On timer tick, resize/move control - Once control reaches appropriate size stop timer You can tweak the speed of your timer intervals to get a decent animation going. I am sure there is a better way to do this using DirectX. Jon G www.Gizmocoder.com
-
Weird Listbox ProblemI have a weird problem that started happening. I have a tabcontrol with 3 tabs, and each tab has its own ListBox control. I populate the listbox controls from a dataset i retreive from a database. Everything here is fine. The problem comes when the data is displayed. The ListBox does contain a collection, and all the items are selectable, BUT they are invisible. Every item in the listbox remains Invisible until I do the following: - Move the form (by dragging with the mouse) - Change the tab (redraws the listbox control) Once I do that, the listbox items are viewable. Can anyone give me any insight as to what is happening here? Jon G www.Gizmocoder.com
-
Database access freezing main applicationThanks . Jon G www.Gizmocoder.com
-
Database access freezing main applicationMy application goes throught multiple database access. during this time, the application is frozen since all its resources are dedicated to the task at hand. Can anyone tell me how, or preferably point me to a tutorial that would explain to me how to connect to a database without freezing the main application screen? Thanks in advance, Jon G www.Gizmocoder.com
-
Filefield Postback woesThis control is extremely protected. What I mean by this is that you cannot set the filename programatically (to avoid any type of "hacking"). The user is the only one that can select the filename. I have encountered the exact same problem, and never came to a solution. This may not be possible with the filefield control. There is also a free control available from metabuilders which brings all the client side options to the server side. You may be interested in trying it out. http://www.metabuilders.com/Tools/FileUpload.aspx[^] Please post your solution if you find one. Jon G www.Gizmocoder.com
-
Changing a cell in a DataBount DataGridWhen performing a select query, as you have mentioned, you probably fill a datatable, or a dataset with the returned data. The dataset is a representation of the data found in the database, and is not linked in any way to the database. For example, lets say you filled a dataset with a "select * from table1" statement:
Dim myConnection As SqlConnection = New SqlConnection("Network Library=DBMSSOCN;Data Source=DBNAME,1433;Initial Catalog=CATALOGNAME;Trusted_Connection=yes;MAX POOL SIZE = 1000")
Dim myCommand As SqlCommand
Dim myDataAdapter As SqlDataAdapter = New SqlDataAdapter
Dim myQuery As StringmyDataSet = New DataSet("test") myDataSet.Tables.Add("testtable") myQuery = "select \* from sighting where surveyid = 1" myCommand = New SqlCommand(myQuery, myConnection) Try myConnection.Open() myDataAdapter.SelectCommand = myCommand myDataAdapter.Fill(myDataSet, "testtable")
Catch ex As Exception
Response.Write(ex.Message)
Response.Write(ex.Source)
Response.Write(ex.StackTrace)
Finally
myConnection.Close()
myConnection.Dispose()
myCommand.Dispose()
myDataAdapter.Dispose()
End TryOkay, now you have a dataset, with a table called "Testtable" that contains the results of your query. To alter a value contained inside that dataset, you can do something like this:
myDataSet.Tables("testtable").Rows(0).Item(2) = "SOMETHING"
Where Rows(#) is the row to edit Where Item(#) is the column to edit Once you have edited the dataset to your linkign, you bind it to your datagrid:
MyDATAGRID.Datasource = myDataSet.Tables("TestTable")
MyDATAGRID.DataBind()Jon G www.Gizmocoder.com
-
Changing a cell in a DataBount DataGridChange the values from your datatable instead, then rebind it to your datagrid. Basically the same for each loop, but replace the save value you checked from your dataset. the, once all the values are set, DG.datasource = ds.tables["table1"] DG.databind Jon G www.Gizmocoder.com
-
Changing Background for Specific items in a DataGridEasy stuff. Okay, once you find a row that needs to be colored, you can do the following: MYDATAGRID.Items(ROWNUMBER).BackColor = Color.Red Where: MYDATAGRID is the name of your datagrid ROWNUMBER is the integer value of the row to change Jon G www.Gizmocoder.com
-
Datagrid ProblemAt the moment, there is no way to do this, since each item in the datagrid (each row) is derived from the same template. The next release of asp.net (2.0/aka whidbey) will be packaged with a nicer datagrid control, called the dataview http://msdn.microsoft.com/msdnmag/issues/04/08/GridView/default.aspx[^] Until that is released, you may want to try to code your own custom datagrid control, which would probably end up taking as much time. Jon G www.Gizmocoder.com
-
saving displayed text in textboxThe main problem here is that you cannot set the text inside the control (its read-only). I was hop8ing to find a work around to this problem. Thanks for your help. Jon G www.Gizmocoder.com
-
saving displayed text in textboxI have a textbox control, which is a HTML control, set to run on server side. I made it of type=File so that the user may browse and select the file they wish to use. Code: I have two questions (1) - How would I make it so that the text in that textbox is saved between posts? (2) - Is there a way to tell the control what file types to display (restrict the file types displayed) when browsing? I just want it to display Jpg/Gif/Bmp TIA Jon G www.Gizmocoder.com
-
Pixel/Points UnitsI found out how to accomplish this task. Here is what I ended up doing (after a painful hour of brute forcing): I created a new image (not a webcontrol image, but a system.drawing image):
Dim myImage As System.Drawing.Image = System.Drawing.Image.FromFile(UploadPath + NewPicName)
The image was created from the network path. In my case it was an uploaded file. After this, everything got easy. Dim tempHeight = myImage.Height Dim tempWidth = myImage.Width For future reference, Webcontrol Images do not allow you to retrieve the height and width of an image. If it does, I would like someone to let me know how. Jon G www.Gizmocoder.com -
Pixel/Points UnitsI have an Image server control on my page. In my codebehind, I am trying to convert the Image.Height and Image.Width properties of that Image into a string. Can anyone tell me how this is done? I cannot find any correct way to convert the Unit type into a string. Jon G www.Gizmocoder.com
-
distance between pointsI do not know of any functions that will accomplish this in asp.net But technically speaking, there isn't really any way to programatically check this without actually having to compare with all existing points. Jon G www.Gizmocoder.com
-
GMail inviteshehehe, sorry folks Jon G www.Gizmocoder.com