|
I'm using PPC2003 with Cleartype mode screen. How i can draw a text without cleartype mode in GDI+ in CF 2.0
Nothing
|
|
|
|
|
How can I get the text of a prticular item in a listview? I searched online and found this
strItem = lvPurchaseDetails.Items(i).Text
Whats the equivalent of this in C#?
|
|
|
|
|
Mridang Agarwal wrote: Whats the equivalent of this in C#?
That looks like C# to me!
Modified at 11:02 Sunday 26th March, 2006
[edit]
Ah - I just noticed the ()s. Use [] instead.
[/edit]
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Pretty much the same:
strItem = lvPurchaseDetails.Items[i].Text;
or if you want the text of a particular subitem:
strItem = lvPurchaseDetails.Items[i].SubItems[i].Text;
|
|
|
|
|
my bad...I've been working with VB for so long that I forgot to replace the () with [].
|
|
|
|
|
and In Addition of what added above if you want to get the Focused Item or Line Text use:
//to get the first column Item
str_item = listView1.FocusedItem.Text;
//to get the first column item key
str_item_key = listView1.FocusedItem.ImageKey;
//to get all the text in the line selected
string[] str_Items = { listView1.FocusedItem.SubItems[0].Text , listView1.FocusedItem.SubItems[1].Text,...//depending on the numbers of Columns you Have Ehere Column 0 is the first column and not the first column in subitem
Have a Good Day
|
|
|
|
|
I implement Project to GIS(ESRI) and use C#, I used Map Control view Detail Map on Form. How wiil I do Use algorithm "Floyd" find the fastest/shortest way the two placesCan U share Code or Exameple for Me (send to dong.nguyendinh@gmail.com)Thanks very much AnhTin
|
|
|
|
|
I am trying to save a toolbar state to registry for later restore. But i seem unable to work with the Win32 API correctly. Can someone help? The problem is with the TBSAVEPARAMS struct. It wants a handle to the registry key (HKEY_LOCAL_MACHINE in this case) but where do i get this? I have tried passing the HKEY_LOCAL_MACHINE const 0x80000002 but i get a memory cannot be read error when i execute SendMessage TB_SAVERESTORE. I have tried the NET Registry.LocalMachine but i am unable to turn this into a pointer needed for the struct.
So what options are available? Is this impossible in NET? Below is the code i am using.
[StructLayout(LayoutKind.Sequential)]
public struct TBSAVEPARAMS
{
public UIntPtr hkr;
public string pszSubKey;
public string pszValueName;
}
[DllImport("user32.dll")]
public static extern int SendMessage(
IntPtr hWnd,
uint msg,
bool wParam,
Win32Struct.TBSAVEPARAMS lParam);
// open registrykey
// create key if needed
RegistryKey key = null;
string regKey = @"SOFTWARE\TEST";
key = Registry.LocalMachine.OpenSubKey(regKey, true);
// check errors
if (key == null)
{
return;
}
// close registry key
key.Close();
// get toolbar handle
IntPtr hWndToolBar = TrayIcons.GetIconTrayWnd();
// set up restore struct
Win32Struct.TBSAVEPARAMS tbSaveParams = new Win32Struct.TBSAVEPARAMS();
tbSaveParams.hkr = (UIntPtr)Win32Const.HKEY_LOCAL_MACHINE;
tbSaveParams.pszSubKey = regKey;
tbSaveParams.pszValueName = "Toolbar";
// save tray icon state
int result = Win32Windows.SendMessage(hWndToolBar,
(uint)Win32Const.TB_SAVERESTOREA, true, tbSaveParams);
Debug.WriteLine("result: " + result);
|
|
|
|
|
I found that one has to us process shared memory when communicating with windows OS toolbars; I thought this only applied when reading back structs in a SendMessage. Below is update of my code. I do not get any errors this time, but nothing happens. No registry key value is created, nothing. I probably need someone with PInvoke experience to OK my code ot NOT. That would help.
// get toolbar handle
IntPtr hWndToolBar = TrayIcons.GetIconTrayWnd();
// get handle to other process
// open process for all access or get access denied error
int processID = 0;
int threadID = Win32ProcessThread.GetWindowThreadProcessId(
hWndToolBar, ref processID);
IntPtr hProcess = Win32ProcessThread.OpenProcess(
Win32Const.PROCESS_ALL_ACCESS, false, processID);
// set up shared memory for struct
// make it big enough to hold dynamic data
int bufferSize = 16000;
IntPtr hGlobalBuffer = Win32Memory.VirtualAllocEx(
hProcess, IntPtr.Zero, bufferSize,
Win32Const.MEM_RESERVE | Win32Const.MEM_COMMIT,
Win32Const.PAGE_READWRITE);
// allocate local memory to hold struct
IntPtr hLocalBuffer = Marshal.AllocHGlobal(bufferSize);
// set up save struct
Win32Struct.TBSAVEPARAMS tbSaveParams = new Win32Struct.TBSAVEPARAMS();
string regKey = @"SOFTWARE\TEST";
tbSaveParams.hkr = (UIntPtr)Win32Const.HKEY_LOCAL_MACHINE;
tbSaveParams.pszSubKey = regKey;
tbSaveParams.pszValueName = "IconsBackup";
// convert struct to pointer
Marshal.StructureToPtr(tbSaveParams, hLocalBuffer, false);
// put struct in place
Win32Memory.WriteProcessMemory(hProcess, hGlobalBuffer,
hLocalBuffer, bufferSize, 0);
// save tray icon state
// no return value
Win32Windows.SendMessage(hWndToolBar,
(uint)Win32Const.TB_SAVERESTOREA, true, hLocalBuffer);
// clean up
Win32Memory.VirtualFreeEx(hProcess, hGlobalBuffer,
bufferSize, Win32Const.MEM_RELEASE);
Marshal.FreeHGlobal(hLocalBuffer);
Win32ProcessThread.CloseHandle(hProcess);
|
|
|
|
|
Hi.Im a beginner in C# and Im trying to understand the meaning of this function:
public Complex(double r, double i)
{
x = r;
y = i; }
public Complex add(Complex c)
{
x += c.x;
y += c.y;
return this;
}
Anybody can explain me in simple words what is the meaning of this?
Best regards
|
|
|
|
|
These methods are part of a class called Complex. The class seems to hold something like x and y coordinates. The first function is called the constructor for the class. This is where the x and y values are initialized based on the parameters (r, i). The second function is for adding two instances of the class together. So it takes an instance of Comnplex (called c in this case) and adds it to the current instance and returns the new object with the sum of the values.
Ex.
Complex c = new Complex(3, 4);
Complex a = new Complex(1, 2);
a = a.add(c);
Console.WriteLine(a.x + " " + a.y);
Output:
4 6
Does that help?
|
|
|
|
|
This is part of a class or structure called Complex, that handles a complex number[^].
The first method is the constructor of the class/structure. It's called when you create an object of the class/structure. It initializes the variables in the class.
The second method adds two complex numbers.
---
b { font-weight: normal; }
-- modified at 18:02 Saturday 25th March, 2006
|
|
|
|
|
I got a dummy problem while using listbox, combobox or messagebox. When I used these, every thing seems good but, I can't see the messagebox text or listbox or combobox items. I can select the items in the list or combo and get the values or messagebox works well but I can not see the message text itself or the buttons text in the messagebox. Is anyone has ever encountered such problem I know this has a very simple solution but I could not fint it.
Yakup
|
|
|
|
|
hi
i craete image in listview but the image is always in the first place how do i change the location of the image?
my code is:
imageList1.Images.Add((System.Drawing.Image)chart.GetBitmap().Clone())
for ( int i = pam.holdingArrVector.Count ; i > 0 ; i--)
{
lvi = new ListViewItem(new string[3] {" ",Convert.ToString(i-1),pam.CheckNearPivot(i-1)},i-1);
listView1.Items.Insert(0, lvi);
}
when i change listView1.Items.Insert(0, lvi);
to listView1.Items.Insert(1, lvi);
the program is falled
thanks
have a nice day
|
|
|
|
|
This is normal behavior for the listview control. If you want an image in another column you will have to: 1) use a Win32 API trick; 2) make a custom control. Look at Code Project articles for example of custom listview controls. Below is a link using a Win32 API trick.
http://www.codeproject.com/cs/miscctrl/OAKListView.asp
|
|
|
|
|
yosba221 wrote: when i change listView1.Items.Insert(0, lvi);
to listView1.Items.Insert(1, lvi);
The imageIndex parameter is the index of the image in the ImageList , not the column where you want it to appear. Your program is throwing an exception because in the above code you only add one image to the ImageList , and then you are trying to access the second one which is not there.
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
I have implemeted a CollectionEditor is my custom control. It now sucessfully serializes and adds my items into the collection. Add/Remove succesully add or remove source code. However is there somthing special that needs to be done in order for VS to clean up the ColledtionEditor item code when the object is deleted by the user?
Thanks.
|
|
|
|
|
Hi all,
I am in a great trouble in drawing shapes. The problem is as follows:
I have a 8bit indexed gray scale image in a picturebox. I want to draw some filled rectangles permanently on the 8-bit image using mousedown and mousemove event of the picturebox. How should I implement this for 8-bit indexed image?
Please help me.
Thanks in advance
Anindya Chatterjee
|
|
|
|
|
Hi. i want to make a searh function in a richTextBox.
Just like in notepad or word ect ect i want a textBox there i could write something and then press searh/find and it searhes trough my text in my richTextBox.
How to do this?
Sorry for my bad english and thx.
Regards
//AeQuitaZ
PS. Thx to Yadav Pramod for the last sulution you gave me. thx.
|
|
|
|
|
If you get all the text in a string without formatting, the string class has a member IndexOf that finds the location of a substring. This[^] override will help you, since you can specify the starting position (probably where your cursor is.)
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
I am using a 3rd party component in my code and every time there's a particular error occurs in the execution of the component, instead of passing the error to the code that is running it (the component) the developers decided to just make a Message box show up!!
It totally is inconsistent with my program and since my program runs in a loop, if the particular error occurs, the user gets an endless loop of messageboxes that are really hard to kill. You wind up having to go the task manager to stop my program, because you message boxes from the 3rd party component are "dialog" (or whatever it's called) so you have to click the button and don't have access to my program's window. Very bad programming ethics on their part.
So, I was wondering if there is a way to suppress the messagebox from the 3rd party component? I don't have access to the components source either.
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote: I was wondering if there is a way to suppress the messagebox from the 3rd party component?
I know this isn't the answer you're looking for, but I would seriously consider dumping the component. However, before I do that, I'd check the documentation for error suppression flags and confirm the message boxes aren't being shown because the component is running in unlicensed (demo) mode.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Yeah, I can't dump it and the docs def. don't say anything about it. They're just lazy.
/\ |_ E X E GG
|
|
|
|
|
As Ravi suggested, I'd throw the component away and find another one (or develop it myself.) If you manage to kill this message box, you don't know if there are more hidden just waiting to pop up with your best customer.
As to how you could kill it, a WH_CBT Windows hook probably would do it.
eggie5 wrote: are "dialog" (or whatever it's called)
It's modal (disables parent window) and modeless (doesn´t disable parent window)
Luis Alonso Ramos
Intelectix
Chihuahua, Mexico Not much here: My CP Blog!
|
|
|
|
|
Asking them devs to fix it would be best but Luis hooking will work or you can remove the message box dialogs completly by debugging the control and noping the calls to the dialog.
|
|
|
|