|
Hi, i've got a problem here. i can't figure out why my form background and also the button change its color when i call the function below. how can i ensure that only the background changes? besides that, in the form i also need to draw and show some circles. How to ensure that when the background color changes, it still there?
public void b1_click(object sender, EventArgs e)
{
clg.ShowDialog();
this.BackColor = clg.Color;
}
|
|
|
|
|
Objects on your form inherit their background color from their container. In other words, if you place a button on your form, the background color will inherit from the form you put it on, unless you set the background color for the button (for example to 'Red').
Try setting the background color of your button to red and your code will work fine.
|
|
|
|
|
|
Hello,
The stringclass itselfe provides some usefull methods, but I think for that purpose you need "using System.Text.RegularExpressions"
All the best,
Martin
|
|
|
|
|
Perhaps this[^] article may help?
/ravi
|
|
|
|
|
Hi all,
i want to implement multicast in c#.
i found lots of example in that..........
but it will show only one message..........
but it the wireless network lots of ip sending messages.....
i had 1 more tool in vc++6.0 it will show around 7 ip in that group sending messages....
wat is the problem... how to handle this in c#
With Regards
Amjath
|
|
|
|
|
hi all,
i want to search a particular text in the list view like if there is text "Cancel The Item" and i want to search search item then i want to make red only Item not the whole , it's like the search we have in wordpad or notepad .
Does anyone has any idea please tell me?
Praveen Sharma
|
|
|
|
|
Next time, please ask your question in English...
loop through your listview items
<br />
foreach (ListViewItem itm in yourListView.Items)<br />
{<br />
if (match)<br />
itm.BackColor = Color.Red;<br />
}<br />
For regular expressions help, see This[^] website
|
|
|
|
|
the code that causes error is boldfaced...see below the inner most loop code.
private void toolStripButton3_Click(object sender, EventArgs e)
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GDI+ still lies to us - the return format is BGR, NOT RGB.
///Cover Image Code
Bitmap bmp1 = new Bitmap(textBox1.Text); ///takes image from openfiledlg textbox1
///takes an object of BitmapData & apply LocBits()
BitmapData bmp1data = bmp1.LockBits(new Rectangle(0, 0, bmp1.Width, bmp1.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
///finds out Bitmap's stride
int stride1 = bmp1data.Stride;
///defines pointer's to scan0 (1st byte of BimapData array
System.IntPtr Scan1 = bmp1data.Scan0;
///end of Cover Image Code
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/// Stego Image code
Bitmap bmp2 = new Bitmap("f:\\bb.jpg");
BitmapData bmp2data = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
int stride2 = bmp2data.Stride;
System.IntPtr Scan2 = bmp2data.Scan0;
unsafe
{
///unsafe stego code
byte* ptr2 = (byte*)(void*)Scan2;
int offset2 = stride2 - bmp2.Width * 3;
byte b2;
///end of unsafe stego
////////////////////////////////////////////////////////////////
///unsafe cover code
/// defines a byte type pointer to scan0
byte* ptr1 = null;
ptr1 = (byte*)(void*)Scan1;
/// finds offset of the BitmapData
int offset1 = stride1 - bmp1.Width * 3;
/// defines RGB values
byte b1,index=0;
bool bitt;
int x1, x2, y1, y2;
///iterates through the BitmapData
///end of unsafe cover code
////////////////////////////////////////////////////////////////
for (y2 = 0; y2 <= bmp2.Height; ++y2)
{
for (x2 = 0; x2 <= bmp2.Width; ++x2)
{
b2 = ptr2[0];
////embedding a bitt
for (y1 = 0; y1 <= bmp1.Height; y1++)
{
index = 0;
x1 = 0;
while(index<8 || x1<=bmp1.Width )
{
//////erroenous code
b1 = ptr1[0]; //gives error..access voilation
bitt = GetBit(b2, index);
/// sets LSB
ptr1[0] = SetBit(b1,6,bitt);
////end of erroneouscode //increments index by 1 ++index;
x1 = x1 + 1; ;
/// increments the pointers
ptr1 += 1;
} ///end of while
/// incremnets the pointer by offset value
ptr1 += offset1;
} ///end of outer for loop
}///3rd for loop
ptr2 += 1;
}//2nd for loop
ptr2 += offset2;
}//1st for loop
//end of unsafe1....
/// end of stego Image Code
bmp1.UnlockBits(bmp1data);
bmp2.UnlockBits(bmp2data);
/// Displays grayscale picture in picturebox.
pictureBox1.Image = bmp1;
///End of Embedding.....
}
I am getting B.S. degree in Computer Science.And want to enhance career in Software development.
|
|
|
|
|
Hi Chetan
Well i went through your code which was given in one of your articles
"Enumerating Objects in C#" posted on "8 May 2007". No doubt that the article is very easy to understand but Well when i run this code
it gave the following error
"the Cannot implicitly convert type 'test.Str.StrEnumerator' to 'System.Collections.IEnumerator'. An explicit conversion exists (are you missing a cast?)"
May you please tell me how to get rid of this?
Thanks and Regards
Abhishek
abhishek@entech.us
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace test
{
class Demo
{
public static void Main()
{
Str spp = new Str();
foreach (string i in spp)
System.Console.WriteLine(i);
}
}
class Str : IEnumerable // To impliment GetEnumerator method
{
string[] str_arr = new string[5] { "one", "two", "three", "four", "five" };
public IEnumerator GetEnumerator()
{
IEnumerator r = new StrEnumerator(this);
return r;
}
class StrEnumerator
{
int index;
Str sp;
public StrEnumerator(Str str_obj)
{
index = -1;
sp = str_obj;
}
public object Current
{
get
{
return sp.str_arr[index];
}
}
public bool MoveNext()
{
if (index < sp.str_arr.Length - 1)
{
index++;
return true;
}
return false;
}
public void Reset()
{
index = -1;
}
}
}
}
//error -- An explicit conversion exists (are you missing a cast?)
Abhishek
Mumbai
|
|
|
|
|
abhishek.mumbai wrote:
class StrEnumerator : IEnumerator
|
|
|
|
|
Use the forum on the article page itself if you want to communicate with the author. There is no guarantee that the author will be reading this forum, but if you post on their article's forum then they will get an email to tell them a message exists.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Hello guys,
I have a datagrid control in which I have 2 relationships to make a 3 level nested datagrid, the problem is I need to know in what level I'm now, please save my a$$ as I'm in a mission now and have no time
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I need to compile the solution written in windows application using C#.
My build file is as follows:
<?xml version="1.0" ?>
<project name="TestNANT" default="build" basedir=".">
<target name="build">
<solution solutionfile="TestNANT.sln" configuration="Release" >
</solution>
<property name="expected.output" value="bin/${configuration}/TestNANT.exe"/>
<fail unless="${file::exists(expected.output)}">Output file doesn't exist in ${expected.output}</fail>
</target>
</project>
when i execute 'nant' command in command prompt, i get the following error:
BUILD FAILED
Microsoft Visual Studio.NET 2005 solutions are not supported.
Total time: 0 seconds.
Could anyone please help me out here or tell me the correct way to write the script...
Thanks...
Deepa
-- modified at 5:15 Wednesday 18th July, 2007
|
|
|
|
|
This really isn't the right forum (or even the right site) to be posting an NAnt question.
That being said, the last time I used NAnt (about 6 months ago), the solution task did not support Visual Studio 2005 formatted solution or project files. The work around for this is to use the exec task and run devenv.exe or msbuild with the appropriate command line. I believe there was an actual msbuild task that is part of the NAnt Contrib project, but I'm not 100% sure.
|
|
|
|
|
Hi Fellows:
I am facing an error of access voilation while running a piece of code with Unsafe Context...I am developing steganographic application.And I want to embedd DataImage into Cover image using LSB method with the help of Lockbits() and UnLockBits () methos..
But when I compile the code it is compiled & Build succesfully.But at run time the app. frozes and with the following error message for the statement.
<code>byte bb=ptr1[0] //where ptr1 is byte type pointer that points to Scan0 ,i.e 1st byte of locked image array. </code>
<b>Error :AccessVoilationUnhandelled exception</b>
Plateform :Visual C# Express edition VS.Net 2.0,Win XP
<b>Error Message:</b>
AcessVoilation: attempt to read or write protected memory.This is the oftenindication that other memeory is currupt.
also I am thanfull to Chorrina John...who write very helpful articles on Steganography...I request If she is there please help & Supervise me in my project.
Waiting for ur good response...
Thanks
I am getting B.S. degree in Computer Science.And want to enhance career in Software development.
|
|
|
|
|
Obviously ptr1 is not at all a pointer to a part of the image, but points somewhere else.
If you can show a bit more of the code, it might be possible to say anything more about it.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi everyone.
I have created an application that exports a new xls document, I did that using the com component "Microsoft Excel 9.0 object library" but of course that made my application dependant to this library. That shouldn't work on another client machine that don't have this version of Excel installed.
How can i make an application independent from my office. I mean it should be compatible with 'ALL' excel versions
any idea how to do this. and forget about the 'csv' format.
thanks
|
|
|
|
|
|
Hi, Im convinced i did this many years ago, but I cant find the code.
I did find this on Google Groups tho'
You can use the Microsoft OLE BD provider for Jet to dynamically
create an Excel workbook. Specifying a non-existent but valid path,
workbook name and Excel 'table' in a SELECT..INTO query results in it
being created.
Hope this helps
David
|
|
|
|
|
thank you guys, I think both of your suggests might work, but the first one looks like used in a web app, and the second one is cool.
Though i haven't tried any. Coz I think i found what i wanted,
http://support.microsoft.com/kb/302902/[^]
go to 'late binding', it's working for now, there's the test stuff later.but so far it worked on two workstations with MSoffice 2003 and the other 2000.
Thanks a lot for your help though, and i might use one of these methods if the current one fails, if not it's still good knowledge for me and ppl who might face such problems.
thanks
|
|
|
|
|
I have 2 things in reportviewer but print only one.
First one is datafields and anotherone is Image or Text.
I want see both in reportviewer but print only datafields.
If u have any idea in any report like RDLC,Crystal Report .... and any one then replay me....
Please replay fast...
Thanks in Advance.....
Manoj Patel
|
|
|
|
|
Hi All,
Hi,
I am developing a digital signature verification component in C# in .NET framework version 2.0.
In this verification I need to check the Certificate revocation status against a Offline CRL stored in a directory? I didnt find any api to initialize a CRL object or any examples to check revocation status?
Could some one please let me know how to use X509Chain object for offline CRL verification? I didnt find any examples. Or is there any other mechanism to do this checking?
Thanks-
Supraja
|
|
|
|
|
Hi everyone..
My TreeView Structure is like this....
TextBox
|
|_Textbox1
|_Textbox2
and im having two Textboxes Name Textbox1 and TextBox2.
My need is on selecting or clicking the Textbox1 in the tree node
the focus should be set on the Textbox1 if i clicked any other node
means the focus should be set on the coressponding Textbox..How should i achieve it?
My code is below..
private void TV_AfterSelect(object sender, TreeViewEventArgs e)
{
Control[] ctrl = this.Controls.Find(TV.SelectedNode.Text, true);
if (ctrl.Length > 0) ((TextBox)ctrl[0]).Focus();
}
But i getting only just a blink in the textbox and the focus is not appear permanently..
Rgrds
Kanna..
|
|
|
|
|
Hi friend,From Today Im going to work with Web Parts...Please let me know regarding to this...
Hi,Im Razana
|
|
|
|