|
Hi all,
I want to insert a folder path as a link in the RIchtextbox,
so when the user clicks on that link the folder should be opened.
I have set this using the "file" protocol but
the folder path is c:\Documents and settings\
here when i handle the linkclicked event
and try to get the path from the e.linktext property
i only displays "c:\Documents"
i.e. only upto the first space character.
How do i get rid of this?
Thanks & Regards,
Everyone is a genius at least once a year - Pramod
|
|
|
|
|
Hello
AFAIK URLs don't support actual spaces. You'd have to substitute spaces with "%20".
eg.
Documents and settings => file:///C:\Documents%20and%20Settings
If you can change the text -not the link- it won't matter as long as the link itself goes without spaces.
Regards
|
|
|
|
|
Thanks for the quick reply,
When i use the "%20" to replace with the spaces in the path,
The following is displayed "file:///c:\Documents%20and%20settings\foldername"
and the link does not open, it gives and error.
i don't want the word "file" to be displayed as well
the link should look like
C:\Documents and settings\foldername
how do i do that?
Thanks & Regards,
Everyone is a genius at least once a year - Pramod
|
|
|
|
|
Hello
Yadav Pramod wrote: it gives and error.
What is the error message?
Yadav Pramod wrote: how do i do that?
It's possible, but I don't think it's worth it!! It will take some effort.
1- Make a LinkLabel object and initialize it.
2- Add it to MyRichTextBox object.
3- Set it's location according to your text -don't worry about scrolling-.
4- Handle the LinkLabel's own click event rather than the RichTextBox's event.
Sample code:
LinkLabel MyLink;
private void Form1_Load(object sender, EventArgs e)
{
MyLink = new LinkLabel();
MyLink.Text = "This is a link";
MyLink.Links.Add(0, MyLink.Text.Length, @"file:///C:\Documents%20and%20Settings");
MyLink.Click += new EventHandler(MyLink_Click);
MyRichTextBox.Controls.Add(MyLink);
}
void MyLink_Click(object sender, EventArgs e)
{
Process.Start(MyLink.Links[0].LinkData.ToString());
}
I hope this helps!!
Regards
|
|
|
|
|
Thanks, but i have used a "_" (underscore) character.
and later replaced it with a space while opening the link,
BUt how do i remove the file keyword?
Thanks & Regards,
Everyone is a genius at least once a year - Pramod
|
|
|
|
|
Hello
Well, Mav did that one for you. If his article work, it's solved!
Regards
|
|
|
|
|
Hi!
Take a look at this article[^]
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hello
iam of student of BS compSc ,im working on my final project that is"Histogram-Based Fuzzy Filter" trying to implement research paper, but i m facing alot of problem do not know how to encode in C#,
i have done some work on image like conversion of rgb image into grayscale ,and also draw its histogram but no succes towards implementing this papper,
i have to complete this project in a 15 days
plz help me
-- modified at 1:50 Tuesday 29th August, 2006
|
|
|
|
|
Hello
Your title was quite clear in stating that you are facing a problem with images -and this is the C# forum BTW. Welcome -
Yet, your post itself didn't specify what exactly are you stuck with??
Asma Saleem wrote: i m facing alot of problem do not know how to encode in C#
At All?!! And what exactly are you expecting??
Asma Saleem wrote: plz help me
We realy want to help -that's why we are here after all-, but how??
Regards
|
|
|
|
|
plz help in converting code from matlab to C#, i m sending u code as i told im working in image processing , ihave done all work in matlab but now i hve convert it in to C# Code is below
%Reading image file and storing it in a variable.
imagex=imread('D:\MS_courses\ece655\Project\test_images\test_image3.jpg');
%RGB2GRAY converts RGB images to grayscale by eliminating the
%hue and saturation information while retaining the luminance.
%im2double takes an image as input, and returns an image of class double.
f = im2double(rgb2gray(imagex));
%f=[.1,.2,.3;.4,.5,.6;.7,.8,.9];
%Storing the number of rows and columns in separate output variables
[sizeM, sizeN] = size(f);
%Counter is used just to check the status of the program at all times.
counter = 0;
%for k=1:1:256
%gvalue_f(k) = 0;
%gvalue_N(k) = 0;
%end
%--------------------------------------------------------------------------
%This loops makes a window of 3*3 and scans over the image from left to
%right and top to bottom to get those pixel values that are most probably
%a function of Impulse, called Nimp.
for x=2:1:(sizeM-1)
for y=2:1:(sizeN-1)
k = x;
l = y;
x1 = f(k-1, l-1); x2 = f(k-1, l); x3 = f(k-1, l+1);
x4 = f(k, l-1); x5 = f(k, l); x6 = f(k, l+1);
x7 = f(k+1, l-1); x8 = f(k+1, l); x9 = f(k+1, l+1);
W = [x1,x2,x3,x4,x5,x6,x7,x8,x9];
x_sum = 0;
count = 0;
x_temp = 0;
wind(1,1) = W(1);
wind(1,2) = W(2);
wind(1,3) = W(3);
wind(2,1) = W(4);
wind(2,2) = W(5);
wind(2,3) = W(6);
wind(3,1) = W(7);
wind(3,2) = W(8);
wind(3,3) = W(9);
for m=1:1:3
for n=1:1:3
x_temp = wind(m,n);
if((x_temp == min(W)) | (x_temp == max(W)))% | (x_temp <= 10) | (x_temp >= 230))
Nimp_sub(m, n) = x_temp;
else
count = count + 1;
x_sum = x_sum + x_temp;
Nimp_sub(m, n) = 0;
end
end
end
%Nimp=size(f);
Nimp(k-1:k+1,l-1:l+1) = Nimp_sub;
counter = counter + 1
end
end
%---------------------------------------------------------------------------
%for k=2:1:sizeM-1
% for k=2:1:sizeN-1
% gvalue_f(f(k, l)) = gvalue_f(f(k, l)) + 1;
% Nimp_db = im2uint8(Nimp(k, l)) + 1;
% gvalue_N(Nimp_db(k, l)) = gvalue_N(Nimp_db(k, l)) + 1;
%end
%end
%Calculating the histograms of input image and Nimp (those pixels in the image
%which are most probably members of impulse noise).
temp_hist_f = hist(f, 256);
temp_hist_imp = hist(Nimp, 256);
for i=1:1:256
hist_f(i) = sum(temp_hist_f(i, );
hist_imp(i) = sum(temp_hist_imp(i, );
end
imshow(imagex);
title('Original Image');
figure;
imhist(imagex);
title('Histogram of Noise Added Image');
figure;
imhist(f);
title('Normalized Histogram of Noise Added Image');
figure;
|
|
|
|
|
Hello
I've never worked in Matlab -I'm a C++, C# developer-, so the code above is very unfamiliar. Yet I can get a grasp of what you are trying to do.
One Question:
Did you ever program in C#??
If you're asking someone to build your program from the scratch!! It's highly unlikely to find him here!! Sorry!
Regards
|
|
|
|
|
Hello,
I am aware of that I can open a website using the following snippet using MS IE,
System.Diagnostics.Process.Start("iexplore", "http://www.google.com");
But I dont want to specify Internet Explorer, I want to open the link using any installed default website explorer of the user.
Would anyone please give me an idea.
Thanks
|
|
|
|
|
In .NET 2.0 you can do this....
Help.ShowHelp(this, "http://www.google.com");
Steve Maier, MCSD MCAD MCTS
|
|
|
|
|
Hello
You can also do that in .Net 1.0 and 1.1 frameworks. Simply don't specify your application:
Process.Start("http://www.google.com.eg");
This way you are telling the "Windows Explorer" to open this "Document" -whether it's a website, pdf, image, etc...-. Windows Explorer doesn't open anything by itslef, rather it opens the default viewer associated with this type of "Document". In our case it will open the default web browser.
BTW: I use FireFox. And it works!
Regards
|
|
|
|
|
Hi Nader,
Thanks, IT REALLY WORKS....
|
|
|
|
|
Hi, folks!
I've made a sub-class of the System.Windows.Forms.RichTextBox called "MyRtfBox". Within my rtf box, I want to add a few properties which allow me to directly access some of the advanced properties of the rtf textbox, such as line count, getting the scrollbar thumb's position, etc. I'm glad to say that I've figured all of that out, EXCEPT for how to get and set the display rectangle using Windows Forms Messages!
I've looked all over the web and can't find any articles anywhere in C# that show how to use these two Messages. The examples I've seen in C++ and VB don't seem to translate well to C#. Does anyone have a clue?
When it's all set and done, I'd like to have a sub-classed RTF box with this public property...
//Taken from the Windows constants list.
private const int EM_GETRECT = 0x00b2;
private const int EM_SETRECT = 0x00b3;
public Rectangle DisplayRect
{
get
{
Rectangle rect = new Rectangle();
//Send a message to Windows somehow!
return rect;
}
set
{
//Send a message to Windows using the given Rectangle parameter.
}
}
Many thanks!!
Anthony
|
|
|
|
|
Okay, don't get hung up on the fact that I called the public property, "DisplayRect". I know there's already a public property on RTF boxes called DisplayRectangle.
The point of this exercise is to understand how to use the 2 Windows constants in sending messages to Windows asking for this info, and then setting a new value. Since there doesn't seem to be any other C#-specific examples out there in the world, this would be *really* useful!
Thanks!
Anthony
|
|
|
|
|
Hi!
I'd suppose you can use EM_GETRECT and EM_SETRECT just like any other windows message sent to your RTB.
The declaration of SendMessage is something like this:
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar); Then you can use this function to send the messages to your RTB. The last parameter (lPar) is used for the rectangle. You can use the Marshal.StructureToPtr() and Marshal.PtrToStructure() methods to transfer the rectangle data to your working structures.
That should do the trick...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I got an app where I use the backgroundworker and when it's done it fires off the BackgroundWorkerCompleted event. Which is all good. but I need to reused the object later on. I get an exception that the BackgroundWorker has already completed.
So I tried myBackgroundWorker = new BackgroundWorker(); but none of the events are hooked up any more and it just sits there.
Is there anyway to reset it? or do I have to set all the properties each time I use it?
-Kevin
|
|
|
|
|
kselman wrote: myBackgroundWorker = new BackgroundWorker();
You must reconnect the events, this is a new instance of BackgroundWorker. You can't rest the original because the thread has already completed its work and has been returned to the pool.
only two letters away from being an asset
|
|
|
|
|
If you're re-starting the worker with RunWorkerAsync() the only exception would be InvalidOperationException, which means the worker is still running (IsBusy is true).
What exception are you getting?
--Bob
|
|
|
|
|
Welp.. Its working now.. not sure what was going on with it before. Unfortunately I changed too many things between testing and Im no longer receiving the Exception. It said something about "Background Worker has already completed"
I think was I calling ReportProgress during the Completed event.. but I tried to recreate the problem to report to you here.. but that didnt cause the exception. I also had a pointer to a helper class that was init'd outside of the DoWork function, but I put that back in and it still works.. *shrug* sorry.. i usually dont jump the gun and post a request for help.. but It sure seemed that I could not re-use the B.W. with out hooking its events back up. Which is not the case.. Just calling RunWorkerAsync() re-runs it as expected.
You reply did help, because you seemed confident to be able to re-use RunWorkerAsync and sure enough the problem was on my end..
Thanks for the quick replies..
-- Kevin
|
|
|
|
|
Good to hear it's working. I have an instance of a class which is a subclass of BackgroundWorker that reuses DoWork many many times. Never had a problem with it.
- Bob
|
|
|
|
|
How should i insert a word document into database.
I defined a Blob field in the database and i used this code
FileStream fls;
fls = new FileStream(path, FileMode.Open, FileAccess.Read);
byte[] blob = new byte[fls.Length];
fls.Read(blob, 0, System.Convert.ToInt32(fls.Length));
fls.Close();
query = "insert into Example(BLOBField)values(:BlobParameter)";
OracleParameter blobParameter = new OracleParameter();
blobParameter.OracleType = OracleType.Blob;
blobParameter.ParameterName = "BlobParameter";
blobParameter.Value = blob;
conn.Open();
cmnd = new OracleCommand(query, conn);
cmnd.Parameters.Add(blobParameter);
cmnd.ExecuteNonQuery();
cmnd.Dispose();
conn.Close();
What am i doing wrong. Its throwing up an error. Is there any other way to do this.
Thanks
Kal
|
|
|
|
|
kalyanPaladugu wrote: Its throwing up an error.
It might be helpful to say what the error is you are getting.
only two letters away from being an asset
|
|
|
|
|