Jump to content
Xtreme .Net Talk

headkaze

Members
  • Posts

    23
  • Joined

  • Last visited

headkaze's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Take a look at the SplitContainer under Containers. Drag your DataGrids onto these and "Dock" them appropriately. Docking should ensure that resizing the window will have them adjust accordingly. Also consider that the zorder of controls can effect how they will be docked, so you can also right-click controls on your form and select "Bring To Front" to effect the positioning.
  2. I would ask someone at your local electronics store if they have kits for something like that. You might want to consider controlling a device through a COM port or perhaps there are devices that already have their own software and way to communicate via a computer. This is why you really need to look around at the devices out there on the market, then the manual that comes with it should explain how to communicate to it. I'm guessing digital combination locks could be quite expensive.
  3. You will probably have to use pinvoke for that or write a wrapper and C++ dll. Check out the code for Program 4. Microphone Select
  4. You may be able to modify the following code to measure the height of a tooltip. public static void AutoSizeLabelHeight(Label ctlLabel) { Graphics g = ctlLabel.CreateGraphics(); Font font = new Font(ctlLabel.Font.Name, ctlLabel.Font.Size, ctlLabel.Font.Style); StringFormat sf = new StringFormat(); SizeF stringSize = g.MeasureString(ctlLabel.Text, font, ctlLabel.Width, sf); ctlLabel.Height = (int) stringSize.Height + 2; g.Dispose(); font.Dispose(); sf.Dispose(); }
  5. I am writing a simple PhoneBook database program, and part of it requires me to get the values of the currently viewed record. I am using BindingManagerBase to handle browsing through the Phone Book. Right now I am using the following line to get the value of column 0 ("Phone") to retrieve the phone number of the currently viewed record. dataSet11.Tables["PhoneBook"].Rows[this.bindManager.Position].ItemArray[0] I am wondering, can I possibly get the value like ItemArray[] but using the column's name. The above line gives me the value of "Phone". But I would like to use the columns name "Phone". Eg. ItemArray["Phone"], but obviously that only accepts a int index value. I can't seem to find a simple way to do it.
  6. Just create a method that will search for the Id... Product GetProduct(int id) { foreach(Product p in ProductArray) if(p.Id == id) return p; return null; } Product MyProduct = GetProduct(3); Debug.WriteLine(MyProduct.Name);
  7. Maybe have an image list with your frames of animation and use a picturebox with a timer that changes the images.
  8. I know this is an old thread, but I found this use of bitblt in C# on the web a while ago if it's of any help. public static void DrawBitBlt(Graphics g, Bitmap bmp, ref Rectangle destRec) { IntPtr hDC = g.GetHdc(); IntPtr hBmp = bmp.GetHbitmap(); IntPtr ImageDC= a.Api.CreateCompatibleDC(hDC); IntPtr offscreenDC= a.Api.CreateCompatibleDC(hDC); IntPtr drawBmp= a.Api.CreateCompatibleBitmap(hDC, destRec.Size.Width, destRec.Size.Height); IntPtr oldBmp= a.Api.SelectObject(ImageDC, hBmp); IntPtr oldDrawBmp= a.Api.SelectObject(offscreenDC, drawBmp); if(bmp.Size.Equals(destRec.Size)) { a.Api.BitBlt(offscreenDC, 0, 0, destRec.Width, destRec.Height, ImageDC, 0, 0, SrcCopy); } else a.Api.StretchBlt(offscreenDC, 0, 0, destRec.Width, destRec.Height, ImageDC, 0, 0, bmp.Width, bmp.Height, SrcCopy); a.Api.BitBlt(hDC, destRec.X, destRec.Y, destRec.Width, destRec.Height, offscreenDC, 0, 0, SrcCopy); a.Api.SelectObject(ImageDC, oldBmp); a.Api.DeleteObject(hBmp); a.Api.SelectObject(offscreenDC, oldDrawBmp); a.Api.DeleteObject(drawBmp); a.Api.DeleteDC(ImageDC); a.Api.DeleteDC(offscreenDC); g.ReleaseHdc(hDC); }
  9. I had a similar problem with autosizing the height of a label depending on it's contents. I'm not sure if it will be of any help, but cags posted some nice and simple managed code to do it. Here it is as a class: public class AutoSizeLabel { public static void AutoSizeLabelHeight(Label ctlLabel) { Graphics g = ctlLabel.CreateGraphics(); Font font = new Font(ctlLabel.Font.Name, ctlLabel.Font.Size, ctlLabel.Font.Style); StringFormat sf = new StringFormat(); SizeF stringSize = g.MeasureString(ctlLabel.Text, font, ctlLabel.Width, sf); ctlLabel.Height = (int) stringSize.Height + 2; g.Dispose(); font.Dispose(); sf.Dispose(); } }
  10. I'm quite confused about the way ComboBox's FindString() method works. Consider the following example: ComboBox myComboBox = new ComboBox(); myComboBox.Items.AddRange(new string[] { "Test1", "Test2", "Test3", "" }); MessageBox.Show(myComboBox.FindString("Test1").ToString()); MessageBox.Show(myComboBox.FindString("Test2").ToString()); MessageBox.Show(myComboBox.FindString("Test3").ToString()); MessageBox.Show(myComboBox.FindString("").ToString()); The first three output as you would expect 0, 1, 2 but the last one output's 0. ***? Who wrote this method anyway. I mean I could understand it returning -1 or something like that but it is returning 0 which is "Test 1" which is not null, and not an empty string "".
  11. I'm writing a configuration program and I need to get a list of DVD MPEG-2 codecs on the machine. The same list you get from the program DecCheck Eg. NVIDIA Video Decoder Leadtek Video/SP Decoder Is there any way to do this using managed code? I assume it might be a bit difficult for .NET's lack of DirectShow support. Perhaps I can use DirectShowLib or something, but it would be nice if I can do it in my own class without a dependancy even if I have to use p/invoke.
  12. I've done quite a bit of searching and most pages on the NET point to an article that is no longer available.. http://www.omniscium.com/index.asp?page=DotNetScreenResolution I can view the article fine on archive.org, but it would be nice to have the Resolution.zip file that was hosted on the site and is now a broken link. http://web.archive.org/web/20050227032111/http://omniscium.com/index.asp?page=DotNetScreenResolution Does anyone here have that file who can re-post here? It would save me some time writing my own class for it.
  13. All that hoohaa was just to split up the text in the TextBox into an array of words separated by a space, then bring them back together placing a "+" between them. myTextBox.Text = "word1 word2 word3"; MessageBox.Show(String.Join("+", myTextBox.Text.Split(' '))); Will ouput "word1+word2+word3". The error you got was because I accidently used single quotes for a char in the Join method when it expects double quotes for a string.
×
×
  • Create New...