Search Results

Search found 17342 results on 694 pages for 'custom draw'.

Page 96/694 | < Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >

  • How can I draw on JPanel using another quadrant for the coordinates?

    - by Sanoj
    I would like to draw some shapes on a JPanel by overriding paintComponent. I would like to be able to pan and zoom. Panning and zooming is easy to do with AffineTransform and the setTransform method on the Graphics2D object. After doing that I can easyli draw the shapes with g2.draw(myShape) The shapes are defined with the "world coordinates" so it works fine when panning and I have to translate them to the canvas/JPanel coordinates before drawing. Now I would like to change the quadrant of the coordinates. From the 4th quadrant that JPanel and computer often uses to the 1st quadrant that the users are most familiar with. The X is the same but the Y-axe should increase upwards instead of downwards. It is easy to redefine origo by new Point(origo.x, -origo.y); But How can I draw the shapes in this quadrant? I would like to keep the coordinates of the shapes (defined in the world coordinates) rather than have them in the canvas coordinates. So I need to transform them in some way, or transform the Graphics2D object, and I would like to do it efficiently. Can I do this with AffineTransform too?

    Read the article

  • iTextSharp custom paper size

    - by Morron
    Hi, I'm using iTextsharp library to create PDF files. I can declare for A4 Landscape paper like this: Dim pdfTable As New PdfPTable(9) pdfTable.WidthPercentage = 100 Dim pdfDoc As New Document(PageSize.A4.Rotate()) I'm wondering how I can set Height of pdfTable or A4 Height manually. Because there's a lot more margin left at the bottom, and I need to put some text at that margin. Right now, I put a line of text at the bottom, the line's got pushed to the new page. Q1: How can I override the height of A4 paper provied by iTextsharp? Q2: How can I create a custom size paper, say Width = 29cm, Height = 22cm? Thank you.

    Read the article

  • Passing Custom Headers to Ajax request on Select2

    - by Sutikshan Dubey
    We are trying to implement Ajax Remote data loading in Select2:- $scope.configPartSelect2 = { minimumInputLength: 3, ajax: { url: "/api/Part", // beforeSend: function (xhr) { xhr.setRequestHeader('Authorization-Token', http.defaults.headers.common['Authorization-Token']); }, // headers: {'Authorization-Token': http.defaults.headers.common['Authorization-Token']}, data: function (term, page) { return {isStockable: true}; }, results: function (data, page) { // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to alter remote JSON data return { results: data }; } } }; We are using AngularJS. With each Http request we have set it's default to have our Authtoken as header. But somehow it is not working in conjunction with Select2 Ajax request. In above code, commented code are my failed attempts.

    Read the article

  • Custom Rails 3 Date Format

    - by Jack
    Hi, I am trying to format a date as follows using Rails 3; 3rd June 2003. This is not a standard way of showing the date, so I have looked into a custom way of doing it. Rails 3.0 documentation here suggests that I add a file at config/initializers/time_formats.rb containing the following code: Time::DATE_FORMATS[:custom_date] = lambda { |time| time.strftime("#{time.day.ordinalize} %B %Y") } And then call it using something like: <%= document.publish_date.to_formatted_s(:custom_date) %> However this isn't working and the date is being formatted as YYYY-MM-YY. Does anyone have any suggestions? Cheers

    Read the article

  • "must be convertible to System.Web.UI.Page" using custom base page in Visual Studio 2010

    - by Payton Byrd
    I have a HUGE problem. We just converted our large project to a Visual Studio 2010 solution, but maintained .Net 3.5 targets. This seemed to go swimmingly, almost too easy. Today I just encountered a huge problem. When we add a new asp.net tag to a page the designer class is not being updated. I looked around and noticed that the type specified in the Page's Inherits attribute was underlined in red. Hovering over that gives the error "must be convertible to System.Web.UI.Page". Obviously the designer isn't casting the page correctly and it's because we are using a custom base page, just as we had been with no problems in VS 2008. Has anyone else encountered this problem? If so, what's the solution. This is a show-stopper for us to use VS 2010 (and lots of egg on our faces for moving to it in the first place).

    Read the article

  • Custom UIToolBar from Images

    - by Sophtware
    I need to create a UIToolbar object that uses an image for the background. Most of the buttons are images as well, and rectangular. One button, however, is round and overlaps the toolbar like the Start button on the Windows task bar. See below. I know that I will need to subclass the UIToolbar to paint the image for the toolbar -- I think. If so, does anyone have example code showing how to do this? Furthermore, does anyone have any ideas on how to implement the larger round button? I'm thinking of another custom subclass for this, but not sure if there might be an easier way. I can have the art guys chop the image anyway needed, which I'm sure the round button will need to be chopped some how. Any ideas or sample code?

    Read the article

  • Custom app_offline.htm file during publish

    - by Charlino
    When I publish my ASP.NET MVC application it generates a app_offline.htm file to take the site offline while it updates the website and then deletes the file once the publish is successful. This is cool and I really like the idea, but I want to create my own custom app_offline.htm file that the publish action is aware of and put it somewhere where it doesn't effect my development site - i.e. it doesn't sit in the root of my development site rendering it offline all the time. TIA, Charles EDIT: From the comments on Scott Gu's post about app_offline.htm, it seems that customization of the app_offline.htm file wasn't possible with VS 2005 - has this changed with VS 2008 and now VS 2010?

    Read the article

  • Host a IWpfTextView in a custom tool for a Visual Studio Extension

    - by Adam Driscoll
    I'm trying to create a IWpfTextView and then put it into a custom tool window. I can create the view, read a file to populate the ITextBuffer and display the view into my tool. I cannot edit the code at all and the code is not syntax highlighted. What steps am I missing to make this a full fledged editor? Code: IComponentModel componentModel = (IComponentModel)GetGlobalService (typeof(SComponentModel)); var _textEditorFactoryService = componentModel.GetService<ITextEditorFactoryService>(); var _textBufferFactoryService = componentModel.GetService<ITextBufferFactoryService>(); var _contentTypeRegistryService = componentModel.GetService<IContentTypeRegistryService>(); TextReader reader = new StreamReader(fileName); var types = _contentTypeRegistryService.GetContentType("CSharp"); ITextBuffer textBuffer = _textBufferFactoryService.CreateTextBuffer(reader, types); var view = _textEditorFactoryService.CreateTextView(textBuffer); IWpfTextViewHost editor = _textEditorFactoryService.CreateTextViewHost(view, true);

    Read the article

  • How to implement a custom AlertDialog View

    - by stormin986
    In the Android docs on AlertDialog, it gives the following instruction and example for setting a custom view in an AlertDialog: If you want to display a more complex view, look up the FrameLayout called "body" and add your view to it: FrameLayout fl = (FrameLayout) findViewById(R.id.body); fl.add(myView, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); First off, it's pretty obvious that add() is a typo and is meant to be addView(). I'm confused by the first line using R.id.body. It seems that it's the body element of the AlertDialog ... but I can't just enter that in my code b/c it gives a compile error. Where does R.id.body get defined or assigned or whatever?

    Read the article

  • Custom HTML attributes on SelectListItems in MVC2?

    - by blesh
    I have a need to add custom HTML attributes, specifically classes or styles to option tags in the selects generated by Html.DropDownFor(). I've been playing with it, and for the life of me I can't figure out what I need to do to get what I need working. Assuming I have a list of colors that I'm generating the dropdown for, where the option value is the color's identifier, and the text is the name... here's what I'd like to be able to see as output: <select name="Color"> <option value="1" style="background:#ff0000">Red</option> <option value="2" style="background:#00ff00">Green</option> <option value="3" style="background:#0000ff">Blue</option> <!-- more here --> <option value="25" style="background:#f00f00">Foo Foo</option> </select

    Read the article

  • Unit testing methods decorated with custom attributes

    - by Joel Cunningham
    I am trying to retrofit unit tests on to some existing code base. Both the class and method I want to unit test is decorated with custom attributes. These attributes are fairly sophisticated and I dont want them to run as part of the unit test. The only solution I have come up with is to compile the attribute out when I want to unit test. I dont really like this solution and would prefer to either replace it with a mocked attribute at runtime or prevent the attribute from running in a more elegant way. How do you unit test code that has class and method attributes that you dont want to run as part of a unit test? Thanks in advance.

    Read the article

  • Google Maps v3, custom control with textbox: can't perform input

    - by Mike Sviridoff
    Hi, I am trying to add a custom control to my google map (v3): want to have search box just near the other map controls. So I add a div with <input type="textbox"> on it, and it's being shown on the map. But the porblem is that the textbox is inaccessible: i can't type anything inside it, or even focus on it. function SearchBox() { var searchTextBox = $('<input type="text" id="txtGeoSearch" />'); var div = $('<div class="geoSearchBox"></div>') .append($('<span>Search:</span>')) .append(searchTextBox); return div.get(0); } // inside init() geoMap.controls[google.maps.ControlPosition.TOP_LEFT].push(new SearchBox()); So what should I do to make my textbox behave like normal one?

    Read the article

  • WCF CreateMessage from custom body xml

    - by Cecil
    I have the following code: string body = "<custom xml>"; XDocument doc = XDocument.Parse(body); MemoryStream stream = new MemoryStream(); XmlWriter writer = XmlWriter.Create(stream); if (writer != null) { doc.Save(writer); writer.Flush(); writer.Close(); } stream.Position = 0; XmlReader rd = XmlReader.Create(stream); Message output = Message.CreateMessage(msg.Version, msg.Headers.Action, rd); output.Headers.CopyHeadersFrom(msg); output.Properties.CopyProperties(msg.Properties); When I try to use the message I get the following error: hexadecimal value 0x02, is an invalid character. Line 1, position 2. Any idea why? And what I can do to fix this?

    Read the article

  • Catches communication exception instead of custom fault exception - WCF

    - by Ismail S
    On Server I'm throwing the exception like this. catch(SqlException exception) { if (exception.Message.Contains("Custom error from stored proc")) { //Exception to be thrown when authentication fails. throw new FaultException<MyServiceFault>(new MyServiceFault { MessageText = exception.Message }); } } And on client end I'm catching the exception catch(FaultException<MyServiceFault> faultException) { } Here is my MyServiceFault [DataContract] public class MyServiceFault { [DataMember] public string MessageText { get; set; } [DataMember] public Guid Id { get; set; } } The problem is that on client, it doesn't go to MyServiceFault catch block instead it goes to communication exception catch block and throws this error System.ServiceModel.CommunicationException: The underlying connection was closed: The connection was closed unexpectedly. ---> System.Net.WebException I've also decorated my service method [FaultContract(typeof(MyServiceFault))] in the interface which is implemented by my service. In my web.config servicebehaviour tag consist <serviceDebug includeExceptionDetailInFaults="true" /> Any idea where I'm going wrong

    Read the article

  • Custom UISlider Image disappearing?

    - by Silent
    Hello all i have a custom image to replace the UISLider defult button image, all works fine image shows, it does not clip off. The problem is when i use the slider to move up and down the image dissapears and some how doesnt show up anymore only sometimes. could someone have a fix? CGRect rect = CGRectMake(16.0, 390.0, 297.0, 35.0); slider.frame = rect; UIImage* thumbImage = [UIImage imageNamed:@"thumb.png"]; [slider setThumbImage:thumbImage forState:UIControlStateNormal]; UIImage* leftImage = [UIImage imageNamed:@"SliderLeft.png"]; [slider setMinimumTrackImage:leftImage forState:UIControlStateNormal]; UIImage* rightImage = [UIImage imageNamed:@"SliderRight.png"]; [slider setMaximumTrackImage:rightImage forState:UIControlStateNormal];

    Read the article

  • Headers to set for AJAX calls in a custom webserver

    - by ErJab
    I'm writing a custom web server. When I enter the URL of my server in the browser, I get the sample text I write out to the socket in my browser correctly. This is the HTTP response that I write: HTTP/1.1 200 OK\r\n Server: My Server\r\n Date: Blah\r\n \r\n This is some sample text. This appears in my browser correctly when I connect directly to the server entering the URL. However, if I use Ajax (jQuery) to access the same URL and then set the innerHTML of an element on the HTML page, I do not get any data printed. Is there any other header I need to set on my web server so that the browser's XMLHttpRequest object detects the response?

    Read the article

  • WPF Custom TextBox ContextMenuOpening Problem

    - by Tom Allen
    I've got an issue with a custom control that I've written not firing it's ContextMenuOpening event when I hook it up programatically. The control is basically a wrapper for the standard TextBox: public class MyTextBox : TextBox { public MyTextBox() { this.ContextMenuOpening += new ContextMenuEventHandler(MyTextBox_ContextMenuOpening); } void MyTextBox_ContextMenuOpening(object sender, ContextMenuEventArgs e) { MessageBox.Show("ContextMenuOpening event fired"); } } There's nothing suspect either about the XAML: <local:MyTextBox Height="25" Width="300"/> For some reason though, I can never get the event to fire. I'm trying to intercept the context menu so I can alter it (it's context sensitive) and really am trying to avoid having to hook up the event everywhere the control is used - surely this is possible?

    Read the article

  • Django-Registration & Django-Profile, using your own custom form

    - by Issy
    Hey All, I am making use of django-registration and django-profile to handle registration and profiles. I would like to create a profile for the user at the time of registration. I have created a custom registration form, and added that to the urls.py using the tutorial on: http://dewful.com/?p=70 The basic idea in the tutorial is to override the default registration form to create the profile at the same time. forms.py - In my profiles app from django import forms from registration.forms import RegistrationForm from django.utils.translation import ugettext_lazy as _ from profiles.models import UserProfile from registration.models import RegistrationProfile attrs_dict = { 'class': 'required' } class UserRegistrationForm(RegistrationForm): city = forms.CharField(widget=forms.TextInput(attrs=attrs_dict)) def save(self, profile_callback=None): new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'], password=self.cleaned_data['password1'], email=self.cleaned_data['email']) new_profile = UserProfile(user=new_user, city=self.cleaned_data['city']) new_profile.save() return new_user In urls.py from profiles.forms import UserRegistrationForm and url(r'^register/$', register, {'backend': 'registration.backends.default.DefaultBackend', 'form_class' : UserRegistrationForm}, name='registration_register'), The form is displayed, and i can enter in City, however it does not save or create the entry in the DB.

    Read the article

  • Enums for Build Flavor and Build Platform in Custom TFS 2010 Build Activities

    - by Ben Hughes
    Are there enums available in the .NET framework that have values for build flavor (Debug, Release) and build platform (Any CPU, x86, x64 etc)? I haven't been able to find anything on MSDN or Google. It seems unnecessarily cumbersome to create my own. For context: I'm creating a custom TFS2010 workflow activity that requires flavor and platform info. Currently these are entered in the build definition as free-from strings. The default TFS build template has a dialog box (accessible in the build definition editor under Process\1.Required\Items to Build\Configurations to Build) that provides drop-down menus with this info pre-populated. I'd like to do something similar.

    Read the article

  • Custom Model binder not firing

    - by mare
    This is my custom model binder. I have my breakpoint set at BindModel but does not get fired with this controller action: public ActionResult Create(TabGroup tabGroup) ... public class BaseContentObjectCommonPropertiesBinder : DefaultModelBinder { public new object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { if (controllerContext == null) { throw new ArgumentNullException("controllerContext"); } if (bindingContext == null) { throw new ArgumentNullException("bindingContext"); } BaseContentObject obj = (BaseContentObject)base.BindModel(controllerContext, bindingContext); obj.Modified = DateTime.Now; obj.Created = DateTime.Now; obj.ModifiedBy = obj.CreatedBy = controllerContext.HttpContext.User.Identity.Name; return obj; } My registration: // tried both of these two lines ModelBinders.Binders[typeof(TabGroup)] = new BaseContentObjectCommonPropertiesBinder(); ModelBinders.Binders.Add(typeof(TabGroup), new BaseContentObjectCommonPropertiesBinder());

    Read the article

  • VS2010 Custom Code Analysis Rule

    - by devlife
    I'm trying to write a custom fxcop rule for mstest projects VS2010. I'd like to debug it but keep getting an exception when it tries to load the dll for the mstest project it fails stating that it can't find referenced assembly: Microsoft.FxCop.Common.AssemblyLoadException Could not load C:\Users\Administrator\Documents\Visual Studio 2010\Projects\20100106-CodeAnalysisRulesBlogDemo\BlogDemo\TestProject1\bin\Debug\TestProject1.dll. Microsoft.FxCop.Sdk.InvalidMetadataException The following error was encountered while reading module 'TestProject1': Assembly reference cannot be resolved: Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Does anyone have any idea how to resolve this? If I just run the code analysis it works fine but as soon as I try to debug it fails. Thanks

    Read the article

  • OData and custom WCF WebGet methods

    - by reinier
    I've created an OData endpoint (using entity framework, WCF data service) and added a custom test WebGet test method like so: [WebGet(UriTemplate = "{text}")] public IQueryable<string> SplitString(string text) { if (text == null) throw new DataServiceException("text not specified"); var result = (from s in text.Split('-') orderby s select s); return result.AsQueryable(); } and a config line: config.SetServiceOperationAccessRule("SplitString", ServiceOperationRights.All); However, no matter how I specify the url, I can not get the text param to be filled out. (it is always null). so: http://localhost/myservice.svc/SplitString/testtext does not work. What is the correct url format (or UriTemplate) one should use? The only examples I found of odata and WebGet only have an example method which doesn't have any parameters.

    Read the article

  • How to popViewController from button click of custom UITableViewCell

    - by Chi Rod
    I have a button in a custom UITableViewCell. Its UITableView is controlled by a UIViewController. I would like to return to the RootView when that button is clicked. I am trying to use [self.superview.navigationController popViewControllerAnimated:YES]; in the target Action of the button, which is in the UITableViewCell.m file. However, it doesn't recognize "navigationController" because it is not in the stack. How can I return to the RootView when that button is clicked?

    Read the article

  • ASP.NET MVC Class level custom data-annotation and ModelState keys

    - by Neil
    Hi, I have custom class level validation attribute, inheriting from ValidationAttribute, on my model. How come it doesn't register a key in the ModelState when its IsValid is false? I can see the the error message in the ModelState.Values collection, but the ModelState.Keys collection only shows an empty string "". Can I provide a key for it - presumably this is because its not assigned to a property? I wanna be able to use ModelState.Remove in my controller to remove this error upon a certain condition, but I have no Key! Any ideas?

    Read the article

< Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >