Tag: twitter

Close Enough

Posted by – April 26, 2008

I was able to finally get the table structure the way I wanted it.

Since my source data is all plain text, I identify the URLs and then add in the HREF data with the url as the link text as well as the location. Add in basic tags for displaying the images I want next to the next and — BAM! — now I have a grid showing the posts/pictures for each user.

Once that was in place, I did something similar for usernames.

Last but not least, I hijacked the DocumentCompleted event of the browser control to add an OnClick event for each link… That event lets me selectively perform actions based on what I need… So clicking on a normal URL will open up a new browser window displaying what’s needed. Clicking on the image link (the user pic) performs some stuff on the client side to allow replying to that person’s post.

It’ll make a bit more sense once I post some pics…

More than one way to skin a cat…

Posted by – April 26, 2008

Needed to display some data in a grid. No biggie. But I wanted some custom formatting — mainly allowing for links and whatnot. Eventually, I was left with two options — inheriting a richtextbox control and using that as a custom datagridcolumn or doing an override on a paint event for the cell…

Started with the richtextbox method, but it seemed like the only way that worked was if the editing control was overridden… Not much use for displaying the stuff. Meh.

So I tried out using the paint event. That actually worked pretty good at first. Using GDI+ DrawString calls to write what I wanted in the color/formatting I wanted — albeit in a somewhat clumsy way. But then I began running into issues when I had multiple strings needing formatting or if the string needed to wrap within the cell.

Deciding both method were way too complex for what I needed, I started rethinking the issue. What I really needed was a way to have it render HTML text. That way I could do some handy-wavy string manipulations to set the various tags I needed and that would be all that’s needed.

After looking around for a while for a simple way of doing that within the datagridview, I changed my design plan a bit…

That’s when I got an idea…

If I used a web browser control, I’d certainly have the HTML support I needed. And by using tables within HTML, I’d be able to get pretty close to the same grid feel as that original datagridview.